@openchambery/web 1.19.6 → 1.19.7-beta.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/dist/assets/{AgentAvatar-CecaXP3U.js → AgentAvatar-ziUs4sw3.js} +1 -1
- package/dist/assets/AssistantView-DF4yXFgS.js +1 -0
- package/dist/assets/{ChatContainer-BNiQ84dy.js → ChatContainer-CnOrdAgs.js} +41 -41
- package/dist/assets/ContextPanel-Cg_uCHzJ.js +285 -0
- package/dist/assets/DiagramView-DYh3Zn2y.js +1 -0
- package/dist/assets/FadeInOnReveal-BAlsRFJH.js +1 -0
- package/dist/assets/{Icon-Du1LX11Q.js → Icon-CLpn1mIz.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-QzUEpBEm.js +7 -0
- package/dist/assets/MarkstreamRendererImpl-CR0fBG5w.css +1 -0
- package/dist/assets/MarkstreamRendererImpl-CXrfeUia.js +1 -0
- package/dist/assets/MobileDetailNavigation-DJXEYfq4.js +1 -0
- package/dist/assets/MobileShareBridge-CliVo1YH.js +4 -0
- package/dist/assets/MobileSurface-9Xh6WQkY.js +2 -0
- package/dist/assets/{MultiRunWindow-BT7jpOmw.js → MultiRunWindow-khpnWyZO.js} +1 -1
- package/dist/assets/OnboardingScreen-CJYyR54B.js +1 -0
- package/dist/assets/OverlayScrollbar-C-jZ8ITG.js +2 -0
- package/dist/assets/SettingsView-DyCZehFG.js +25 -0
- package/dist/assets/{SettingsWindow-fsuSYQpN.js → SettingsWindow-Dx5rU9v5.js} +1 -1
- package/dist/assets/TerminalView-XSALfUaH.js +8 -0
- package/dist/assets/ToolOutputDialog-BfuXazW9.js +10 -0
- package/dist/assets/__vite-optional-peer-dep_mermaid_markstream-react-CQGbcmkI.js +1 -0
- package/dist/assets/appThemeRegistry-DDWrniMM.js +2 -0
- package/dist/assets/{button-p6vbd3r6.js → button-z0GOBtWi.js} +1 -1
- package/dist/assets/clipboard-Bz0Zm9VJ.js +1 -0
- package/dist/assets/{collapsible-Cimoz0kx.js → collapsible-D9zJRpeB.js} +1 -1
- package/dist/assets/d2_markstream-react-DtM9g53j.js +1 -0
- package/dist/assets/desktop-CfLlmafK.js +1 -0
- package/dist/assets/desktopHosts-C1Ns3DUu.js +1 -0
- package/dist/assets/desktopRelayRestore-LBt0CBOj.js +1 -0
- package/dist/assets/{diagram-DX_MPRs3.js → diagram-CoEqmReY.js} +1 -1
- package/dist/assets/{dialog-Bjnvo5pk.js → dialog-HCE4eLUW.js} +1 -1
- package/dist/assets/fileQueries-Dnn15WsA.js +1 -0
- package/dist/assets/{gitApi-DpRVHaQE.js → gitApi-DNTMAa3F.js} +1 -1
- package/dist/assets/infographic_markstream-react-C3vVus-4.js +1 -0
- package/dist/assets/{input-gaFVNq1P.js → input-BG3VWTIF.js} +1 -1
- package/dist/assets/insertionBoundaries-DMxuUnL_.js +4 -0
- package/dist/assets/main-B9HVtgXE.js +2 -0
- package/dist/assets/main-ZNyIs3Sn.js +29 -0
- package/dist/assets/markdown-worker-y3ewaqAK.js +4 -0
- package/dist/assets/markdownHeightCache-CvUyZT4q.js +1 -0
- package/dist/assets/markdownTheme-TdhQOZSN.js +2 -0
- package/dist/assets/miniChat-q0T0WGkZ.js +2 -0
- package/dist/assets/mobile-DEduvLJj.js +2 -0
- package/dist/assets/multirun-DU-wrxlG.js +4 -0
- package/dist/assets/persistence-CmjKImz2.js +3 -0
- package/dist/assets/platform-skqcMARt.js +2 -0
- package/dist/assets/projectMeta-DNWx6Uva.js +3 -0
- package/dist/assets/radio-BEonIX1k.js +1 -0
- package/dist/assets/renderElectronMiniChatApp--JYWY41L.js +2 -0
- package/dist/assets/renderMobileApp-B0Ix_uNo.js +25 -0
- package/dist/assets/runtime-switch-BkpTTbEi.js +1 -0
- package/dist/assets/runtimeConfig-BTDIG7mX.js +2 -0
- package/dist/assets/runtimeEndpointReset-CZQCYtVI.js +4 -0
- package/dist/assets/{shikiHighlight-Bs6Tt3X-.js → shikiHighlight-C9Cx56Qg.js} +1 -1
- package/dist/assets/sortable-tabs-strip-Bj8N0VWf.js +1 -0
- package/dist/assets/terminalApi-CNqqwjfG.js +1 -0
- package/dist/assets/{tooltip-D1a6rKLA.js → tooltip-CtH61mQh.js} +1 -1
- package/dist/assets/url-KeihbE0d.js +1 -0
- package/dist/assets/useAppFontEffects-CKLSamae.js +7 -0
- package/dist/assets/useAssistantUIStore-DaplPyb0.js +1 -0
- package/dist/assets/useDesktopWindowControlsLayout-DJSkFfhT.js +1 -0
- package/dist/assets/{useEffectiveDirectory-CmjO98kZ.js → useEffectiveDirectory-B3rbY1Kv.js} +1 -1
- package/dist/assets/useFontPreferences-D8emhcNv.js +1 -0
- package/dist/assets/useMobileNavigationStore-CAvVUItx.js +412 -0
- package/dist/assets/useSessionAutoCleanup-DxNgqJ8s.js +1 -0
- package/dist/assets/useUIStore-B7KJS5G7.js +1 -0
- package/dist/assets/useWorkerHighlightedLines-DiDF68LR.js +7 -0
- package/dist/assets/utils-CTL16t2f.js +1 -0
- package/dist/assets/vendor-floating-ui-core-Co1I1lFV.js +1 -0
- package/dist/assets/vendor-floating-ui-dom-BHhLtF5l.js +1 -0
- package/dist/assets/vendor-katex--B5dHUyk.js +257 -0
- package/dist/assets/vendor-markstream-core-Cm34iPLL.js +3 -0
- package/dist/assets/vendor-markstream-react-CGQrpq8a.css +1 -0
- package/dist/assets/vendor-markstream-react-CwvbEg9R.js +173 -0
- package/dist/assets/vendor-pierre-diffs-DX7XTPG3.js +2795 -0
- package/dist/assets/vendor-pierre-theme-D9JzKBPc.js +1 -0
- package/dist/assets/vendor-stream-diffs-DWy3xSmp.js +6 -0
- package/dist/index.html +10 -8
- package/dist/mini-chat.html +10 -8
- package/dist/mobile.html +10 -8
- package/package.json +1 -1
- package/dist/assets/AssistantView-BJv9QUM-.js +0 -1
- package/dist/assets/ContextPanel-Df7BbJaq.js +0 -285
- package/dist/assets/DiagramView-Cw96eBGZ.js +0 -1
- package/dist/assets/FadeInOnReveal-Cj9ZC3Ab.js +0 -1
- package/dist/assets/MarkdownRendererImpl-DtZOlgmm.js +0 -7
- package/dist/assets/MobileDetailNavigation-C_4Y_X61.js +0 -1
- package/dist/assets/MobileShareBridge-CRpk-w3Q.js +0 -4
- package/dist/assets/MobileSurface-Brh-Z1KZ.js +0 -2
- package/dist/assets/OnboardingScreen-BkbprNa7.js +0 -1
- package/dist/assets/OverlayScrollbar-oOLMqq2s.js +0 -2
- package/dist/assets/SettingsView-BFP8FEvx.js +0 -25
- package/dist/assets/TerminalView-Z11uL87z.js +0 -8
- package/dist/assets/ToolOutputDialog-BV2y1sgg.js +0 -10
- package/dist/assets/appThemeRegistry-CNVnIaLQ.js +0 -2
- package/dist/assets/clipboard-C0bgPFn5.js +0 -1
- package/dist/assets/desktopHosts-DceeVBky.js +0 -1
- package/dist/assets/desktopRelayRestore-B0MRdR5y.js +0 -1
- package/dist/assets/fileQueries-BDld6h3B.js +0 -1
- package/dist/assets/insertionBoundaries-Dj5ZcWxy.js +0 -4
- package/dist/assets/main-B_kb4yxM.js +0 -29
- package/dist/assets/main-BqE-HYIY.js +0 -2
- package/dist/assets/markdown-worker-CoO82KYF.js +0 -4
- package/dist/assets/markdownTheme-St8zxDvJ.js +0 -2
- package/dist/assets/miniChat-CUYIqudA.js +0 -2
- package/dist/assets/mobile-C4xx6vwy.js +0 -2
- package/dist/assets/multirun-CfDp-MKW.js +0 -4
- package/dist/assets/persistence-CLUawIlm.js +0 -3
- package/dist/assets/platform-BrncW9ab.js +0 -2
- package/dist/assets/projectMeta-DuKavDZ0.js +0 -3
- package/dist/assets/radio-BgPFAtiV.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-BjwbnKC-.js +0 -2
- package/dist/assets/renderMobileApp-DzGInnvc.js +0 -25
- package/dist/assets/runtimeConfig-D5qWnnR3.js +0 -2
- package/dist/assets/runtimeEndpointReset-kob_Gqd0.js +0 -4
- package/dist/assets/sortable-tabs-strip-oDpTDVoQ.js +0 -1
- package/dist/assets/terminalApi-D2OzR0I3.js +0 -1
- package/dist/assets/url-zwuNq3GS.js +0 -1
- package/dist/assets/useAppFontEffects-DR99zjde.js +0 -7
- package/dist/assets/useAssistantUIStore-D699Sbdb.js +0 -1
- package/dist/assets/useDesktopWindowControlsLayout-DT4BmF4D.js +0 -1
- package/dist/assets/useFontPreferences-F2QPNE2V.js +0 -1
- package/dist/assets/useMobileNavigationStore-DLW9tcn6.js +0 -412
- package/dist/assets/useSessionAutoCleanup-BE7yfJLF.js +0 -1
- package/dist/assets/useUIStore-BXjMQrel.js +0 -1
- package/dist/assets/useWorkerHighlightedLines-5n25LYcg.js +0 -7
- package/dist/assets/utils-D94hxQYq.js +0 -1
- package/dist/assets/vendor-katex-CNGgSigB.js +0 -257
- package/dist/assets/vendor-pierre-diffs-BenIz2TM.js +0 -1418
- package/dist/assets/vendor-pierre-theme-F9vQJHIe.js +0 -1
|
@@ -0,0 +1,2795 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-shikijs-langs-eloENL-7.js","assets/rolldown-runtime-C0FnF6B9.js","assets/vendor-shikijs-themes-C7F1vBnG.js","assets/vendor-shiki-DzFPeSWm.js","assets/vendor-pierre-theme-D9JzKBPc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{nt as n,rt as r}from"./vendor-base-ui-CnHfUmDN.js";import{o as i}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{t as a}from"./vendor-hast-util-to-html-B0p1k5Xa.js";import{t as o}from"./vendor-oniguruma-to-es-CrHzjjSU.js";import{n as s,r as c,t as l}from"./vendor-diff-Dq7CZNim.js";import{t as u}from"./vendor-lru_map-DpDied8H.js";var d=`diffs-container`,f=(()=>{try{return!1}catch{return!1}})(),p=/(?=^From [a-f0-9]+ .+$)/m,m=/(?=^diff --git)/gm,h=/(?=^---\s+\S)/gm,g=/(?=^@@ )/gm,_=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,v=/(?<=\n)/,y=/^(---|\+\+\+)\s+([^\t\r\n]+)/,b=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,x=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,S=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,C=/^<{7,}(?:\s.*)?$/,w=/^\|{7,}(?:\s.*)?$/,T=/^={7,}$/,E=/^>{7,}(?:\s.*)?$/,D=`header-prefix`,O=`header-filename-suffix`,k=`header-metadata`,A=`header-custom`,j={dark:`pierre-dark`,light:`pierre-light`},M=`data-theme-css`,N=`data-unsafe-css`,ee=`data-core-css`,te=`data-diffs-scrollbar-measure`,ne=`data-diffs-code-view-header`,re=`data-diffs-code-view-footer`,ie=`--diffs-scrollbar-gutter-measured`,ae=1e5,oe={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},se={...oe,hunkLineCount:1},ce={paddingTop:8,paddingBottom:8,gap:8},le={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},ue=Object.freeze({fromStart:0,fromEnd:0}),de={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},fe={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},pe=new Map,me=new Map,he=new Map,ge=new Set;function _e(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!ge.has(t))return!1;return!0}function ve(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(ge.has(n.name))continue;let e=pe.get(n.name);e??(e=n,pe.set(n.name,e)),ge.add(e.name),t.loadLanguageSync(e.data)}}function ye(){pe.clear(),ge.clear()}function be(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var P=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function xe(e){return Se(e)}function Se(e){return Array.isArray(e)?Ce(e):e instanceof RegExp?e:typeof e==`object`?we(e):e}function Ce(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Se(e[n]);return t}function we(e){let t={};for(let n in e)t[n]=Se(e[n]);return t}function Te(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Ee(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Ee(e.substring(0,e.length-1)):e.substr(~t+1)}var De=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Oe=class{static hasCaptures(e){return e!==null&&(De.lastIndex=0,De.test(e))}static replaceCaptures(e,t,n){return e.replace(De,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function ke(e,t){return e<t?-1:+(e>t)}function Ae(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=ke(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function je(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Me(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Ne=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Pe=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(ze(e),t)}static createFromParsedTheme(e,t){return Ve(e,t)}_cachedMatchRoot=new Ne(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Ie(e.parent,t.parentScopes));return n?new Re(n.fontStyle,n.foreground,n.background):null}},Fe=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Ie(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Le(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Le(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Re=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function ze(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&je(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&je(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Be(l,u,e,o,s,c)}}return n}var Be=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},F=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(F||{});function Ve(e,t){e.sort((e,t)=>{let n=ke(e.scope,t.scope);return n!==0||(n=Ae(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new He(t),o=new Re(n,a.getId(r),a.getId(i)),s=new Ge(new We(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Pe(a,o,s)}var He=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ue=Object.freeze([]),We=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ue,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e||(this.scopeDepth=e),t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Ge=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),We.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Ae(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new We(e,t,n,r,i))}},Ke=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){e.getLanguageId(t),e.getTokenType(t),e.getFontStyle(t),e.getForeground(t),e.getBackground(t)}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Je(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function qe(e){return e}function Je(e){return e}function Ye(e,t){let n=[],r=Ze(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:`${i}`}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Xe(i)){let e=[];do e.push(i),i=r.next();while(Xe(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Xe(e){return!!e&&!!e.match(/[\w\.:]+/)}function Ze(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Qe(e){typeof e.dispose==`function`&&e.dispose()}var $e=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},et=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},tt=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},nt=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new $e(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new tt;for(let n of e)rt(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof $e){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function rt(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof $e?at({baseGrammar:a,selfGrammar:i},r):it(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new $e(e))}function it(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];ot([r],t,n)}}function at(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&ot(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&ot(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function ot(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Te({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&ot(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ft(i);switch(a.kind){case 0:at({...t,selfGrammar:t.baseGrammar},n);break;case 1:at(t,n);break;case 2:it(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?it(a.ruleName,i,n):at(i,n)}else a.kind===4?n.add(new et(a.scopeName,a.ruleName)):n.add(new $e(a.scopeName))}}}var st=class{kind=0},ct=class{kind=1},lt=class{constructor(e){this.ruleName=e}kind=2},ut=class{constructor(e){this.scopeName=e}kind=3},dt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ft(e){if(e===`$base`)return new st;if(e===`$self`)return new ct;let t=e.indexOf(`#`);return t===-1?new ut(e):t===0?new lt(e.substring(1)):new dt(e.substring(0,t),e.substring(t+1))}var pt=/\\(\d+)/,mt=/\\(\d+)/g,ht=-1,gt=-2;function _t(e){return e}function vt(e){return e}var yt=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Oe.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Oe.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Ee(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Oe.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Oe.replaceCaptures(this._contentName,e,t)}},bt=class extends yt{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},xt=class extends yt{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Et(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Dt,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},St=class extends yt{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Dt,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ct=class extends yt{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new Et(i,this.id),this.beginCaptures=a,this._end=new Et(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Dt;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},wt=class extends yt{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new Et(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Et(o,gt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Dt;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Dt,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},Tt=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new bt(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new xt(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Te({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new St(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new wt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Ct(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ft(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof St||e instanceof Ct||e instanceof wt)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Et=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&pt.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return mt.lastIndex=0,this.source.replace(mt,(e,t)=>Me(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Dt=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(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Ot(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new Ot(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Ot=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
3
|
+
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},kt=class{constructor(e,t){this.languageId=e,this.tokenType=t}},At=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new kt(e,8),this._embeddedLanguagesMatcher=new jt(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new kt(0,0);_getBasicScopeAttributes=new Ne(e=>new kt(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.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 Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},jt=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Me(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Mt=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Nt(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Pt(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Mt(i,!0);f()}return new Mt(i,!1);function f(){let o=Ft(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===ht){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Bt(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Ct){let r=o;Bt(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof wt){let r=o;Bt(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Bt(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Pt(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof wt&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=zt(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==gt){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Bt(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Ft(e,t,n,r,i,a){let o=It(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Lt(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function It(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Rt(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Lt(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Rt(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Rt(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function zt(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Bt(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Nt(e,p,n&&d.start===0,d.start,f,i,!1,0),Qe(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Vt(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Vt=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Ht(e,t,n,r,i,a,o,s){return new Kt(e,t,n,r,i,a,o,s)}function Ut(e,t,n,r,i){let a=Ye(t,Wt),o=Tt.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Wt(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Gt(t[r],e))return n=r+1,!0;return!1})}function Gt(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Kt=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new At(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=qt(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Ye(e,Wt);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Ut(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Ut(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(_t(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[vt(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=qt(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Tt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Yt.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Ke.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Jt.createRootAndLookUpScopeName(a,r,this):Jt.createRoot(`unknown`,r),t=new Yt(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
|
+
`;let a=this.createOnigString(e),o=a.content.length,s=new Zt(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Nt(this,a,i,0,t,s,!0,r);return Qe(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function qt(e,t){return e=xe(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Jt=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Fe.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Fe(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Fe(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Ke.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Yt=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Jt.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:vt(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Jt.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,_t(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Jt.fromExtension(r,n.contentNameScopesList))}},Xt=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Ye(e,Wt).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Ye(e,Wt).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Zt=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Ke.set(n,0,qe(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Ke.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Qt=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Ht(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},$t=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Qt(Pe.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Pe.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Xt(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new nt(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},en=Yt.NULL;function tn(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function nn(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function rn(e){return Array.isArray(e)?e:[e]}async function an(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function on(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function sn(e){return e===`ansi`||on(e)}function cn(e){return e===`none`}function ln(e){return cn(e)}function un(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(/\s+/g);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function dn(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(/(\r?\n)/g),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}function fn(e){let t=dn(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function pn(e,t,n){let r=new Set;for(let t of e.matchAll(/:?lang=["']([^"']+)["']/g)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(/(?:```|~~~)([\w-]+)/g)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(/\\begin\{([\w-]+)\}/g)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(!n)return Array.from(r);let i=n.getBundledLanguages();return Array.from(r).filter(e=>e&&i[e])}var mn=`light-dark()`,hn=[`color`,`background-color`];function gn(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function _n(e,t){let n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?gn(e,t):e})):e}function vn(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>yn(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&hn.includes(a))if(r===mn&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new P('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s;else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function yn(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&F.Italic&&(t[`font-style`]=`italic`),e.fontStyle&F.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&F.Underline&&n.push(`underline`),e.fontStyle&F.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function bn(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}var xn=new WeakMap;function Sn(e,t){xn.set(e,t)}function Cn(e){return xn.get(e)}var wn=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(rn(n).map(e=>[e,en])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Tn(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Tn(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function En(e,t){if(!(e instanceof wn))throw new P(`Invalid grammar state`);return e.getInternalStack(t)}function Dn(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new P(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}{let t=r.lines[e.line];if(t===void 0)throw new P(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new P(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}},r=fn(t.source),i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));On(i),e.set(t.meta,{decorations:i,converter:r,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return _n(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=Array.from(e.children).filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new P(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=kn(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new P(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new P(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&un(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function On(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new P(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new P(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function kn(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(kn).join(``):``}var An=[Dn()];function jn(e){let t=Mn(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...An]}function Mn(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var Nn=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],Pn={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function Fn(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function In(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function Ln(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:`resetAll`});else if(r<=9)Pn[r]&&t.push({type:`setDecoration`,value:Pn[r]});else if(r<=29){let e=Pn[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:Nn[r-30]}});else if(r===38){let n=In(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:Nn[r-40]}});else if(r===48){let n=In(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:Nn[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:Nn[r-100+8]}})}return t}function Rn(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=Fn(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=Ln(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var zn={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 Bn(e=zn){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<Nn.length;e++)r.push(t(Nn[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var Vn={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 Hn(e,t,n){let r=tn(e,n),i=dn(t),a=Bn(Object.fromEntries(Nn.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||Vn[t]]}))),o=Rn();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=nn(i,r),o=nn(o,r),n.decorations.has(`dim`)&&(i=Un(i));let s=F.None;return n.decorations.has(`bold`)&&(s|=F.Bold),n.decorations.has(`italic`)&&(s|=F.Italic),n.decorations.has(`underline`)&&(s|=F.Underline),n.decorations.has(`strikethrough`)&&(s|=F.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function Un(e){let t=e.match(/#([0-9a-f]{3,8})/i);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Wn(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n,i=e.resolveLangAlias(n.lang||`text`);if(on(i)||cn(r))return dn(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:a,colorMap:o}=e.setTheme(r);if(i===`ansi`)return Hn(a,t,n);let s=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new P(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(a.name))throw new P(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return Kn(t,s,a,o,n)}function Gn(...e){if(e.length===2)return Cn(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(on(i)||cn(a))throw new P(`Plain language does not have grammar state`);if(i===`ansi`)throw new P(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new wn(qn(n,c,o,s,r).stateStack,c.name,o.name)}function Kn(e,t,n,r,i){let a=qn(e,t,n,r,i),o=new wn(a.stateStack,t.name,n.name);return Sn(a.tokens,o),a.tokens}function qn(e,t,n,r,i){let a=tn(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=dn(e),l=i.grammarState?En(i.grammarState,n.name)??en:i.grammarContextCode==null?en:qn(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e<f;e++){let[f,p]=c[e];if(f===``){u=[],d.push([]);continue}if(o>0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:f.length;if(t===o)continue;let s=_.tokens[2*e+1],c=nn(r[Ke.getForeground(s)],a),l=Ke.getFontStyle(s),d={content:f.substring(t,o),offset:p+t,color:c,fontStyle:l};if(i.includeExplanation){let e=[];if(i.includeExplanation!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(/,/).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=f.substring(t.startIndex,t.endIndex);r+=n.length,d.explanation.push({content:n,scopes:i.includeExplanation===`scopeName`?Jn(t.scopes):Yn(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function Jn(e){return e.map(e=>({scopeName:e}))}function Yn(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Qn(e,i,t.slice(0,r))}}return n}function Xn(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Zn(e,t,n){if(!Xn(e[e.length-1],t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Xn(e[r],n[i])&&--r,--i;return r===-1}function Qn(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Zn(e,t,n)){r.push(a);break}return r}function $n(e,t,n){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=r.map(r=>{let i=Wn(e,t,{...n,theme:r.theme});return{tokens:i,state:Cn(i),theme:typeof r.theme==`string`?r.theme:r.theme.name}}),a=er(...i.map(e=>e.tokens)),o=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,n)=>{let{content:a,explanation:s,offset:c,...l}=e[t][i];o.variants[r[n].color]=l}),o})),s=i[0].state?new wn(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&Sn(o,s),o}function er(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}function tr(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new P("`themes` option must not be empty");let p=$n(e,t,n);if(c=Cn(p),l&&mn!==l&&!f.find(e=>e.color===l))throw new P(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>vn(e,h,u,l,d))),c&&Sn(a,c);let g=f.map(e=>tn(e.theme,n));i=nr(f,m,g,u,l,`fg`,d),r=nr(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=tn(n.theme,n);a=Wn(e,t,n);let l=e.getTheme(n.theme);r=nn(l.bg,s),i=nn(l.fg,s),o=l.name,c=Cn(a)}else throw new P("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function nr(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=nn(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===mn&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new P('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${nn(t[r][a],n[r])||`inherit`}, ${nn(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function rr(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>rr(e,t,n),codeToTokens:(t,n)=>tr(e,t,n)}){let i=t;for(let e of jn(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=tr(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=ar(a):d===`never`&&(a=or(a)),f&&(a=sr(a));let p={...r,get source(){return i}};for(let e of jn(n))a=e.tokens?.call(p,a)||a;return ir(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function ir(e,t,n,r=Cn(e)){let i=jn(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:un,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
5
|
+
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=bn(a.htmlStyle||yn(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&Sn(m,r),m}function ar(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&F.Underline||i.fontStyle&F.Strikethrough));o&&i.content.match(/^\s+$/)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function or(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function sr(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t[t.length-1],r=bn(e.htmlStyle||yn(e)),i=bn(n.htmlStyle||yn(n)),a=e.fontStyle&&(e.fontStyle&F.Underline||e.fontStyle&F.Strikethrough),o=n.fontStyle&&(n.fontStyle&F.Underline||n.fontStyle&F.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var cr=a;function lr(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>rr(e,t,n),codeToTokens:(t,n)=>tr(e,t,n)},i=cr(rr(e,t,n,r));for(let e of jn(n))i=e.postprocess?.call(r,i,n)||i;return i}var ur={light:`#333333`,dark:`#bbbbbb`},dr={light:`#fffffe`,dark:`#1e1e1e`},fr=`__shiki_resolved`;function pr(e){if(e?.[fr])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?ur.light:ur.dark,n||=t.type===`light`?dr.light:dr.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,fr,{enumerable:!1,writable:!1,value:!0}),t}async function mr(e){return Array.from(new Set((await Promise.all(e.filter(e=>!sn(e)).map(async e=>await an(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function hr(e){return(await Promise.all(e.map(async e=>ln(e)?null:pr(await an(e))))).filter(e=>!!e)}var gr=3;function _r(e,t=3){gr&&(typeof gr==`number`&&t>gr||`${e}`)}var vr=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function yr(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new vr(`Circular alias \`${Array.from(n).join(` -> `)} -> ${e}\``);n.add(e)}}return e}var br=class extends $t{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),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){let t=pr(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Pe.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=yr(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new vr(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return 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);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},xr=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},Sr=0;function Cr(e){Sr+=1,e.warnings!==!1&&Sr>=10&&Sr%10==0&&console.warn(`[Shiki] ${Sr} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new vr("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(pr),i=new br(new xr(e.engine,n),r,n,e.langAlias),a;function o(t){return yr(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new vr(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new vr(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await mr(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await hr(e))}function g(){if(t)throw new vr(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--Sr)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function wr(e){e.engine||_r("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([hr(e.themes||[]),mr(e.langs||[]),e.engine]);return Cr({...e,themes:t,langs:n,engine:r})}async function Tr(e){let t=await wr(e);return{getLastGrammarState:(...e)=>Gn(t,...e),codeToTokensBase:(e,n)=>Wn(t,e,n),codeToTokensWithThemes:(e,n)=>$n(t,e,n),codeToTokens:(e,n)=>tr(t,e,n),codeToHast:(e,n)=>rr(t,e,n),codeToHtml:(e,n)=>lr(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Er(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,sn(n))return[];let r=t[n];if(!r)throw new P(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(ln(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new P(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await Tr({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function Dr(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function Or(e,t){let n=Dr(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}function kr(e={}){let{name:t=`css-variables`,variablePrefix:n=`--shiki-`,fontStyle:r=!0}=e,i=t=>e.variableDefaults?.[t]?`var(${n}${t}, ${e.variableDefaults[t]})`:`var(${n}${t})`,a={name:t,type:`dark`,colors:{"editor.foreground":i(`foreground`),"editor.background":i(`background`),"terminal.ansiBlack":i(`ansi-black`),"terminal.ansiRed":i(`ansi-red`),"terminal.ansiGreen":i(`ansi-green`),"terminal.ansiYellow":i(`ansi-yellow`),"terminal.ansiBlue":i(`ansi-blue`),"terminal.ansiMagenta":i(`ansi-magenta`),"terminal.ansiCyan":i(`ansi-cyan`),"terminal.ansiWhite":i(`ansi-white`),"terminal.ansiBrightBlack":i(`ansi-bright-black`),"terminal.ansiBrightRed":i(`ansi-bright-red`),"terminal.ansiBrightGreen":i(`ansi-bright-green`),"terminal.ansiBrightYellow":i(`ansi-bright-yellow`),"terminal.ansiBrightBlue":i(`ansi-bright-blue`),"terminal.ansiBrightMagenta":i(`ansi-bright-magenta`),"terminal.ansiBrightCyan":i(`ansi-bright-cyan`),"terminal.ansiBrightWhite":i(`ansi-bright-white`)},tokenColors:[{scope:[`keyword.operator.accessor`,`meta.group.braces.round.function.arguments`,`meta.template.expression`,`markup.fenced_code meta.embedded.block`],settings:{foreground:i(`foreground`)}},{scope:`emphasis`,settings:{fontStyle:`italic`}},{scope:[`strong`,`markup.heading.markdown`,`markup.bold.markdown`],settings:{fontStyle:`bold`}},{scope:[`markup.italic.markdown`],settings:{fontStyle:`italic`}},{scope:`meta.link.inline.markdown`,settings:{fontStyle:`underline`,foreground:i(`token-link`)}},{scope:[`string`,`markup.fenced_code`,`markup.inline`],settings:{foreground:i(`token-string`)}},{scope:[`comment`,`string.quoted.docstring.multi`],settings:{foreground:i(`token-comment`)}},{scope:[`constant.numeric`,`constant.language`,`constant.other.placeholder`,`constant.character.format.placeholder`,`variable.language.this`,`variable.other.object`,`variable.other.class`,`variable.other.constant`,`meta.property-name`,`meta.property-value`,`support`],settings:{foreground:i(`token-constant`)}},{scope:[`keyword`,`storage.modifier`,`storage.type`,`storage.control.clojure`,`entity.name.function.clojure`,`entity.name.tag.yaml`,`support.function.node`,`support.type.property-name.json`,`punctuation.separator.key-value`,`punctuation.definition.template-expression`],settings:{foreground:i(`token-keyword`)}},{scope:`variable.parameter.function`,settings:{foreground:i(`token-parameter`)}},{scope:[`support.function`,`entity.name.type`,`entity.other.inherited-class`,`meta.function-call`,`meta.instance.constructor`,`entity.other.attribute-name`,`entity.name.function`,`constant.keyword.clojure`],settings:{foreground:i(`token-function`)}},{scope:[`entity.name.tag`,`string.quoted`,`string.regexp`,`string.interpolated`,`string.template`,`string.unquoted.plain.out.yaml`,`keyword.other.template`],settings:{foreground:i(`token-string-expression`)}},{scope:[`punctuation.definition.arguments`,`punctuation.definition.dict`,`punctuation.separator`,`meta.function-call.arguments`],settings:{foreground:i(`token-punctuation`)}},{scope:[`markup.underline.link`,`punctuation.definition.metadata.markdown`],settings:{foreground:i(`token-link`)}},{scope:[`beginning.punctuation.definition.list.markdown`],settings:{foreground:i(`token-string`)}},{scope:[`punctuation.definition.string.begin.markdown`,`punctuation.definition.string.end.markdown`,`string.other.link.title.markdown`,`string.other.link.description.markdown`],settings:{foreground:i(`token-keyword`)}},{scope:[`markup.inserted`,`meta.diff.header.to-file`,`punctuation.definition.inserted`],settings:{foreground:i(`token-inserted`)}},{scope:[`markup.deleted`,`meta.diff.header.from-file`,`punctuation.definition.deleted`],settings:{foreground:i(`token-deleted`)}},{scope:[`markup.changed`,`punctuation.definition.changed`],settings:{foreground:i(`token-changed`)}}]};return r||(a.tokenColors=a.tokenColors?.map(e=>(e.settings?.fontStyle&&delete e.settings.fontStyle,e))),a}var Ar=[{id:`abap`,name:`ABAP`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.yi),__vite__mapDeps([0,1])))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.vi),__vite__mapDeps([0,1])))},{id:`ada`,name:`Ada`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e._i),__vite__mapDeps([0,1])))},{id:`angular-html`,name:`Angular HTML`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.pi),__vite__mapDeps([0,1])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.di),__vite__mapDeps([0,1])))},{id:`apache`,name:`Apache Conf`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ui),__vite__mapDeps([0,1])))},{id:`apex`,name:`Apex`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.li),__vite__mapDeps([0,1])))},{id:`apl`,name:`APL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ai),__vite__mapDeps([0,1])))},{id:`applescript`,name:`AppleScript`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ii),__vite__mapDeps([0,1])))},{id:`ara`,name:`Ara`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ri),__vite__mapDeps([0,1])))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ni),__vite__mapDeps([0,1])))},{id:`asm`,name:`Assembly`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ti),__vite__mapDeps([0,1])))},{id:`astro`,name:`Astro`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Zr),__vite__mapDeps([0,1])))},{id:`awk`,name:`AWK`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Xr),__vite__mapDeps([0,1])))},{id:`ballerina`,name:`Ballerina`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Yr),__vite__mapDeps([0,1])))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Jr),__vite__mapDeps([0,1])))},{id:`beancount`,name:`Beancount`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.qr),__vite__mapDeps([0,1])))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Kr),__vite__mapDeps([0,1])))},{id:`bibtex`,name:`BibTeX`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Gr),__vite__mapDeps([0,1])))},{id:`bicep`,name:`Bicep`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Wr),__vite__mapDeps([0,1])))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ur),__vite__mapDeps([0,1])))},{id:`blade`,name:`Blade`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Br),__vite__mapDeps([0,1])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Rr),__vite__mapDeps([0,1])))},{id:`c`,name:`C`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Lr),__vite__mapDeps([0,1])))},{id:`c3`,name:`C3`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ir),__vite__mapDeps([0,1])))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Fr),__vite__mapDeps([0,1])))},{id:`cairo`,name:`Cairo`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Nr),__vite__mapDeps([0,1])))},{id:`clarity`,name:`Clarity`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Mr),__vite__mapDeps([0,1])))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.jr),__vite__mapDeps([0,1])))},{id:`cmake`,name:`CMake`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ar),__vite__mapDeps([0,1])))},{id:`cobol`,name:`COBOL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.kr),__vite__mapDeps([0,1])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Or),__vite__mapDeps([0,1])))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Dr),__vite__mapDeps([0,1])))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Er),__vite__mapDeps([0,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Tr),__vite__mapDeps([0,1])))},{id:`coq`,name:`Coq`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.wr),__vite__mapDeps([0,1])))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.xr),__vite__mapDeps([0,1])))},{id:`crystal`,name:`Crystal`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.yr),__vite__mapDeps([0,1])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.vr),__vite__mapDeps([0,1])))},{id:`css`,name:`CSS`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.hi),__vite__mapDeps([0,1])))},{id:`csv`,name:`CSV`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e._r),__vite__mapDeps([0,1])))},{id:`cue`,name:`CUE`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.gr),__vite__mapDeps([0,1])))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.hr),__vite__mapDeps([0,1])))},{id:`d`,name:`D`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.mr),__vite__mapDeps([0,1])))},{id:`dart`,name:`Dart`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.pr),__vite__mapDeps([0,1])))},{id:`dax`,name:`DAX`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.fr),__vite__mapDeps([0,1])))},{id:`desktop`,name:`Desktop`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.dr),__vite__mapDeps([0,1])))},{id:`diff`,name:`Diff`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ur),__vite__mapDeps([0,1])))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.lr),__vite__mapDeps([0,1])))},{id:`dotenv`,name:`dotEnv`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.cr),__vite__mapDeps([0,1])))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.sr),__vite__mapDeps([0,1])))},{id:`edge`,name:`Edge`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.or),__vite__mapDeps([0,1])))},{id:`elixir`,name:`Elixir`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ar),__vite__mapDeps([0,1])))},{id:`elm`,name:`Elm`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ir),__vite__mapDeps([0,1])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.rr),__vite__mapDeps([0,1])))},{id:`erb`,name:`ERB`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Xn),__vite__mapDeps([0,1])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Jn),__vite__mapDeps([0,1])))},{id:`fennel`,name:`Fennel`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.qn),__vite__mapDeps([0,1])))},{id:`fish`,name:`Fish`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Kn),__vite__mapDeps([0,1])))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Gn),__vite__mapDeps([0,1])))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Un),__vite__mapDeps([0,1])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Wn),__vite__mapDeps([0,1])))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Hn),__vite__mapDeps([0,1])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.zn),__vite__mapDeps([0,1])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Bn),__vite__mapDeps([0,1])))},{id:`gdshader`,name:`GDShader`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Vn),__vite__mapDeps([0,1])))},{id:`genie`,name:`Genie`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Rn),__vite__mapDeps([0,1])))},{id:`gherkin`,name:`Gherkin`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ln),__vite__mapDeps([0,1])))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.In),__vite__mapDeps([0,1])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Fn),__vite__mapDeps([0,1])))},{id:`gleam`,name:`Gleam`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Pn),__vite__mapDeps([0,1])))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Nn),__vite__mapDeps([0,1])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Mn),__vite__mapDeps([0,1])))},{id:`glsl`,name:`GLSL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Sr),__vite__mapDeps([0,1])))},{id:`gn`,name:`GN`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.jn),__vite__mapDeps([0,1])))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.An),__vite__mapDeps([0,1])))},{id:`go`,name:`Go`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.kn),__vite__mapDeps([0,1])))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.er),__vite__mapDeps([0,1])))},{id:`groovy`,name:`Groovy`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.On),__vite__mapDeps([0,1])))},{id:`hack`,name:`Hack`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Dn),__vite__mapDeps([0,1])))},{id:`haml`,name:`Ruby Haml`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.nr),__vite__mapDeps([0,1])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.En),__vite__mapDeps([0,1])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Tn),__vite__mapDeps([0,1])))},{id:`haxe`,name:`Haxe`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.wn),__vite__mapDeps([0,1])))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Cn),__vite__mapDeps([0,1])))},{id:`hjson`,name:`Hjson`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Sn),__vite__mapDeps([0,1])))},{id:`hlsl`,name:`HLSL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.xn),__vite__mapDeps([0,1])))},{id:`html`,name:`HTML`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.mi),__vite__mapDeps([0,1])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Hr),__vite__mapDeps([0,1])))},{id:`http`,name:`HTTP`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.bn),__vite__mapDeps([0,1])))},{id:`hurl`,name:`Hurl`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.yn),__vite__mapDeps([0,1])))},{id:`hxml`,name:`HXML`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.vn),__vite__mapDeps([0,1])))},{id:`hy`,name:`Hy`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e._n),__vite__mapDeps([0,1])))},{id:`imba`,name:`Imba`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.gn),__vite__mapDeps([0,1])))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.hn),__vite__mapDeps([0,1])))},{id:`java`,name:`Java`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ci),__vite__mapDeps([0,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.gi),__vite__mapDeps([0,1])))},{id:`jinja`,name:`Jinja`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.mn),__vite__mapDeps([0,1])))},{id:`jison`,name:`Jison`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.pn),__vite__mapDeps([0,1])))},{id:`json`,name:`JSON`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.oi),__vite__mapDeps([0,1])))},{id:`json5`,name:`JSON5`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.fn),__vite__mapDeps([0,1])))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.dn),__vite__mapDeps([0,1])))},{id:`jsonl`,name:`JSON Lines`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.un),__vite__mapDeps([0,1])))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ln),__vite__mapDeps([0,1])))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.cn),__vite__mapDeps([0,1])))},{id:`jsx`,name:`JSX`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.tr),__vite__mapDeps([0,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.on),__vite__mapDeps([0,1])))},{id:`just`,name:`Just`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.in),__vite__mapDeps([0,1])))},{id:`kdl`,name:`KDL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.rn),__vite__mapDeps([0,1])))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.nn),__vite__mapDeps([0,1])))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.tn),__vite__mapDeps([0,1])))},{id:`latex`,name:`LaTeX`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.$t),__vite__mapDeps([0,1])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Qt),__vite__mapDeps([0,1])))},{id:`less`,name:`Less`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Zt),__vite__mapDeps([0,1])))},{id:`liquid`,name:`Liquid`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Xt),__vite__mapDeps([0,1])))},{id:`llvm`,name:`LLVM IR`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Yt),__vite__mapDeps([0,1])))},{id:`log`,name:`Log file`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Jt),__vite__mapDeps([0,1])))},{id:`logo`,name:`Logo`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.qt),__vite__mapDeps([0,1])))},{id:`lua`,name:`Lua`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.$n),__vite__mapDeps([0,1])))},{id:`luau`,name:`Luau`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Kt),__vite__mapDeps([0,1])))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Gt),__vite__mapDeps([0,1])))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Yn),__vite__mapDeps([0,1])))},{id:`marko`,name:`Marko`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Wt),__vite__mapDeps([0,1])))},{id:`matlab`,name:`MATLAB`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ut),__vite__mapDeps([0,1])))},{id:`mdc`,name:`MDC`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ht),__vite__mapDeps([0,1])))},{id:`mdx`,name:`MDX`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Vt),__vite__mapDeps([0,1])))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Bt),__vite__mapDeps([0,1])))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.zt),__vite__mapDeps([0,1])))},{id:`mojo`,name:`Mojo`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Rt),__vite__mapDeps([0,1])))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Lt),__vite__mapDeps([0,1])))},{id:`move`,name:`Move`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.It),__vite__mapDeps([0,1])))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ft),__vite__mapDeps([0,1])))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Nt),__vite__mapDeps([0,1])))},{id:`nextflow-groovy`,name:`nextflow-groovy`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Pt),__vite__mapDeps([0,1])))},{id:`nginx`,name:`Nginx`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Mt),__vite__mapDeps([0,1])))},{id:`nim`,name:`Nim`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.jt),__vite__mapDeps([0,1])))},{id:`nix`,name:`Nix`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.At),__vite__mapDeps([0,1])))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.kt),__vite__mapDeps([0,1])))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ot),__vite__mapDeps([0,1])))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Dt),__vite__mapDeps([0,1])))},{id:`ocaml`,name:`OCaml`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Et),__vite__mapDeps([0,1])))},{id:`odin`,name:`Odin`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Tt),__vite__mapDeps([0,1])))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.wt),__vite__mapDeps([0,1])))},{id:`pascal`,name:`Pascal`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Ct),__vite__mapDeps([0,1])))},{id:`perl`,name:`Perl`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.an),__vite__mapDeps([0,1])))},{id:`php`,name:`PHP`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.St),__vite__mapDeps([0,1])))},{id:`pkl`,name:`Pkl`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.xt),__vite__mapDeps([0,1])))},{id:`plsql`,name:`PL/SQL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.bt),__vite__mapDeps([0,1])))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.yt),__vite__mapDeps([0,1])))},{id:`polar`,name:`Polar`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.vt),__vite__mapDeps([0,1])))},{id:`postcss`,name:`PostCSS`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.$r),__vite__mapDeps([0,1])))},{id:`powerquery`,name:`PowerQuery`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e._t),__vite__mapDeps([0,1])))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.gt),__vite__mapDeps([0,1])))},{id:`prisma`,name:`Prisma`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ht),__vite__mapDeps([0,1])))},{id:`prolog`,name:`Prolog`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.mt),__vite__mapDeps([0,1])))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.pt),__vite__mapDeps([0,1])))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ft),__vite__mapDeps([0,1])))},{id:`puppet`,name:`Puppet`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.dt),__vite__mapDeps([0,1])))},{id:`purescript`,name:`PureScript`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ut),__vite__mapDeps([0,1])))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Pr),__vite__mapDeps([0,1])))},{id:`qml`,name:`QML`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.lt),__vite__mapDeps([0,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ct),__vite__mapDeps([0,1])))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.st),__vite__mapDeps([0,1])))},{id:`r`,name:`R`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.sn),__vite__mapDeps([0,1])))},{id:`racket`,name:`Racket`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ot),__vite__mapDeps([0,1])))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.at),__vite__mapDeps([0,1])))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.it),__vite__mapDeps([0,1])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.rt),__vite__mapDeps([0,1])))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Cr),__vite__mapDeps([0,1])))},{id:`rel`,name:`Rel`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.nt),__vite__mapDeps([0,1])))},{id:`riscv`,name:`RISC-V`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.tt),__vite__mapDeps([0,1])))},{id:`ron`,name:`RON`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.et),__vite__mapDeps([0,1])))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.$),__vite__mapDeps([0,1])))},{id:`rst`,name:`reStructuredText`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Q),__vite__mapDeps([0,1])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Zn),__vite__mapDeps([0,1])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Z),__vite__mapDeps([0,1])))},{id:`sas`,name:`SAS`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.X),__vite__mapDeps([0,1])))},{id:`sass`,name:`Sass`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Y),__vite__mapDeps([0,1])))},{id:`scala`,name:`Scala`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.J),__vite__mapDeps([0,1])))},{id:`scheme`,name:`Scheme`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.q),__vite__mapDeps([0,1])))},{id:`scss`,name:`SCSS`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.fi),__vite__mapDeps([0,1])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.zr),__vite__mapDeps([0,1])))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.K),__vite__mapDeps([0,1])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.br),__vite__mapDeps([0,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.G),__vite__mapDeps([0,1])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.W),__vite__mapDeps([0,1])))},{id:`solidity`,name:`Solidity`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.U),__vite__mapDeps([0,1])))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.H),__vite__mapDeps([0,1])))},{id:`sparql`,name:`SPARQL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.B),__vite__mapDeps([0,1])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.z),__vite__mapDeps([0,1])))},{id:`sql`,name:`SQL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Vr),__vite__mapDeps([0,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.R),__vite__mapDeps([0,1])))},{id:`stata`,name:`Stata`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.L),__vite__mapDeps([0,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.I),__vite__mapDeps([0,1])))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.F),__vite__mapDeps([0,1])))},{id:`svelte`,name:`Svelte`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.P),__vite__mapDeps([0,1])))},{id:`swift`,name:`Swift`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.N),__vite__mapDeps([0,1])))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.M),__vite__mapDeps([0,1])))},{id:`systemd`,name:`Systemd Units`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.j),__vite__mapDeps([0,1])))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.A),__vite__mapDeps([0,1])))},{id:`tasl`,name:`Tasl`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.k),__vite__mapDeps([0,1])))},{id:`tcl`,name:`Tcl`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.O),__vite__mapDeps([0,1])))},{id:`templ`,name:`Templ`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.D),__vite__mapDeps([0,1])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.E),__vite__mapDeps([0,1])))},{id:`tex`,name:`TeX`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.en),__vite__mapDeps([0,1])))},{id:`toml`,name:`TOML`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.T),__vite__mapDeps([0,1])))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.w),__vite__mapDeps([0,1])))},{id:`tsv`,name:`TSV`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.C),__vite__mapDeps([0,1])))},{id:`tsx`,name:`TSX`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Qr),__vite__mapDeps([0,1])))},{id:`turtle`,name:`Turtle`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.V),__vite__mapDeps([0,1])))},{id:`twig`,name:`Twig`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.S),__vite__mapDeps([0,1])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.ei),__vite__mapDeps([0,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.x),__vite__mapDeps([0,1])))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.b),__vite__mapDeps([0,1])))},{id:`v`,name:`V`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.y),__vite__mapDeps([0,1])))},{id:`vala`,name:`Vala`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.v),__vite__mapDeps([0,1])))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e._),__vite__mapDeps([0,1])))},{id:`verilog`,name:`Verilog`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.g),__vite__mapDeps([0,1])))},{id:`vhdl`,name:`VHDL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.h),__vite__mapDeps([0,1])))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.m),__vite__mapDeps([0,1])))},{id:`vue`,name:`Vue`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.d),__vite__mapDeps([0,1])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.p),__vite__mapDeps([0,1])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.f),__vite__mapDeps([0,1])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.u),__vite__mapDeps([0,1])))},{id:`wasm`,name:`WebAssembly`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.l),__vite__mapDeps([0,1])))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.c),__vite__mapDeps([0,1])))},{id:`wgsl`,name:`WGSL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.s),__vite__mapDeps([0,1])))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.o),__vite__mapDeps([0,1])))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.a),__vite__mapDeps([0,1])))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.i),__vite__mapDeps([0,1])))},{id:`xml`,name:`XML`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.si),__vite__mapDeps([0,1])))},{id:`xsl`,name:`XSL`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.r),__vite__mapDeps([0,1])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.Qn),__vite__mapDeps([0,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.n),__vite__mapDeps([0,1])))},{id:`zig`,name:`Zig`,import:(()=>i(()=>import(`./vendor-shikijs-langs-eloENL-7.js`).then(e=>e.t),__vite__mapDeps([0,1])))}],jr=Object.fromEntries(Ar.map(e=>[e.id,e.import])),Mr=Object.fromEntries(Ar.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Nr={...jr,...Mr},Pr=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.dt),__vite__mapDeps([2,1])))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ut),__vite__mapDeps([2,1])))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.lt),__vite__mapDeps([2,1])))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ct),__vite__mapDeps([2,1])))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.st),__vite__mapDeps([2,1])))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ot),__vite__mapDeps([2,1])))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.at),__vite__mapDeps([2,1])))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.it),__vite__mapDeps([2,1])))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.rt),__vite__mapDeps([2,1])))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.nt),__vite__mapDeps([2,1])))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.et),__vite__mapDeps([2,1])))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.tt),__vite__mapDeps([2,1])))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.$),__vite__mapDeps([2,1])))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Q),__vite__mapDeps([2,1])))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.J),__vite__mapDeps([2,1])))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Z),__vite__mapDeps([2,1])))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.X),__vite__mapDeps([2,1])))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Y),__vite__mapDeps([2,1])))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.G),__vite__mapDeps([2,1])))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.q),__vite__mapDeps([2,1])))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.K),__vite__mapDeps([2,1])))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.W),__vite__mapDeps([2,1])))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.U),__vite__mapDeps([2,1])))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.H),__vite__mapDeps([2,1])))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.V),__vite__mapDeps([2,1])))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.B),__vite__mapDeps([2,1])))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.z),__vite__mapDeps([2,1])))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.L),__vite__mapDeps([2,1])))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.R),__vite__mapDeps([2,1])))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.I),__vite__mapDeps([2,1])))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.F),__vite__mapDeps([2,1])))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.P),__vite__mapDeps([2,1])))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.N),__vite__mapDeps([2,1])))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.M),__vite__mapDeps([2,1])))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.j),__vite__mapDeps([2,1])))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.E),__vite__mapDeps([2,1])))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.A),__vite__mapDeps([2,1])))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.k),__vite__mapDeps([2,1])))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.O),__vite__mapDeps([2,1])))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.D),__vite__mapDeps([2,1])))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.T),__vite__mapDeps([2,1])))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.w),__vite__mapDeps([2,1])))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.C),__vite__mapDeps([2,1])))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.x),__vite__mapDeps([2,1])))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.S),__vite__mapDeps([2,1])))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.b),__vite__mapDeps([2,1])))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.y),__vite__mapDeps([2,1])))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.v),__vite__mapDeps([2,1])))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e._),__vite__mapDeps([2,1])))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.g),__vite__mapDeps([2,1])))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.h),__vite__mapDeps([2,1])))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.f),__vite__mapDeps([2,1])))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.m),__vite__mapDeps([2,1])))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.p),__vite__mapDeps([2,1])))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.d),__vite__mapDeps([2,1])))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.u),__vite__mapDeps([2,1])))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.l),__vite__mapDeps([2,1])))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.c),__vite__mapDeps([2,1])))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.s),__vite__mapDeps([2,1])))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.o),__vite__mapDeps([2,1])))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.a),__vite__mapDeps([2,1])))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.i),__vite__mapDeps([2,1])))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.r),__vite__mapDeps([2,1])))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.n),__vite__mapDeps([2,1])))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.t),__vite__mapDeps([2,1])))}].map(e=>[e.id,e.import])),Fr=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ir(){return 2147483648}function Lr(){return typeof performance<`u`?performance.now():Date.now()}var Rr=(e,t)=>e+(t-e%t)%t;async function zr(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=Ir();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,Rr(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Lr,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var Br=Object.defineProperty,Vr=(e,t,n)=>t in e?Br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t,n)=>Vr(e,typeof t==`symbol`?t:t+``,n),L=null;function Hr(e){throw new Fr(e.UTF8ToString(e.getLastOnigError()))}var Ur=class e{constructor(t){I(this,`utf16Length`),I(this,`utf8Length`),I(this,`utf16Value`),I(this,`utf8Value`),I(this,`utf16OffsetToUtf8`),I(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Wr=class e{constructor(t){if(I(this,`id`,++e.LAST_ID),I(this,`_onigBinding`),I(this,`content`),I(this,`utf16Length`),I(this,`utf8Length`),I(this,`utf16OffsetToUtf8`),I(this,`utf8OffsetToUtf16`),I(this,`ptr`),!L)throw new Fr(`Must invoke loadWasm first.`);this._onigBinding=L,this.content=t;let n=new Ur(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=L.omalloc(1e4),e._sharedPtrInUse=!0,L.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(L)}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===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};I(Wr,`LAST_ID`,0),I(Wr,`_sharedPtr`,0),I(Wr,`_sharedPtrInUse`,!1);var Gr=Wr,Kr=class{constructor(e){if(I(this,`_onigBinding`),I(this,`_ptr`),!L)throw new Fr(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Ur(e[r]);t[r]=i.createString(L),n[r]=i.utf8Length}let r=L.omalloc(4*e.length);L.HEAPU32.set(t,r/4);let i=L.omalloc(4*e.length);L.HEAPU32.set(n,i/4);let a=L.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)L.ofree(t[n]);L.ofree(i),L.ofree(r),a===0&&Hr(L),this._onigBinding=L,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Gr(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function qr(e){return typeof e.instantiator==`function`}function Jr(e){return typeof e.default==`function`}function Yr(e){return e.data!==void 0}function Xr(e){return typeof Response<`u`&&e instanceof Response}function Zr(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Qr;function $r(e){if(Qr)return Qr;async function t(){L=await zr(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),qr(n)?n=await n.instantiator(t):Jr(n)?n=await n.default(t):(Yr(n)&&(n=n.data),Xr(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await ti(n)(t):await ni(n)(t):Zr(n)||n instanceof WebAssembly.Module?n=await ei(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await ei(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Qr=t(),Qr}function ei(e){return t=>WebAssembly.instantiate(e,t)}function ti(e){return t=>WebAssembly.instantiateStreaming(e,t)}function ni(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function ri(e){return e&&await $r(e),{createScanner(e){return new Kr(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Gr(e)}}}var ii=Er({langs:Nr,themes:Pr,engine:()=>ri(i(()=>import(`./vendor-shiki-DzFPeSWm.js`).then(e=>e.t),__vite__mapDeps([3,1])))}),{codeToHtml:ai,codeToHast:oi,codeToTokens:si,codeToTokensBase:ci,codeToTokensWithThemes:li,getSingletonHighlighter:ui,getLastGrammarState:di}=Or(ii,{guessEmbeddedLanguages:pn}),fi=4294967295,pi=class{constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}regexps;findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:fi,end:fi,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function mi(e,t){return o(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function hi(e={}){let t=Object.assign({target:`auto`,cache:new Map},e);return t.regexConstructor||=e=>mi(e,{target:t.target}),{createScanner(e){return new pi(e,t)},createString(e){return{content:e}}}}async function gi(e){if(be())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=me.get(e);if(t!=null)return t;try{let t=he.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Nr,e)&&(t=Nr[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return pe.has(e)||pe.set(e,n),n});return me.set(e,n),await n}finally{me.delete(e)}}function _i(e){return pe.get(e)??gi(e)}function vi(e=j){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var yi=new Set;function bi(e){for(let t of vi(e))if(!yi.has(t))return!1;return!0}function xi(e){let t=[],n=new Set;for(let r of Si(e.themes)){let e=Ti(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return xi({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return xi({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Si(e){return Ci(e)?[e]:e}function Ci(e){return Ti(e)||wi(e)}function wi(e){return typeof e.name==`string`&&typeof e.load==`function`}function Ti(e){return typeof e.getThemes==`function`}function Ei(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Di=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},Oi=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},ki=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Ai(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Di(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new Oi(i));let c=r,l=s().then(e=>{let a=Ei(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new ki(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var ji=Ai();function Mi(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=ji.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,ji.getResolvedTheme(n)??ji.seedResolvedTheme(n,e);yi.has(n)||(yi.add(n),t.loadThemeSync(e))}}function Ni(){ji.clearResolvedThemes(),yi.clear()}function Pi({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Fi(t)}}function Fi(e){return async()=>pr(Ei(await e()))}var Ii=`pierre`,Li=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Ri=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],zi=[...Ri,...Li],Bi=new Set(Ri);function Vi(e){return Bi.has(e)?`light`:`dark`}var Hi={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},Ui={"pierre-dark":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.o),__vite__mapDeps([4,1])),"pierre-dark-soft":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.l),__vite__mapDeps([4,1])),"pierre-dark-vibrant":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.s),__vite__mapDeps([4,1])),"pierre-dark-protanopia-deuteranopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.u),__vite__mapDeps([4,1])),"pierre-dark-tritanopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.c),__vite__mapDeps([4,1])),"pierre-light":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.t),__vite__mapDeps([4,1])),"pierre-light-soft":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.i),__vite__mapDeps([4,1])),"pierre-light-vibrant":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.n),__vite__mapDeps([4,1])),"pierre-light-protanopia-deuteranopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.a),__vite__mapDeps([4,1])),"pierre-light-tritanopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.r),__vite__mapDeps([4,1]))};function Wi(e){return Pi({name:e,collection:Ii,colorScheme:Vi(e),displayName:Hi[e],load:Ui[e]})}var Gi=xi({themes:zi.map(e=>Wi(e))}),Ki=`shiki`,qi=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],Ji=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),Yi=new Set(qi);function Xi(e){return Yi.has(e)?`light`:`dark`}var Zi={andromeeda:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.dt),__vite__mapDeps([2,1])),"aurora-x":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ut),__vite__mapDeps([2,1])),"ayu-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.lt),__vite__mapDeps([2,1])),"ayu-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ct),__vite__mapDeps([2,1])),"ayu-mirage":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.st),__vite__mapDeps([2,1])),"catppuccin-frappe":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ot),__vite__mapDeps([2,1])),"catppuccin-latte":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.at),__vite__mapDeps([2,1])),"catppuccin-macchiato":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.it),__vite__mapDeps([2,1])),"catppuccin-mocha":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.rt),__vite__mapDeps([2,1])),"dark-plus":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.nt),__vite__mapDeps([2,1])),dracula:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.et),__vite__mapDeps([2,1])),"dracula-soft":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.tt),__vite__mapDeps([2,1])),"everforest-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.$),__vite__mapDeps([2,1])),"everforest-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Q),__vite__mapDeps([2,1])),"github-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.J),__vite__mapDeps([2,1])),"github-dark-default":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Z),__vite__mapDeps([2,1])),"github-dark-dimmed":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.X),__vite__mapDeps([2,1])),"github-dark-high-contrast":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Y),__vite__mapDeps([2,1])),"github-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.G),__vite__mapDeps([2,1])),"github-light-default":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.q),__vite__mapDeps([2,1])),"github-light-high-contrast":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.K),__vite__mapDeps([2,1])),"gruvbox-dark-hard":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.W),__vite__mapDeps([2,1])),"gruvbox-dark-medium":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.U),__vite__mapDeps([2,1])),"gruvbox-dark-soft":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.H),__vite__mapDeps([2,1])),"gruvbox-light-hard":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.V),__vite__mapDeps([2,1])),"gruvbox-light-medium":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.B),__vite__mapDeps([2,1])),"gruvbox-light-soft":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.z),__vite__mapDeps([2,1])),horizon:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.L),__vite__mapDeps([2,1])),"horizon-bright":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.R),__vite__mapDeps([2,1])),houston:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.I),__vite__mapDeps([2,1])),"kanagawa-dragon":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.F),__vite__mapDeps([2,1])),"kanagawa-lotus":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.P),__vite__mapDeps([2,1])),"kanagawa-wave":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.N),__vite__mapDeps([2,1])),laserwave:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.M),__vite__mapDeps([2,1])),"light-plus":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.j),__vite__mapDeps([2,1])),"material-theme":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.E),__vite__mapDeps([2,1])),"material-theme-darker":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.A),__vite__mapDeps([2,1])),"material-theme-lighter":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.k),__vite__mapDeps([2,1])),"material-theme-ocean":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.O),__vite__mapDeps([2,1])),"material-theme-palenight":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.D),__vite__mapDeps([2,1])),"min-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.T),__vite__mapDeps([2,1])),"min-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.w),__vite__mapDeps([2,1])),monokai:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.C),__vite__mapDeps([2,1])),"night-owl":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.x),__vite__mapDeps([2,1])),"night-owl-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.S),__vite__mapDeps([2,1])),nord:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.b),__vite__mapDeps([2,1])),"one-dark-pro":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.y),__vite__mapDeps([2,1])),"one-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.v),__vite__mapDeps([2,1])),plastic:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e._),__vite__mapDeps([2,1])),poimandres:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.g),__vite__mapDeps([2,1])),red:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.h),__vite__mapDeps([2,1])),"rose-pine":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.f),__vite__mapDeps([2,1])),"rose-pine-dawn":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.m),__vite__mapDeps([2,1])),"rose-pine-moon":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.p),__vite__mapDeps([2,1])),"slack-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.d),__vite__mapDeps([2,1])),"slack-ochin":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.u),__vite__mapDeps([2,1])),"snazzy-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.l),__vite__mapDeps([2,1])),"solarized-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.c),__vite__mapDeps([2,1])),"solarized-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.s),__vite__mapDeps([2,1])),"synthwave-84":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.o),__vite__mapDeps([2,1])),"tokyo-night":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.a),__vite__mapDeps([2,1])),vesper:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.i),__vite__mapDeps([2,1])),"vitesse-black":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.r),__vite__mapDeps([2,1])),"vitesse-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.n),__vite__mapDeps([2,1])),"vitesse-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.t),__vite__mapDeps([2,1]))};function Qi(e){return Pi({name:e,collection:Ki,colorScheme:Xi(e),load:Zi[e]})}var $i=xi({themes:Object.freeze([...qi.map(e=>Qi(e)),...Ji.map(e=>Qi(e))])});function ea(e){if(be())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(ji.hasRegisteredTheme(e))return;let t=$i.getTheme(e);if(t!=null){ji.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function ta(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function na(e){ea(e);let t=await ji.resolveTheme(e);return ta(e,t),t}function ra(e){return ji.getResolvedTheme(e)??na(e)}var R;async function ia({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){R??=ii({themes:[],langs:[`text`],engine:n===`shiki-wasm`?ri(i(()=>import(`./vendor-shiki-DzFPeSWm.js`).then(e=>e.t),__vite__mapDeps([3,1]))):hi()});let r=sa(R)?await R:R;R=r;let a=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=_i(e);`then`in t?a.push(t):ve(t,r)}let o=[];for(let t of e){let e=ra(t);`then`in e?o.push(e):Mi(e,R)}return(a.length>0||o.length>0)&&await Promise.all([Promise.all(a).then(e=>{ve(e,r)}),Promise.all(o).then(e=>{Mi(e,r)})]),r}function aa(e=R){return e!=null&&!(`then`in e)}function oa(e){if(!(R==null||`then`in R)&&!(e!=null&&(!bi(e.theme)||!_e(e.lang))))return R}function sa(e=R){return e!=null&&`then`in e}function ca(e=R){return e==null}async function la(e){await ia(e)}async function ua(){R!=null&&((await R).dispose(),ye(),Ni(),R=void 0)}for(let e of Gi.getThemes())ji.registerThemeIfAbsent(e.name,e.load);var da=new Set,fa=null;function z(e){da.add(e),fa??=requestAnimationFrame(ha)}function pa(e){da.delete(e)&&da.size===0&&fa!=null&&(cancelAnimationFrame(fa),fa=null)}function ma(){da.clear(),fa!=null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(fa),fa=null}function ha(e){let t=new Set(da);da.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}fa=da.size>0?requestAnimationFrame(ha):null}function ga(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function _a(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function va(e,t){let n=e?.theme??j,r=t?.theme??j,i=ya(e),a=ya(t);return _a(n,r)&&ga(e,t,[`theme`,`parseDiffOptions`])&&ga(i,a)}function ya(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function ba(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function xa({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function Sa(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function B(e){return{type:`text`,value:e}}function V({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Ca({name:e,width:t=16,height:n=16,properties:r}){return V({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[V({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function wa(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function Ta(e){return V({tagName:`div`,properties:{"data-gutter":``},children:e})}function Ea(e,t,n,r={}){return V({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[V({tagName:`span`,properties:{"data-line-number-content":``},children:[B(`${t}`)]})]})}function H(e,t,n){return V({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Da(){return V({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Ca({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Oa(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function ka(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var Aa=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),pa(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||ba(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&ka(e.composedPath())||(Xa(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(Xa(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Xa(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Xa(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Xa(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Xa(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Fa(i)&&this.hoveredLine?.lineElement===i.lineElement;Pa(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Pa(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Fa(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(La(i)&&p!=null){p(i);break}if(Ia(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Fa(i))break;Pa(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Xa(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),Xa(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Xa(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();ka(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Oa(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=a(Da());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Na(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Ba(t));if(Na(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Na(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Na(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&ka(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Ba(e);if(t&&ka(n))return;let r=Va(e);return r==null?this.pathFromAnnotationSlot(e):Ba(r)}pathFromAnnotationSlot(e){let t=Ha(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Ba(t);let n=Wa(Ua(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Ba(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Ga(t)?t:Ga(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}ba(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,z(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{pa(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!qa(this.renderedSelectedLinesState,n),i=!qa(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Ra(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=Ya(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=Ya(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:za(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:za(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Ja(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Ja(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function ja({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Ma({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Ma({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Na(e){return e!=null&&`kind`in e&&e.kind===`line`}function Pa(e){return e!=null&&`kind`in e&&e.kind===`token`}function Fa(e){return Na(e)||Pa(e)}function Ia(e){return`type`in e&&e.type===`line-info`}function La(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Ra(e){return e===`current`||e===`incoming`||e===`both`}function za(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ba(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Va(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Ha(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Ua(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Wa(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Ga(e){return e!=null&&typeof e.elementFromPoint==`function`}function Ka(e,t){return e===t||ba(e??void 0,t??void 0)}function qa(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Ka(e?.range??null,t.range)}function Ja(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Ya(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function Xa(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}[...n]}var Za=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),eo(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?ro(t):io(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:Qa(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:$a(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&to(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Qa(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function $a(e){return Math.max(Math.ceil(e),0)}function eo(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?to(e,{codeWidthChanged:!0,numberWidthChanged:!0}):no(e))}function to(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function no(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function ro(e){e.codeElement.isConnected&&no(e)}function io(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function ao(e){return ji.hasResolvedThemes(e)}function oo(e,t){return _a(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function so(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function co(e){return V({tagName:`div`,children:[V({tagName:`div`,children:e.annotations?.map(e=>V({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function lo(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function uo({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return V({tagName:`div`,children:[t===`custom`?V({tagName:`slot`,properties:{name:A}}):fo({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[po(r)]],properties:i})}function fo({name:e,prevName:t,iconType:n}){let r=[V({tagName:`slot`,properties:{name:D}}),Ca({name:lo(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(V({tagName:`div`,children:[V({tagName:`bdi`,children:[B(t)]})],properties:{"data-prev-name":``}})),r.push(Ca({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(V({tagName:`div`,children:[V({tagName:`bdi`,children:[B(e)]})],properties:{"data-title":``}})),r.push(V({tagName:`slot`,properties:{name:O}})),V({tagName:`div`,children:r,properties:{"data-header-content":``}})}function po(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(V({tagName:`span`,children:[B(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(V({tagName:`span`,children:[B(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(V({tagName:`slot`,properties:{name:k}})),V({tagName:`div`,children:t,properties:{"data-metadata":``}})}function mo(e){return V({tagName:`pre`,properties:ho(e)})}function ho({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var go=new Map,_o=0,vo={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`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 U(e){if(go.has(e))return go.get(e)??`text`;if(vo[e]!=null)return vo[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(go.has(t[1]))return go.get(t[1])??`text`;if(vo[t[1]]!=null)return vo[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return go.has(n)?go.get(n)??`text`:vo[n]??`text`}function yo(e,t){if(e<=_o)return!1;go.clear();for(let e in t){let n=t[e];n!=null&&go.set(e,n)}return _o=e,!0}function bo(){return _o}function xo(e,t){let n=go.get(e);return n!==t&&(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),go.set(e,t),_o++,!0)}function So(){return Object.fromEntries(go)}function Co(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:vi(t),preferredHighlighter:n}}function wo(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function To(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Eo(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(B(`
|
|
6
|
+
`)),e}var Do=Symbol(`no-token`),Oo=Symbol(`multiple-tokens`);function ko(e){let t=Ao(e);if(t!=null)return t;let n=Do,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Mo(e,a);for(let t of e.children)jo(t)}else jo(e);r.push(e),i=[],a=void 0;return}for(let e of i)jo(e);r.push(V({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Do){if(e===Oo){n=Oo;return}if(n===Do){n=e;return}n!==e&&(n=Oo)}};for(let t of e.children){let e=t.type===`element`?ko(t):Do;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Ao(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function jo(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)jo(t)}}function Mo(e,t){e.properties[`data-char`]=t}function No(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+Po(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Po(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,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)}function Fo(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=wa(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&ko(a),i.push(Eo(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Lo,Io),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Io}}var Io=No({classPrefix:`hl-`}),Lo={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function W(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Ro=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,zo=/^0(?:\.0+)?%?$/;function Bo(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Vo(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Ho(e){if(e==null)return null;let t=Vo(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Uo(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Ro.test(t))return!0;let n=Bo(t);return n!=null&&zo.test(n)}function Wo(e,t,n){if(t==null||n==null)return!1;let r=Ho(e),i=Ho(t),a=Ho(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Go=new WeakMap;function Ko(e){let t=Go.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;qo(r,`editor.background`,i),qo(r,`editor.foreground`,a),qo(r,`sideBar.background`,o),qo(r,`sideBar.foreground`,s),qo(r,`input.background`,n[`input.background`]??o),qo(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),qo(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),qo(r,`gitDecoration.addedResourceForeground`,Jo(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),qo(r,`gitDecoration.modifiedResourceForeground`,Jo(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),qo(r,`gitDecoration.deletedResourceForeground`,Jo(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Uo(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Uo(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Yo(l,o)||Wo(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Go.set(e,u),u}function qo(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Jo(...e){for(let t of e)if(t!=null&&t!==``)return t}function Yo(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Xo({theme:e=j,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Ko(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${W(`global`)}fg:${a.fg};`,r+=`${W(`global`)}bg:${a.bg};`,r+=Zo(i,n)}else{let n=t.getTheme(e.dark),i=Ko(n);r+=`${W(`global`)}dark:${i.fg};`,r+=`${W(`global`)}dark-bg:${i.bg};`,r+=Zo(n,`dark`),n=t.getTheme(e.light),i=Ko(n),r+=`${W(`global`)}light:${i.fg};`,r+=`${W(`global`)}light-bg:${i.bg};`,r+=Zo(n,`light`)}return r}function Zo(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${W(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${W(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${W(`global`)}${t}modified-color:${a};`),n}function Qo(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var $o=10,es=13,ts=4,ns=40;function rs(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
|
|
7
|
+
`),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
|
|
8
|
+
`,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
|
|
9
|
+
`,o)),t.push(o),++a===ts){if(o-i<=ns){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===$o||r===es)&&(r===es&&n+1<e.length&&e.charCodeAt(n+1)===$o&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function is(e){let t=rs(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}function as(e,t){for(let n of t)e.push(n)}var os={forcePlainText:!1};function ss(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=os){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Fo(i),f=a?`text`:e.lang??U(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Xo({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Qo(t.codeToHast(cs(l?ls(c??is(e.contents),o,s):e.contents),h)),_=l?Array(o):g;return l&&as(_,g),{code:_,themeStyles:m,baseThemeType:p}}function cs(e){return e.replace(/\r(?!\n)/g,`
|
|
10
|
+
`)}function ls(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function G(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var us=`-1,-1`;function ds(e){return e?.some(e=>e.lineNumber===0)??!1}function fs(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function ps(e){return e.startingLine===0&&e.totalLines>0}function ms(e,t){return e.endsWith(`\r
|
|
11
|
+
`)?t+`\r
|
|
12
|
+
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
13
|
+
`)?t+`
|
|
14
|
+
`:t}function hs(e,t){return V({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function gs(e){return(e.lang??U(e.name))===`text`}function _s(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var vs=-1,ys=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++vs}`;highlighter;file;renderCache;pendingHighlightResult;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;get fileCache(){return this.renderCache?.file}constructor(e={theme:j},t=wo,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=bi(e.theme??j)?oa():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.file=e,r==null||n&&r.file===e)return;let{options:i}=this.getRenderOptions(e),a=r.file===e,o=t!=null&&G(r.file,t),{result:s}=r;if(!r.highlighted||s==null||!oo(r.options,i)||!a&&!o){this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap;return}if(a)return;this.renderCache={...r,file:e,result:{...s,code:[...s.code]}};let{lineCache:c}=this;this.lineCache=c!=null&&t!=null&&_s(c,t)?{cacheKey:void 0,file:e,sourceContents:e.contents,lines:c.lines}:void 0}endEditSession(e){this.editSessionActive=!1,this.pendingHighlightResult=void 0;let{renderCache:t}=this;e==null||t==null||t.file===e||!G(t.file,e)||(t.file=e)}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.file=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}clearRenderCache(){this.pendingStructuralRows=void 0,this.renderCache=void 0,this.pendingHighlightResult=void 0}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=bs(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!oo(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!gs(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??U(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??j}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!G(e,n.file)||!oo(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if(G(n.file,e))return n.file;let r=is(e.contents),i=e.contents.length===0||gs(e)||bs(r.length,this.getTokenizeMaxLength());return this.canRenderFile(e,t,i)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||G(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&bi(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&bi(t.theme)}getOrCreateLineCache(e){let{lineCache:t}=this;return(t==null||!_s(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:is(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return;let{file:i,result:a}=r;if(a==null)return;let o=n?new Map:void 0;this.pendingStructuralRows=o;let s=this.lineCache!=null&&_s(this.lineCache,i)?this.lineCache:void 0;for(let[t,n]of e){if(o==null&&s!=null&&t<s.lines.length){let e=n.map(e=>e[2]).join(``);s.lines[t]=ms(s.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};o==null?a.code[t]=e:o.set(t,e)}a.baseThemeType=t,r.isDirty=!0,o==null&&s!=null&&(i.contents=s.lines.join(``),s.sourceContents=i.contents)}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{file:r,result:i}=n;if(i==null)return;let a=this.lineCache!=null&&_s(this.lineCache,r)?this.lineCache.lines:is(r.contents),o=is(e.getText());if(a.length!==o.length){let r=Math.min(a.length,o.length),s=0;for(;s<r&&a[s]===o[s];)s++;let c=0;for(;c<r-s&&a[a.length-1-c]===o[o.length-1-c];)c++;let l=i.code;i.code=Array(o.length);for(let e=0;e<s;e++)i.code[e]=l[e];for(let e=0;e<c;e++)i.code[o.length-1-e]=l[a.length-1-e];if(t!==void 0)for(let[e,n]of t)e<o.length&&(i.code[e]=n);for(let t=s;t<o.length-c;t++)i.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<i.code.length;e++){let t=i.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}n.isDirty=!0}this.lineCache={cacheKey:r.cacheKey,file:r,sourceContents:r.contents,lines:o},this.textDocumentCache.set(r,e),r.contents=e.getText()}renderFile(e=this.file,t=de){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||gs(e)||bs(a.length,this.getTokenizeMaxLength()),c=this.canRenderFile(e,n,s),l=!G(e,this.renderCache.file),u=!so(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!s&&!l&&To(t);c&&!i&&(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e)}else{this.computedLang=e.lang??U(e.name),this.highlighter??=oa();let t=this.highlighter!=null&&bi(n.theme),i=this.highlighter!=null&&_e(this.computedLang),a=!s&&i;if(c&&this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=de){this.file=e;let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=bs(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??U(e.name);let n=this.highlighter!=null&&ao(vi(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&_e(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:ss(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=Ta(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=ps(t)?fs(this.lineAnnotations):void 0;d!=null&&(c.children.push(H(`context`,`annotation`,1)),s.push(co({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>this.annotationSlotName(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(Ea(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(H(`context`,`annotation`,1)),s.push(co({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>this.annotationSlotName(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{file:e,gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return uo({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return a(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(V({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Ta();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,hs(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return a(t?V({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await ia(Co(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i==null||a==null||!G(e,i)||!oo(n,this.getRenderOptions(i).options)||(a.result==null||!a.highlighted||!oo(a.options,n)||!G(a.file,i))&&(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!oo(t,n.options)))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&G(n.file,e)&&oo(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&G(e,n.file)&&oo(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return mo({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function bs(e,t){return e>t}var xs=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
15
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
16
|
+
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
17
|
+
</symbol>
|
|
18
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
19
|
+
<path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
|
|
20
|
+
</symbol>
|
|
21
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
22
|
+
<path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
|
|
23
|
+
</symbol>
|
|
24
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
25
|
+
<path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
|
|
26
|
+
</symbol>
|
|
27
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
28
|
+
<path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
|
|
29
|
+
</symbol>
|
|
30
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
31
|
+
<path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
|
|
32
|
+
</symbol>
|
|
33
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
34
|
+
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
|
|
35
|
+
</symbol>
|
|
36
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
37
|
+
<path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
|
|
38
|
+
</symbol>
|
|
39
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
40
|
+
<path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
|
|
41
|
+
</symbol>
|
|
42
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
43
|
+
<path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
|
|
44
|
+
</symbol>
|
|
45
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
46
|
+
<path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
47
|
+
</symbol>
|
|
48
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
49
|
+
<path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
50
|
+
</symbol>
|
|
51
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
52
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
53
|
+
</symbol>
|
|
54
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
55
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
56
|
+
</symbol>
|
|
57
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
58
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
|
|
59
|
+
</symbol>
|
|
60
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
61
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
62
|
+
</symbol>
|
|
63
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
64
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
65
|
+
</symbol>
|
|
66
|
+
</svg>`;function Ss(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Cs(e,t){return e==null||t==null?e===t:Ts(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var ws={};function Ts(e=ws,t=ws){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Es(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Ds(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function Os(){let e=document.createElement(`style`);return e.setAttribute(N,``),e}var ks=`@layer base {
|
|
67
|
+
:host {
|
|
68
|
+
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
69
|
+
"Courier New", monospace;
|
|
70
|
+
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
71
|
+
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
72
|
+
--diffs-mixer: light-dark(#000, #fff);
|
|
73
|
+
--diffs-gap-fallback: 8px;
|
|
74
|
+
--diffs-scrollbar-gutter-fallback: 6px;
|
|
75
|
+
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
76
|
+
--diffs-added-light: #0dbe4e;
|
|
77
|
+
--diffs-added-dark: #5ecc71;
|
|
78
|
+
--diffs-modified-light: #009fff;
|
|
79
|
+
--diffs-modified-dark: #69b1ff;
|
|
80
|
+
--diffs-deleted-light: #ff2e3f;
|
|
81
|
+
--diffs-deleted-dark: #ff6762;
|
|
82
|
+
--diffs-warning-light: #d5a910;
|
|
83
|
+
--diffs-warning-dark: #ffd452;
|
|
84
|
+
color-scheme: light dark;
|
|
85
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
86
|
+
font-size: var(--diffs-font-size, 13px);
|
|
87
|
+
line-height: var(--diffs-line-height, 20px);
|
|
88
|
+
font-feature-settings: var(--diffs-font-features);
|
|
89
|
+
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
90
|
+
--diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));
|
|
91
|
+
--diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));
|
|
92
|
+
--diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));
|
|
93
|
+
--diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));
|
|
94
|
+
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
95
|
+
--diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));
|
|
96
|
+
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
97
|
+
--diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));
|
|
98
|
+
--diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));
|
|
99
|
+
--diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));
|
|
100
|
+
--diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));
|
|
101
|
+
--diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));
|
|
102
|
+
--diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));
|
|
103
|
+
--diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));
|
|
104
|
+
--diffs-selection-base: var(--diffs-modified-base);
|
|
105
|
+
--diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));
|
|
106
|
+
background-color: var(--diffs-bg);
|
|
107
|
+
color: var(--diffs-fg);
|
|
108
|
+
display: block;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
pre, code, [data-error-wrapper] {
|
|
112
|
+
isolation: isolate;
|
|
113
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
114
|
+
outline: none;
|
|
115
|
+
margin: 0;
|
|
116
|
+
padding: 0;
|
|
117
|
+
display: block;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
pre, code {
|
|
121
|
+
background-color: var(--diffs-bg);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
code {
|
|
125
|
+
contain: content;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
input, button {
|
|
129
|
+
font-family: inherit;
|
|
130
|
+
font-size: inherit;
|
|
131
|
+
line-height: inherit;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
*, :before, :after {
|
|
135
|
+
box-sizing: border-box;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[data-icon-sprite] {
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
[data-diffs-header], [data-separator] {
|
|
143
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
[data-diffs-header][data-sticky] {
|
|
147
|
+
z-index: 1;
|
|
148
|
+
background-color: var(--diffs-bg);
|
|
149
|
+
position: sticky;
|
|
150
|
+
top: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[data-file-info] {
|
|
154
|
+
color: var(--fg);
|
|
155
|
+
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
156
|
+
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
157
|
+
padding: 10px;
|
|
158
|
+
font-weight: 700;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
[data-diff], [data-file] {
|
|
162
|
+
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
163
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
164
|
+
|
|
165
|
+
&[data-dehydrated] {
|
|
166
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
170
|
+
background-color: var(--diffs-bg-context);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@supports (-webkit-touch-callout: none) {
|
|
175
|
+
:host {
|
|
176
|
+
--diffs-scrollbar-gutter-fallback: 0px;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[data-line] span, [data-edit-prediction-suffix] span {
|
|
181
|
+
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
182
|
+
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
183
|
+
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
184
|
+
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
185
|
+
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
|
|
189
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
190
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
191
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
192
|
+
--diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
|
|
193
|
+
--diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
|
|
194
|
+
--diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
|
|
195
|
+
--diffs-line-bg: var(--diffs-computed-hovered-line-bg);
|
|
196
|
+
color: var(--diffs-fg);
|
|
197
|
+
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
[data-line], [data-no-newline] {
|
|
201
|
+
&[data-decoration-bg] {
|
|
202
|
+
--mix-deco-light: 92%;
|
|
203
|
+
--mix-deco-dark: 85%;
|
|
204
|
+
|
|
205
|
+
&[data-decoration-bg-depth="2"] {
|
|
206
|
+
--mix-deco-light: 88%;
|
|
207
|
+
--mix-deco-dark: 80%;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&[data-decoration-bg-depth="3"] {
|
|
211
|
+
--mix-deco-light: 85%;
|
|
212
|
+
--mix-deco-dark: 78%;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
--diffs-hover-mix-target: var(--diffs-decoration-bg);
|
|
216
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
217
|
+
var(--diffs-bg) var(--mix-deco-light),
|
|
218
|
+
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
219
|
+
var(--diffs-bg) var(--mix-deco-dark),
|
|
220
|
+
var(--diffs-decoration-bg)));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
225
|
+
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
226
|
+
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
227
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
[data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {
|
|
231
|
+
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
232
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
236
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
237
|
+
var(--diffs-bg) 78%,
|
|
238
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
239
|
+
var(--diffs-bg) 68%,
|
|
240
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
241
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
245
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
246
|
+
var(--diffs-bg) 78%,
|
|
247
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
248
|
+
var(--diffs-bg) 68%,
|
|
249
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
250
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
254
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
255
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
:where([data-background]) {
|
|
259
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
260
|
+
--mix-light: 91%;
|
|
261
|
+
--mix-dark: 85%;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
& [data-line], & [data-no-newline] {
|
|
265
|
+
--mix-light: 88%;
|
|
266
|
+
--mix-dark: 80%;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
270
|
+
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
271
|
+
|
|
272
|
+
&[data-line-type="change-deletion"] {
|
|
273
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
274
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
275
|
+
|
|
276
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
277
|
+
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
278
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
282
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
283
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
284
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
285
|
+
var(--diffs-diff-line-mix-target)));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&[data-line-type="change-addition"] {
|
|
289
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
290
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
291
|
+
|
|
292
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
293
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
294
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
298
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
299
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
300
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
301
|
+
var(--diffs-diff-line-mix-target)));
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
&[data-merge-conflict="current"] {
|
|
305
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
306
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
307
|
+
|
|
308
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
309
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
310
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
314
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
315
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
316
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
317
|
+
var(--diffs-diff-line-mix-target)));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
&[data-merge-conflict="incoming"] {
|
|
321
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
322
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
323
|
+
|
|
324
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
325
|
+
color: var(--diffs-modified-base);
|
|
326
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
330
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
331
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
332
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
333
|
+
var(--diffs-diff-line-mix-target)));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
|
|
339
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
340
|
+
--diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
|
|
341
|
+
|
|
342
|
+
&:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
343
|
+
--mix-selection-light: 82%;
|
|
344
|
+
--mix-selection-dark: 75%;
|
|
345
|
+
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
|
|
349
|
+
--mix-selection-light: 75%;
|
|
350
|
+
--mix-selection-dark: 60%;
|
|
351
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
352
|
+
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
&:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
356
|
+
--diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
|
|
357
|
+
var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
|
|
358
|
+
var(--mix-selection-light),
|
|
359
|
+
var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
&:where([data-editor-overlay]), &[data-selected-line] {
|
|
363
|
+
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
364
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
365
|
+
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
366
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
367
|
+
var(--diffs-selection-mix-target)));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
[data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
|
|
372
|
+
--diffs-computed-editor-active-line-bg: color-mix(in lab,
|
|
373
|
+
var(--diffs-computed-selected-line-bg)
|
|
374
|
+
var(--diffs-editor-active-line-source-mix, 100%),
|
|
375
|
+
var(--diffs-selection-emphasis-mix-target));
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
@media (pointer: fine) {
|
|
379
|
+
[data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
|
|
380
|
+
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
381
|
+
var(--diffs-computed-editor-active-line-bg) 97%,
|
|
382
|
+
var(--diffs-hover-mix-target)), color-mix(in lab,
|
|
383
|
+
var(--diffs-computed-editor-active-line-bg) 91%,
|
|
384
|
+
var(--diffs-hover-mix-target)));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
[data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
|
|
389
|
+
color: var(--diffs-selection-number-fg);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
[data-no-newline] {
|
|
393
|
+
user-select: none;
|
|
394
|
+
|
|
395
|
+
& span {
|
|
396
|
+
opacity: .6;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
[data-diff-type="split"][data-overflow="scroll"] {
|
|
401
|
+
grid-template-columns: 1fr 1fr;
|
|
402
|
+
display: grid;
|
|
403
|
+
|
|
404
|
+
& [data-additions] {
|
|
405
|
+
border-left: 1px solid var(--diffs-bg);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
& [data-deletions] {
|
|
409
|
+
border-right: 1px solid var(--diffs-bg);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
[data-code] {
|
|
414
|
+
grid-auto-flow: dense;
|
|
415
|
+
grid-template-columns: var(--diffs-code-grid);
|
|
416
|
+
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
417
|
+
overscroll-behavior-x: none;
|
|
418
|
+
tab-size: var(--diffs-tab-size, 2);
|
|
419
|
+
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
420
|
+
padding-bottom: max(0px,
|
|
421
|
+
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
422
|
+
var(--diffs-scrollbar-gutter)));
|
|
423
|
+
scrollbar-gutter: stable;
|
|
424
|
+
align-self: flex-start;
|
|
425
|
+
display: grid;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
[data-diffs-scrollbar-measure] {
|
|
429
|
+
opacity: 0;
|
|
430
|
+
pointer-events: none;
|
|
431
|
+
scrollbar-gutter: auto;
|
|
432
|
+
grid-template-columns: none;
|
|
433
|
+
width: 100px;
|
|
434
|
+
height: 100px;
|
|
435
|
+
padding: 0;
|
|
436
|
+
position: absolute;
|
|
437
|
+
top: -200px;
|
|
438
|
+
left: -200px;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
[data-container-size] {
|
|
442
|
+
container-type: inline-size;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
[data-code]::-webkit-scrollbar {
|
|
446
|
+
width: 0;
|
|
447
|
+
height: var(--diffs-scrollbar-gutter);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
[data-code]::-webkit-scrollbar-track {
|
|
451
|
+
background: none;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
[data-code]::-webkit-scrollbar-thumb {
|
|
455
|
+
background-color: #0000;
|
|
456
|
+
background-clip: content-box;
|
|
457
|
+
border: 1px solid #0000;
|
|
458
|
+
border-radius: 3px;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
[data-code]::-webkit-scrollbar-corner {
|
|
462
|
+
background-color: #0000;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
@supports ((-moz-appearance: none)) {
|
|
466
|
+
[data-code] {
|
|
467
|
+
scrollbar-width: thin;
|
|
468
|
+
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
469
|
+
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
474
|
+
& [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
475
|
+
padding-top: 0;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
[data-gutter] {
|
|
480
|
+
grid-template-rows: subgrid;
|
|
481
|
+
grid-template-columns: subgrid;
|
|
482
|
+
z-index: 3;
|
|
483
|
+
background-color: var(--diffs-bg);
|
|
484
|
+
grid-column: 1;
|
|
485
|
+
display: grid;
|
|
486
|
+
position: relative;
|
|
487
|
+
|
|
488
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
489
|
+
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
[data-content] {
|
|
494
|
+
grid-template-rows: subgrid;
|
|
495
|
+
grid-template-columns: subgrid;
|
|
496
|
+
background-color: var(--diffs-bg);
|
|
497
|
+
grid-column: 2;
|
|
498
|
+
min-width: 0;
|
|
499
|
+
display: grid;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
[data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
503
|
+
grid-auto-flow: dense;
|
|
504
|
+
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
505
|
+
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
506
|
+
display: grid;
|
|
507
|
+
|
|
508
|
+
& [data-code] {
|
|
509
|
+
display: contents;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
& [data-deletions] {
|
|
513
|
+
& [data-gutter] {
|
|
514
|
+
grid-column: 1;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
& [data-content] {
|
|
518
|
+
border-right: 1px solid var(--diffs-bg);
|
|
519
|
+
grid-column: 2;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
& [data-additions] {
|
|
524
|
+
& [data-gutter] {
|
|
525
|
+
border-left: 1px solid var(--diffs-bg);
|
|
526
|
+
grid-column: 3;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
& [data-content] {
|
|
530
|
+
grid-column: 4;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
|
|
536
|
+
overflow: clip;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
[data-overflow="scroll"] [data-gutter] {
|
|
540
|
+
position: sticky;
|
|
541
|
+
left: 0;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
[data-interactive-lines] [data-line] {
|
|
545
|
+
cursor: pointer;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
[data-interactive-line-numbers] [data-column-number] {
|
|
549
|
+
cursor: pointer;
|
|
550
|
+
touch-action: none;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
[data-content-buffer], [data-gutter-buffer] {
|
|
554
|
+
user-select: none;
|
|
555
|
+
min-height: 1lh;
|
|
556
|
+
position: relative;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
[data-gutter-buffer] {
|
|
560
|
+
padding-left: 2ch;
|
|
561
|
+
padding-right: 1ch;
|
|
562
|
+
|
|
563
|
+
&:before {
|
|
564
|
+
content: "";
|
|
565
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
566
|
+
display: block;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
[data-gutter-buffer="annotation"] {
|
|
571
|
+
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
572
|
+
min-height: 0;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
[data-gutter-buffer="buffer"] {
|
|
576
|
+
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
[data-content-buffer] {
|
|
580
|
+
background-position: 5px 0;
|
|
581
|
+
background-size: 8px 8px;
|
|
582
|
+
background-origin: border-box;
|
|
583
|
+
background-image: repeating-linear-gradient(-45deg,
|
|
584
|
+
transparent,
|
|
585
|
+
transparent calc(3px * 1.414),
|
|
586
|
+
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
587
|
+
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
588
|
+
grid-column: 1;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
[data-separator] {
|
|
592
|
+
box-sizing: content-box;
|
|
593
|
+
background-color: var(--diffs-bg);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
[data-separator="simple"] {
|
|
597
|
+
min-height: 4px;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
601
|
+
background-color: var(--diffs-bg-separator);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
605
|
+
height: 32px;
|
|
606
|
+
position: relative;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
[data-separator-wrapper] {
|
|
610
|
+
user-select: none;
|
|
611
|
+
fill: currentColor;
|
|
612
|
+
background-color: var(--diffs-bg);
|
|
613
|
+
align-items: center;
|
|
614
|
+
height: 100%;
|
|
615
|
+
display: flex;
|
|
616
|
+
position: absolute;
|
|
617
|
+
inset-inline: 0;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
[data-content] [data-separator-wrapper] {
|
|
621
|
+
display: none;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
[data-separator="metadata"] [data-separator-wrapper] {
|
|
625
|
+
background-color: var(--diffs-bg-separator);
|
|
626
|
+
height: 100%;
|
|
627
|
+
color: var(--diffs-fg-number);
|
|
628
|
+
white-space: nowrap;
|
|
629
|
+
text-overflow: ellipsis;
|
|
630
|
+
min-width: min-content;
|
|
631
|
+
padding-inline: 1ch;
|
|
632
|
+
inset-inline: 100% auto;
|
|
633
|
+
overflow: hidden;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
[data-separator="line-info"] {
|
|
637
|
+
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
638
|
+
|
|
639
|
+
& [data-separator-wrapper] {
|
|
640
|
+
min-width: 16px;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
645
|
+
margin-block: 0;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
[data-separator="line-info"][data-separator-first] {
|
|
649
|
+
margin-top: 0;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
[data-separator="line-info"][data-separator-last] {
|
|
653
|
+
margin-bottom: 0;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
[data-expand-index] [data-separator-wrapper] {
|
|
657
|
+
grid-template-columns: 32px auto;
|
|
658
|
+
display: grid;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
662
|
+
grid-template-columns: 32px 32px auto;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
[data-expand-button], [data-separator-content] {
|
|
666
|
+
background-color: var(--diffs-bg-separator);
|
|
667
|
+
flex: none;
|
|
668
|
+
align-items: center;
|
|
669
|
+
display: flex;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
[data-expand-index] [data-separator-content]:hover {
|
|
673
|
+
cursor: pointer;
|
|
674
|
+
text-decoration: underline;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
[data-expand-button] {
|
|
678
|
+
cursor: pointer;
|
|
679
|
+
min-width: 32px;
|
|
680
|
+
color: var(--diffs-fg-number);
|
|
681
|
+
border-right: 2px solid var(--diffs-bg);
|
|
682
|
+
flex-shrink: 0;
|
|
683
|
+
justify-content: center;
|
|
684
|
+
align-self: stretch;
|
|
685
|
+
|
|
686
|
+
&:hover {
|
|
687
|
+
color: var(--diffs-fg);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
&[data-expand-all-button] {
|
|
691
|
+
display: none;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
[data-expand-down] [data-icon] {
|
|
696
|
+
transform: scaleY(-1);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
[data-separator-content] {
|
|
700
|
+
height: 100%;
|
|
701
|
+
color: var(--diffs-fg-number);
|
|
702
|
+
flex: auto;
|
|
703
|
+
justify-content: flex-start;
|
|
704
|
+
padding: 0 1ch;
|
|
705
|
+
overflow: hidden;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
709
|
+
& [data-separator-content] {
|
|
710
|
+
user-select: none;
|
|
711
|
+
height: 100%;
|
|
712
|
+
overflow: clip;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
[data-unmodified-lines] {
|
|
717
|
+
text-overflow: ellipsis;
|
|
718
|
+
white-space: nowrap;
|
|
719
|
+
flex: 0 auto;
|
|
720
|
+
min-width: 0;
|
|
721
|
+
display: block;
|
|
722
|
+
overflow: hidden;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
@supports (width: 1cqi) {
|
|
726
|
+
[data-unified] {
|
|
727
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
728
|
+
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
729
|
+
width: 100cqi;
|
|
730
|
+
|
|
731
|
+
& [data-separator-content] {
|
|
732
|
+
border-radius: 6px;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
737
|
+
border-top-left-radius: unset;
|
|
738
|
+
border-bottom-left-radius: unset;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
[data-gutter] {
|
|
743
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
744
|
+
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
& [data-separator="line-info"] [data-separator-content] {
|
|
748
|
+
border-top-left-radius: 6px;
|
|
749
|
+
border-bottom-left-radius: 6px;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
753
|
+
border-top-left-radius: unset;
|
|
754
|
+
border-bottom-left-radius: unset;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
[data-additions] {
|
|
759
|
+
& [data-content] [data-separator="line-info"] {
|
|
760
|
+
background-color: var(--diffs-bg);
|
|
761
|
+
|
|
762
|
+
& [data-separator-wrapper] {
|
|
763
|
+
display: none;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
768
|
+
background-color: var(--diffs-bg-separator);
|
|
769
|
+
border-top-right-radius: 6px;
|
|
770
|
+
border-bottom-right-radius: 6px;
|
|
771
|
+
height: 100%;
|
|
772
|
+
display: block;
|
|
773
|
+
|
|
774
|
+
& [data-separator-content], & [data-expand-button] {
|
|
775
|
+
display: none;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
781
|
+
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
785
|
+
background-color: var(--diffs-bg-separator);
|
|
786
|
+
height: 100%;
|
|
787
|
+
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
788
|
+
border-top-right-radius: 6px;
|
|
789
|
+
border-bottom-right-radius: 6px;
|
|
790
|
+
display: block;
|
|
791
|
+
|
|
792
|
+
& [data-separator-content], & [data-expand-button] {
|
|
793
|
+
display: none;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
798
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
799
|
+
border-top-left-radius: 6px;
|
|
800
|
+
border-bottom-left-radius: 6px;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
@media (pointer: fine) {
|
|
805
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
806
|
+
&[data-separator-multi-button] {
|
|
807
|
+
& [data-expand-up] {
|
|
808
|
+
border-top-left-radius: 6px;
|
|
809
|
+
border-bottom-left-radius: unset;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
& [data-expand-down] {
|
|
813
|
+
border-bottom-left-radius: 6px;
|
|
814
|
+
border-top-left-radius: unset;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
@media (pointer: coarse) {
|
|
822
|
+
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
823
|
+
grid-template-columns: 34px 34px auto;
|
|
824
|
+
|
|
825
|
+
& [data-separator-content] {
|
|
826
|
+
grid-column: unset;
|
|
827
|
+
grid-row: unset;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
@supports (width: 1cqi) {
|
|
832
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
833
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
834
|
+
border-top-left-radius: 6px;
|
|
835
|
+
border-bottom-left-radius: 6px;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
&[data-separator-multi-button] {
|
|
839
|
+
& [data-expand-up] {
|
|
840
|
+
border-top-left-radius: 6px;
|
|
841
|
+
border-bottom-left-radius: 6px;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
& [data-expand-down] {
|
|
845
|
+
border-bottom-left-radius: unset;
|
|
846
|
+
border-top-left-radius: unset;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
@media (pointer: fine) {
|
|
854
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
855
|
+
grid-template-rows: 50% 50%;
|
|
856
|
+
display: grid;
|
|
857
|
+
|
|
858
|
+
& [data-separator-content] {
|
|
859
|
+
grid-area: 1 / 2 / -1;
|
|
860
|
+
min-width: min-content;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
& [data-expand-button] {
|
|
864
|
+
grid-column: 1;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
869
|
+
grid-template-columns: 34px auto;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
873
|
+
grid-template-columns: 100% auto;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
877
|
+
& [data-separator-multi-button] {
|
|
878
|
+
& [data-expand-up] {
|
|
879
|
+
border-bottom: 1px solid var(--diffs-bg);
|
|
880
|
+
border-right: 2px solid var(--diffs-bg);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
& [data-expand-down] {
|
|
884
|
+
border-top: 1px solid var(--diffs-bg);
|
|
885
|
+
border-right: 2px solid var(--diffs-bg);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
892
|
+
display: none;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
[data-line-annotation] {
|
|
896
|
+
min-height: var(--diffs-annotation-min-height, 0);
|
|
897
|
+
z-index: 2;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
[data-merge-conflict-actions] {
|
|
901
|
+
z-index: 2;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
[data-separator="custom"] {
|
|
905
|
+
grid-template-columns: subgrid;
|
|
906
|
+
display: grid;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
[data-line], [data-column-number], [data-no-newline] {
|
|
910
|
+
padding-inline: 1ch;
|
|
911
|
+
position: relative;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
[data-indicators="classic"] [data-line] {
|
|
915
|
+
padding-inline-start: 2ch;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
[data-indicators="classic"] {
|
|
919
|
+
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
920
|
+
&[data-no-newline], &[data-line] {
|
|
921
|
+
&:before {
|
|
922
|
+
user-select: none;
|
|
923
|
+
width: 1ch;
|
|
924
|
+
height: 1lh;
|
|
925
|
+
display: inline-block;
|
|
926
|
+
position: absolute;
|
|
927
|
+
top: 0;
|
|
928
|
+
left: 0;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
& [data-line-type="change-addition"] {
|
|
934
|
+
&[data-line], &[data-no-newline] {
|
|
935
|
+
&:before {
|
|
936
|
+
content: "+";
|
|
937
|
+
color: var(--diffs-addition-base);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
& [data-line-type="change-deletion"] {
|
|
943
|
+
&[data-line], &[data-no-newline] {
|
|
944
|
+
&:before {
|
|
945
|
+
content: "-";
|
|
946
|
+
color: var(--diffs-deletion-base);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
[data-indicators="bars"] {
|
|
953
|
+
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
954
|
+
&[data-column-number] {
|
|
955
|
+
&:before {
|
|
956
|
+
content: "";
|
|
957
|
+
user-select: none;
|
|
958
|
+
contain: strict;
|
|
959
|
+
width: 4px;
|
|
960
|
+
height: 100%;
|
|
961
|
+
display: block;
|
|
962
|
+
position: absolute;
|
|
963
|
+
top: 0;
|
|
964
|
+
left: 0;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
& [data-line-type="change-deletion"] {
|
|
970
|
+
&[data-column-number] {
|
|
971
|
+
&:before {
|
|
972
|
+
background-image: linear-gradient(0deg,
|
|
973
|
+
var(--diffs-bg-deletion) 50%,
|
|
974
|
+
var(--diffs-deletion-base) 50%);
|
|
975
|
+
background-repeat: repeat;
|
|
976
|
+
background-size: 2px 2px;
|
|
977
|
+
background-size: calc(1lh / round(1lh / 2px))
|
|
978
|
+
calc(1lh / round(1lh / 2px));
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
& [data-line-type="change-addition"] {
|
|
984
|
+
&[data-column-number] {
|
|
985
|
+
&:before {
|
|
986
|
+
background-color: var(--diffs-addition-base);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
[data-overflow="wrap"] {
|
|
993
|
+
& [data-line] {
|
|
994
|
+
white-space: pre-wrap;
|
|
995
|
+
word-break: break-word;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
& [data-annotation-content] {
|
|
999
|
+
word-break: break-word;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
[data-overflow="scroll"] [data-line] {
|
|
1004
|
+
white-space: pre;
|
|
1005
|
+
min-height: 1lh;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
[data-column-number] {
|
|
1009
|
+
box-sizing: content-box;
|
|
1010
|
+
text-align: right;
|
|
1011
|
+
user-select: none;
|
|
1012
|
+
color: var(--diffs-fg-number);
|
|
1013
|
+
padding-left: 2ch;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
[data-line-number-content] {
|
|
1017
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1018
|
+
z-index: 1;
|
|
1019
|
+
display: inline-block;
|
|
1020
|
+
position: relative;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
[data-disable-line-numbers] {
|
|
1024
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1025
|
+
min-width: 4px;
|
|
1026
|
+
padding: 0;
|
|
1027
|
+
|
|
1028
|
+
&:before {
|
|
1029
|
+
min-width: 0;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
& [data-line-number-content] {
|
|
1034
|
+
display: none;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
& [data-gutter-utility-slot] {
|
|
1038
|
+
right: unset;
|
|
1039
|
+
justify-content: flex-start;
|
|
1040
|
+
left: 0;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1044
|
+
left: 6px;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
[data-file][data-disable-line-numbers] {
|
|
1049
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1050
|
+
border-right: 0;
|
|
1051
|
+
min-width: 0;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
[data-diff-span] {
|
|
1056
|
+
box-decoration-break: clone;
|
|
1057
|
+
border-radius: 3px;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
[data-line-type="change-addition"] [data-diff-span] {
|
|
1061
|
+
background-color: var(--diffs-bg-addition-emphasis);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1065
|
+
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1069
|
+
color: var(--diffs-fg);
|
|
1070
|
+
padding-left: 1ch;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1074
|
+
align-items: center;
|
|
1075
|
+
display: flex;
|
|
1076
|
+
|
|
1077
|
+
&:after {
|
|
1078
|
+
color: var(--diffs-fg-conflict-marker);
|
|
1079
|
+
font-size: .75rem;
|
|
1080
|
+
font-style: normal;
|
|
1081
|
+
line-height: 1.25rem;
|
|
1082
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1083
|
+
padding-left: 1ch;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
[data-merge-conflict="marker-start"]:after {
|
|
1088
|
+
content: "(Current Change)";
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
[data-merge-conflict="marker-end"]:after {
|
|
1092
|
+
content: "(Incoming Change)";
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
[data-merge-conflict-actions-content] {
|
|
1096
|
+
min-height: 1.75rem;
|
|
1097
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1098
|
+
color: var(--diffs-fg);
|
|
1099
|
+
align-items: center;
|
|
1100
|
+
gap: .25rem;
|
|
1101
|
+
padding-inline: .5rem;
|
|
1102
|
+
font-size: .75rem;
|
|
1103
|
+
line-height: 1.2;
|
|
1104
|
+
display: flex;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
[data-merge-conflict-action] {
|
|
1108
|
+
appearance: none;
|
|
1109
|
+
color: var(--diffs-fg-number);
|
|
1110
|
+
font: inherit;
|
|
1111
|
+
cursor: pointer;
|
|
1112
|
+
background: none;
|
|
1113
|
+
border: 0;
|
|
1114
|
+
padding: 0;
|
|
1115
|
+
font-style: normal;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
[data-merge-conflict-action]:hover {
|
|
1119
|
+
color: var(--diffs-fg);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
[data-merge-conflict-action="current"]:hover {
|
|
1123
|
+
color: var(--diffs-addition-base);
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
[data-merge-conflict-action="incoming"]:hover {
|
|
1127
|
+
color: var(--diffs-modified-base);
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
[data-merge-conflict-action-separator] {
|
|
1131
|
+
color: var(--diffs-fg-number);
|
|
1132
|
+
opacity: .6;
|
|
1133
|
+
user-select: none;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
[data-diffs-header="default"] {
|
|
1137
|
+
background-color: var(--diffs-bg);
|
|
1138
|
+
justify-content: space-between;
|
|
1139
|
+
align-items: center;
|
|
1140
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1141
|
+
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1142
|
+
z-index: 2;
|
|
1143
|
+
flex-direction: row;
|
|
1144
|
+
padding-inline: 16px;
|
|
1145
|
+
display: flex;
|
|
1146
|
+
position: relative;
|
|
1147
|
+
top: 0;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
[data-header-content] {
|
|
1151
|
+
align-items: center;
|
|
1152
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1153
|
+
white-space: nowrap;
|
|
1154
|
+
flex-direction: row;
|
|
1155
|
+
min-width: 0;
|
|
1156
|
+
display: flex;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1160
|
+
text-overflow: ellipsis;
|
|
1161
|
+
white-space: nowrap;
|
|
1162
|
+
direction: rtl;
|
|
1163
|
+
min-width: 0;
|
|
1164
|
+
overflow: hidden;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
[data-prev-name] {
|
|
1168
|
+
opacity: .7;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
[data-rename-icon] {
|
|
1172
|
+
fill: currentColor;
|
|
1173
|
+
flex-grow: 0;
|
|
1174
|
+
flex-shrink: 0;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
[data-diffs-header="default"] [data-metadata] {
|
|
1178
|
+
white-space: nowrap;
|
|
1179
|
+
align-items: center;
|
|
1180
|
+
gap: 1ch;
|
|
1181
|
+
display: flex;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
[data-diffs-header="default"] [data-additions-count] {
|
|
1185
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1186
|
+
color: var(--diffs-addition-base);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
[data-diffs-header="default"] [data-deletions-count] {
|
|
1190
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1191
|
+
color: var(--diffs-deletion-base);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
[data-change-icon] {
|
|
1195
|
+
fill: currentColor;
|
|
1196
|
+
flex-shrink: 0;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1200
|
+
color: var(--diffs-modified-base);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
[data-change-icon="new"] {
|
|
1204
|
+
color: var(--diffs-addition-base);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
[data-change-icon="deleted"] {
|
|
1208
|
+
color: var(--diffs-deletion-base);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
[data-change-icon="file"] {
|
|
1212
|
+
opacity: .6;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
[data-annotation-content] {
|
|
1216
|
+
z-index: 2;
|
|
1217
|
+
isolation: isolate;
|
|
1218
|
+
white-space: normal;
|
|
1219
|
+
align-self: flex-start;
|
|
1220
|
+
min-width: 0;
|
|
1221
|
+
display: flow-root;
|
|
1222
|
+
position: relative;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1226
|
+
width: var(--diffs-column-content-width, auto);
|
|
1227
|
+
left: var(--diffs-column-number-width, 0);
|
|
1228
|
+
position: sticky;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
[data-annotation-slot] {
|
|
1232
|
+
text-wrap-mode: wrap;
|
|
1233
|
+
word-break: normal;
|
|
1234
|
+
white-space-collapse: collapse;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
[data-gutter-utility-slot] {
|
|
1238
|
+
touch-action: none;
|
|
1239
|
+
justify-content: flex-end;
|
|
1240
|
+
display: flex;
|
|
1241
|
+
position: absolute;
|
|
1242
|
+
top: 0;
|
|
1243
|
+
bottom: 0;
|
|
1244
|
+
right: 0;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
[data-utility-button] {
|
|
1248
|
+
appearance: none;
|
|
1249
|
+
cursor: pointer;
|
|
1250
|
+
width: 1lh;
|
|
1251
|
+
height: 1lh;
|
|
1252
|
+
font-size: var(--diffs-font-size, 13px);
|
|
1253
|
+
line-height: var(--diffs-line-height, 20px);
|
|
1254
|
+
background-color: var(--diffs-modified-base);
|
|
1255
|
+
color: var(--diffs-bg);
|
|
1256
|
+
fill: currentColor;
|
|
1257
|
+
z-index: 4;
|
|
1258
|
+
touch-action: none;
|
|
1259
|
+
border: none;
|
|
1260
|
+
border-radius: 4px;
|
|
1261
|
+
justify-content: center;
|
|
1262
|
+
align-items: center;
|
|
1263
|
+
margin-right: calc(-1lh + 1ch);
|
|
1264
|
+
padding: 0;
|
|
1265
|
+
display: flex;
|
|
1266
|
+
position: relative;
|
|
1267
|
+
|
|
1268
|
+
&:before {
|
|
1269
|
+
content: "";
|
|
1270
|
+
display: block;
|
|
1271
|
+
position: absolute;
|
|
1272
|
+
inset: 0 0 0 -4px;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
[data-decoration-bar-stack] {
|
|
1277
|
+
pointer-events: none;
|
|
1278
|
+
isolation: isolate;
|
|
1279
|
+
z-index: 1;
|
|
1280
|
+
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1281
|
+
box-sizing: content-box;
|
|
1282
|
+
border-left: 2px solid var(--diffs-bg);
|
|
1283
|
+
border-right: 2px solid var(--diffs-bg);
|
|
1284
|
+
width: 6px;
|
|
1285
|
+
position: absolute;
|
|
1286
|
+
top: 0;
|
|
1287
|
+
bottom: 0;
|
|
1288
|
+
right: -2px;
|
|
1289
|
+
|
|
1290
|
+
[data-decoration-bar-depth="1"] & {
|
|
1291
|
+
background-color: color-mix(in lab,
|
|
1292
|
+
var(--diffs-bg) 20%,
|
|
1293
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
[data-decoration-bar-depth="2"] & {
|
|
1297
|
+
background-color: color-mix(in lab,
|
|
1298
|
+
var(--diffs-bg) 45%,
|
|
1299
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
[data-decoration-bar-depth="3"] & {
|
|
1303
|
+
background-color: color-mix(in lab,
|
|
1304
|
+
var(--diffs-bg) 65%,
|
|
1305
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
[data-decoration-bar-start] & {
|
|
1309
|
+
border-top-left-radius: 5px;
|
|
1310
|
+
border-top-right-radius: 5px;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
[data-decoration-bar-end] & {
|
|
1314
|
+
z-index: 3;
|
|
1315
|
+
border-bottom-right-radius: 5px;
|
|
1316
|
+
border-bottom-left-radius: 5px;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
[data-placeholder] {
|
|
1321
|
+
contain: strict;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
[data-error-wrapper] {
|
|
1325
|
+
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1326
|
+
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1327
|
+
scrollbar-width: none;
|
|
1328
|
+
max-height: 400px;
|
|
1329
|
+
overflow: auto;
|
|
1330
|
+
|
|
1331
|
+
& [data-error-message] {
|
|
1332
|
+
color: var(--diffs-deletion-base);
|
|
1333
|
+
font-size: 18px;
|
|
1334
|
+
font-weight: bold;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
& [data-error-stack] {
|
|
1338
|
+
color: var(--diffs-fg-number);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
@layer theme, rendered, unsafe;
|
|
1344
|
+
`,As;function js(e){if(As!=null)return As;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(te,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),As=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),As}function Ms(e){return`${ie}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Ns=`@layer base, theme, rendered, unsafe;`,Ps=RegExp(`${zs(ie)}\\s*:\\s*[^;]+;`);function Fs(e){return`${Ns}
|
|
1345
|
+
${ks}
|
|
1346
|
+
@layer theme {
|
|
1347
|
+
${e}
|
|
1348
|
+
}`}function Is(e){return`${Ns}
|
|
1349
|
+
@layer unsafe {
|
|
1350
|
+
${e}
|
|
1351
|
+
}`}function Ls(e,t=`system`,n){return`${Ns}
|
|
1352
|
+
@layer rendered {
|
|
1353
|
+
:host {${t===`system`?``:`
|
|
1354
|
+
color-scheme: ${t};`}
|
|
1355
|
+
${Ms(n)}
|
|
1356
|
+
${e}
|
|
1357
|
+
}
|
|
1358
|
+
}`}function Rs(e,t){let n=Ms(t);return e.replace(Ps,n)}function zs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Bs=new WeakMap;function Vs(e){return Bs.get(e)??e}function Hs(e,t){Bs.set(e,t)}function Us({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function Ws(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Gs(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function Ks(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function qs(e,t,n){let r=new Map;for(let i of e){let e=Vs(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function Js(e,t,n){for(let r of t){let t=Vs(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Ys(e,t,n){if(e==null)return n(t);let r=Vs(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function Xs(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Zs(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Xs(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Qs(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function $s({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=ec(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function ec(){let e=document.createElement(`style`);return e.setAttribute(M,``),e}var tc=void 0;function nc(){return tc??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(ks)),t.adoptedStyleSheets=[e]}connectedCallback(){js(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(d,t)}var rc=[``];function ic(e){let t={...e};return delete t.cacheKey,t}var ac=-1,oc=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++ac}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;editSession;renderedFile;renderRange;enabled=!0;editor;constructor(e={theme:j},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new ys(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Za,this.interactionManager=new Aa(`file`,ja(e)),this.workerManager?.subscribeToThemeChanges(this)}getAnnotationSlotName=e=>Ys(this.editSession?.annotations,e,wo);handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??j}getLatestFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedFile}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}updateExternalFile(e,t){if(G(this.file,e))return!1;let n=this.editSession!=null;return this.file=e,n||this.editor!=null?this.installEditSession(e,n?void 0:this.editor?.__getDocumentContents(e),!0):this.editSession=void 0,this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=qs(t,wo,this.editSession.annotations)),!0}installEditSession(e,t,n=!1){let r=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===e.contents,i=ic(t??e);this.editSession={file:i,externalReplacement:n&&r,annotations:this.editSession?.annotations??qs(this.lineAnnotations,wo)},this.fileRenderer.beginEditSession(i,r?e:void 0)}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(ja(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!_a(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Js(t,e,wo))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.getLatestAnnotations().length>0}cleanUp(e=!1){let t=this.editor;this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0,this.renderedFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||sc(this.pre,i,this.options.collapsed)||cc(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ws(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Zs(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderedFile=e,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.getLatestFile()){return e==null?rc:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getLatestFile();if(e==null||t==null||i==null)return;let a=a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestFile()!==i||e.__syncRenderView({highlighter:a,fileContainer:t,file:i,lineAnnotations:r,renderRange:n,externalDocument:this.editSession?.externalReplacement===!0})},o=this.getTheme(),s=i.lang??U(i.name),c=oa({theme:o,lang:s});c==null?ia({themes:vi(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.externalReplacement=!1)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){this.editSession==null?this.file!=null&&this.installEditSession(this.file,e.__getDocumentContents(this.file)):this.fileRenderer.beginEditSession(this.editSession.file);let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(this.fileRenderer.fileCache===t&&(this.renderedFile=t),this.syncRenderViewToEditor()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,file:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{file:a,annotations:o}=n;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=o?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...a},f={file:d,editor:t,originalFile:r,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===r.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}e&&c!=null&&(this.file=c,s!=null&&(this.lineAnnotations=s)),this.editSession=void 0;let{renderedFile:p,file:m}=this;if(this.fileRenderer.endEditSession(m),p!=null&&m!=null&&p!==m&&G(p,m)&&(this.renderedFile=m),e&&this.fileContainer!=null&&this.rerender(),l)throw u}applyDocumentChange(e,t){let n=this.editSession?.file;if(n==null)throw Error(`File.applyDocumentChange: requires an active edit session`);this.fileRenderer.beginEditSession(n),this.fileRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}updateRenderCache(e,t,n){let r=this.editSession?.file;if(r==null)throw Error(`File.updateRenderCache: requires an active edit session`);this.fileRenderer.beginEditSession(r),this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),m=!G(this.file,e);m&&this.updateExternalFile(e,o);let h=this.getLatestFile(e)??e;if(!c&&!n&&so(u,this.renderRange)&&!m&&!p&&!f){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(Zs(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderFile(h,fe);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,e.file),this.renderedFile=e?.file??h,this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f||!G(this.renderedFile,h))||!this.applyPartialRender(h,d,u)){let n=this.fileRenderer.renderFile(h,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyFullRender(n,e),this.renderedFile=n.file}this.applyBuffers(e,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||gs(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Ss(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Es(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Ds();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Os(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Is(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=js(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=$s({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Ls(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Rs(this.themeCSSStyle.textContent??``,js(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&nc()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=Us({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=a(i.children),t.style.cssText=i.properties.style}else n.innerHTML=a(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?Qs(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t,n){if(t==null||n==null)return!1;let{code:r}=this,i=r==null?void 0:this.getColumns(r);if(r==null||i==null)return!1;let a=t.startingLine,o=n.startingLine,s=t.totalLines===1/0?1/0:a+t.totalLines,c=n.totalLines===1/0?1/0:o+n.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(t,n)=>{if(!(n<=0))return this.fileRenderer.renderFile(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??a(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:o,renderCustomHeader:s,renderHeaderMetadata:c}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,A,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=o?.(n)??void 0,a=c?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,D,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,O,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,k,a),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Ks(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Ks(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=xs;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};Cs(i,this.appliedPreAttributes)||(Gs(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function sc(e,t,n=!1){return!n&&e==null&&t!=null}function cc(e,t,n=!1){return e==null&&t!=null&&!n}function lc(e){return{...oe,...e}}function uc(e,t){let n=dc(e,t);return t?n:e.diffHeaderHeight+n}function dc(e,t){return e.paddingTop??(t?e.spacing:0)}function fc(e){return e.paddingBottom??e.spacing}function pc(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var mc=5e3,hc=new Map,gc=-1;function _c(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var vc=class extends oc{virtualizer;metrics;__id=`virtualized-file:${++gc}`;renderType=`virtualized`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:hc};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=oe,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=lc(e);!t&&ga(this.metrics,n)||(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache(),!0):!1}hasLineAnnotations(){return this.getLatestAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!va(t,e),r=_c(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.ghostTextRows=hc,this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){let{heights:t,ghostTextRows:n}=this.cache;if(n===e)return!1;let{lineHeight:r}=this.metrics,i=!1;for(let a of new Set([...n.keys(),...e.keys()])){let o=n.get(a)??0,s=e.get(a)??0;if(s===o)continue;let c=(t.get(a)??r)-o*r+s*r;c===r?t.delete(a):t.set(a,c),i=!0}return this.cache.ghostTextRows=e,i}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.editor?.__getGhostTextRows()??hc;if(e=this.applyGhostTextRows(n),t===`scroll`&&this.getLatestAnnotations().length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let{lineHeight:r}=this.metrics;if(this.code==null)return e;let i=this.code.children[1];if(!(i instanceof HTMLElement))return e;let a=ds(this.getLatestAnnotations());if(this.renderRange!=null&&a&&ps(this.renderRange)){let t=yc(i)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!a&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let a=Number(i),o=t.getBoundingClientRect().height+(n.get(a)??0)*r,s=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(s=!0),o+=t.nextElementSibling.getBoundingClientRect().height);let c=this.getLineHeight(a,s);o!==c&&(e=!0,o===this.metrics.lineHeight*(s?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,o))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));updateCodeViewLayout(e,t,n,r){let i=!G(this.file,e);i&&this.updateExternalFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o||c;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&this.resetLayoutCache(),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1,a=uc(this.metrics,n);if(r||i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=uc(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!G(this.getRenderedFile(),this.getLatestFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??hc);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(t),c=uc(this.metrics,i),l=fc(this.metrics);if(this.height+=c,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height!==this.height&&(t.name,e.height,this.height)}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.file==null)return;let e=this.getLatestFile(),t=e==null?void 0:this.fileRenderer.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!G(this.getRenderedFile(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1);let i=this.getRenderedFile();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!G(this.file,t);a&&(this.updateExternalFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.latestFile===(this.getLatestFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:!1}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,(l||s)&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),s&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!1),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.pendingRender=void 0,this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.fileRenderer.getFileForNextRender(n);return this.pendingRender={latestFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!G(i,a),renderedFileChanged:!G(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%mc===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=uc(this.metrics,i),u=s>0?fc(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=ds(this.getLatestAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=Math.floor(g&&b<t+f?0:(b-(t+f))/o),h=Math.floor(m/a)-Math.floor(y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,D,O,k=C?.lineIndex??0;for(let e=k;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),O!=null)){if(O<=0)break;O--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),w+s>b&&(D??=o),O==null&&w>=r&&i&&(O=x),T++,w+=s}if(E==null)if(g)E=0,D=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};D??=E;let A=Math.round(D-y/2),j=Math.max(0,Math.ceil(s/a)-y),M=Math.max(0,Math.min(A,j)),N=M*a,ee=A<0?v+A*a:v,te=S[M]??0,ne=N===0?0:d+te,re=M+ee/a,ie=re<S.length?p-S[re]:p-(w-t-f);return{startingLine:N,totalLines:ee,bufferBefore:ne,bufferAfter:Math.max(0,ie)}}};function yc(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===us&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function K(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function bc(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function xc(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Sc(e){return{...e,hunks:xc(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Cc(e,t){return e-(t===0?0:1)}function q(e,t){return Cc(e,t)+t}var wc=1;function Tc(e,...t){return`ck${wc}:${JSON.stringify([e,...t])}`}function Ec(e){return e===``?[]:e.split(v)}function Dc(e,t,n){let r=e===`clone`?Sc(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Oc(r,Ac(r,n),jc(r,n));case`rename-pure`:{let e=jc(r,n);Mc(r,n);let t=Ec(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,Pc(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Oc(e,t,n){let r=Ec(t.contents),i=Ec(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=kc(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,Pc(e,t,n),e}function kc(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Cc(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=q(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=q(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function Ac(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function jc(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Mc(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Nc(e,t,n){return e.cacheKey==null?Fc(t,n):`${e.cacheKey}:hydrated`}function Pc(e,t,n){let r=Nc(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Fc(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Tc(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function Ic(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Lc=new TextEncoder,Rc=new TextDecoder(`utf-8`,{ignoreBOM:!0}),zc=/[\uD800-\uDFFF]/,Bc=1024,Vc=new Uint8Array(Bc);function Hc(){Vc.length!==Bc&&(Vc=new Uint8Array(Bc))}function J(e){if(e.length===0)return e;if(zc.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Vc.length<t&&(Vc=new Uint8Array(t));let{written:n}=Lc.encodeInto(e,Vc);return Rc.decode(Vc.subarray(0,n))}var Uc=4096,Wc=.5;function Gc(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=qc(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Kc(t,e)}}function Kc(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function qc(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Uc)return null;let c=[];for(let t=0;t<n;t++)c.push(Yc(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(Yc(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Xc(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Wc:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var Jc=/\s+/g;function Yc(e){return e.replace(Jc,``)}function Xc(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function Zc(e,t,n){try{return Qc(e,t,n)}finally{Hc()}}function Qc(e,t,n=!1,r){let i=gl(e),a=i?al(e):ol(e),o,s=[];for(let e of a){if(i&&!m.test(e)){if(o==null)o=J(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!i&&!sl(e)){if(o==null)o=J(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let a=el(e,{cacheKey:t==null?void 0:r==null?Tc(`patch-file`,t,String(s.length)):Tc(`patch-file`,t,String(r),String(s.length)),isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function $c(e,t){try{return el(e,t)}finally{Hc()}}function el(e,{cacheKey:t,isGitDiff:n=m.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=_l(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=il(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=pl(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?rl(i.contents):[],deletionLines:!l&&r!=null&&i!=null?rl(r.contents):[],cacheKey:yl(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(x),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=J(r.trim()),n!==r&&(c.prevName=J(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?b:y):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=J(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=J(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=J(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=J(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=J(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=J(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(S)??[];t!=null&&(c.prevObjectId=J(t)),n!=null&&(c.newObjectId=J(n)),r!=null&&(c.mode=J(r))}e.startsWith(`rename from `)&&(c.prevName=J(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=J(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1359
|
+
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
1360
|
+
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:C}=p;u=l?u:C-1,d=l?d:v-1;let w={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:C,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:yl(p.hunkContext),hunkSpecs:J(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},T=0,E=0;for(let e=1;e<s.length;e++){let t=s[e];if(T>=w.additionCount&&E>=w.deletionCount&&!t.startsWith(`\\`)){if(!(dl(t)&&!fl(t)))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=bl(n);if(r===`addition`){if(a&&T>=w.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=xl(t);(g==null||g.type!==`change`)&&(g=Sl(`change`,u,d),w.hunkContent.push(g)),d++,T++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&E>=w.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=xl(t);(g==null||g.type!==`change`)&&(g=Sl(`change`,u,d),w.hunkContent.push(g)),u++,E++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(E>=w.deletionCount||T>=w.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=xl(t);(g==null||g.type!==`context`)&&(g=Sl(`context`,u,d),w.hunkContent.push(g)),d++,u++,T++,E++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(w.noEOFCRAdditions=!0,w.noEOFCRDeletions=!0):_===`deletion`?w.noEOFCRDeletions=!0:_===`addition`&&(w.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=Ic(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Ic(c.deletionLines[e]))}}}if(T!==w.additionCount||E!==w.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${w.deletionCount}/${w.additionCount}, parsed old/new ${E}/${T}`);let e=Cc(w.additionStart,w.additionCount)+(T===0?0:1),t=Cc(w.deletionStart,w.deletionCount)+(E===0?0:1);if(!l){let n=e-w.additionStart,r=t-w.deletionStart;w.additionLineIndex+=n,w.deletionLineIndex+=r;for(let e of w.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}w.additionStart=e,w.deletionStart=t,w.additionCount=T,w.deletionCount=E}w.additionLines=m,w.deletionLines=h,w.collapsedBefore=Math.max(Cc(w.additionStart,w.additionCount)-o,0),c.hunks.push(w),o=q(w.additionStart,w.additionCount);for(let e of w.hunkContent)e.type===`context`?(w.splitLineCount+=e.lines,w.unifiedLineCount+=e.lines):(w.splitLineCount+=Math.max(e.additions,e.deletions),w.unifiedLineCount+=e.deletions+e.additions);w.splitLineStart=c.splitLineCount+w.collapsedBefore,w.unifiedLineStart=c.unifiedLineCount+w.collapsedBefore,c.splitLineCount+=w.collapsedBefore+w.splitLineCount,c.unifiedLineCount+=w.collapsedBefore+w.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=q(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),Gc(c),c}}function tl(e,t,n=!1){let r=[],i=nl(e)?e.split(p):[e];for(let e of i)try{r.push(Qc(e,t,n,t==null?void 0:r.length))}catch(e){if(n)throw e;console.error(e)}finally{Hc()}return r}function nl(e){return e.startsWith(`From `)||e.includes(`
|
|
1361
|
+
From `)}function rl(e){let t=il(e);for(let e=0;e<t.length;e++)t[e]=J(t[e]);return t}function il(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
1362
|
+
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function al(e){return _l(e,`diff --git`)}function ol(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=ul(e,r);if(i<=0&&a<=0){if(cl(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=ul(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=pl(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function sl(e){return cl(e,0)}function cl(e,t){let n=ul(e,t);return ll(e,t,`---`)&&ll(e,n,`+++`)}function ll(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
|
|
1363
|
+
`||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function ul(e,t){let n=e.indexOf(`
|
|
1364
|
+
`,t);return n===-1?e.length:n+1}function dl(e){let t=e[0];return t===`+`||t===`-`||t===` `}function fl(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
1365
|
+
`&&n!==`\r`)return!1}return!0}function pl(e){if(!e.startsWith(`@@ -`))return;let t=4,n=ml(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=ml(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=ml(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=ml(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=hl(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function ml(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function hl(e){return e.endsWith(`\r
|
|
1366
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
1367
|
+
`)?e.slice(0,-1):e}function gl(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
1368
|
+
diff --git`)}function _l(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:vl(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=vl(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function vl(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function yl(e){return e==null?e:J(e)}function bl(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function xl(e){let t=e.slice(1);return J(t===``?`
|
|
1369
|
+
`:t)}function Sl(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Cl=`/dev/null`;function wl(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Tl(),a=t??Tl(),o=$c(l(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?Tc(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Tl(){return{name:Cl,contents:``}}var El=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function Dl(e,t){return _a(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Ol(e){return V({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function kl(e){return V({tagName:`div`,children:[V({tagName:`span`,children:[B(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Al(e){return V({tagName:`div`,children:[Ca({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function jl({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(V({tagName:`div`,children:[B(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Al(`up`)),s++),o||(e.push(Al(`down`)),s++)):(e.push(Al(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(V({tagName:`div`,children:[V({tagName:`span`,children:[B(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(V({tagName:`div`,children:[B(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(V({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(V({tagName:`slot`,properties:{name:i}})),V({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function Ml(e,t){return`hunk-separator-${e}-${t}`}function Nl(e){let t=e.at(-1);return t==null?0:Math.max(q(t.additionStart,t.additionCount),q(t.deletionStart,t.deletionCount))}function Pl({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function Fl({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function Il(e){return[Cc(e.additionStart,e.additionCount)+1,q(e.additionStart,e.additionCount)+1]}function Ll({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function Rl(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-q(t.additionStart,t.additionCount),r=e.deletionLines.length-q(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function zl({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-q(n.additionStart,n.additionCount),i=e.deletionLines.length-q(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function Bl({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=zl({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function Vl({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=Il(a);if(t<o){let s=Ll({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=Bl({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=Il(a);return t<o+i.fromStart||t>=o+i.rangeSize}function Hl({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=Il(n),l=Ll({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=Bl({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function Ul({type:e,metrics:t}){return t.hunkSeparatorHeight??pc(e)}function Wl({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function Gl({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function Kl(e){return e!==`simple`&&e!==`metadata`}function ql({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!Gl({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Ul({type:e,metrics:t}),a=Wl({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Jl({type:e,metrics:t}){if(!Kl(e))return;let n=Ul({type:e,metrics:t}),r=Wl({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Yl({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Xl({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Cc(r.deletionStart,r.deletionCount),s=Cc(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=Ll({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?Bl({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if($l(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,$l(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if($l(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=eu(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(tu({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if($l(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function Xl({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=Zl({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Zl({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=Ll({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?Bl({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function Ql(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function $l(e,t,n,r,i,a){let[o,s]=Ql(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function eu(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function tu({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var nu={forcePlainText:!1};function ru(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=nu){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Xo({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??au();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}Yl({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&iu({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=ou({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else as(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else as(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function iu({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:l}){if(e==null||t==null||o===`none`||(e=Ic(e),t=Ic(t),e.length>l||t.length>l))return;let u=o===`char`?c(e,t):s(e,t),d=[],f=[],p=o===`word-alt`,m=u.at(-1);for(let e of u){let t=e===m;!e.added&&!e.removed?(Fl({item:e,arr:d,enableJoin:p,isNeutral:!0,isLastItem:t}),Fl({item:e,arr:f,enableJoin:p,isNeutral:!0,isLastItem:t})):e.removed?Fl({item:e,arr:d,enableJoin:p,isLastItem:t}):Fl({item:e,arr:f,enableJoin:p,isLastItem:t})}let h=0;for(let e of d)e[0]===1&&i.push(Pl({line:n,spanStart:h,spanLength:e[1].length})),h+=e[1].length;h=0;for(let e of f)e[0]===1&&a.push(Pl({line:r,spanStart:h,spanLength:e[1].length})),h+=e[1].length}function au(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function ou({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??U(e.name),d=s??U(t.name),{state:f,transformers:p}=Fo(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Qo(i.codeToHast(Ic(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Qo(i.codeToHast(Ic(t.contents),m)))}}function su(e,t){let n=wl({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function cu(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function lu(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function uu(e,t){return t.length>0&&t.length<e.deletionLines.length&&lu(t)}function du(e,t,n){let r=e.deletionLines.join(``),i=cu(t.length,r),a=wl({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function fu(e,t){return du(e,[``],t)}function pu(e,t){if(e.additionLines.length===0)return fu(e,t);if(uu(e,e.additionLines))return du(e,e.additionLines,t);let n=e.additionLines,r=su(e,t);return hu(r,n),r}function mu(e){return e.length>1&&e.at(-1)===``}function hu(e,t){if(!mu(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&q(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,Tu(e);return}}}function gu(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return _u(e,su(e,n));let r=Array.from(t);if(r.length===0)return _u(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||Ic(r)===Ic(i))return _u(e,su(e,n))}let i=vu(e,r);if(i.size===0)return _u(e,su(e,n));for(let t of i)if(!bu(e,t,n))return _u(e,su(e,n));return Tu(e),Rl(e)?_u(e,su(e,n)):_u(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function _u(e,t){return Object.assign(e,t),t}function vu(e,t){let n=new Set;for(let r of t){let t=yu(e,r);if(t==null)return new Set;n.add(t)}return n}function yu(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function bu(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=wl({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Su(r,s),xu(e,t),!0)}function xu(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
1370
|
+
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
1371
|
+
`)}function Su(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Cu(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,wu(e)}function Cu(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function wu(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function Tu(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Cc(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,wu(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=q(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-q(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Eu=new WeakMap;function Du(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Ou(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function ku(e,t){let n=e.hunks,r=e.additionLines,i=Du(r),a=i===r?e:{...e,additionLines:i},o=zu(n,Ru(a,t),e.deletionLines.length),s=Hu(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,Qu(e),hu(e,r),Gu(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Au(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Ju(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Ju(r);if(i==null||t<i||o!=null&&o!==s)return ku(e,n);o=s}if(o!=null){if(ju(e,i,o,r,n)){e.editSessionDirty=!0;return}return ku(e,n)}}function ju(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Mu(e),o=e.hunks[n];if(o.hunkContent.some(Nu))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function Mu(e){let t=Eu.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Eu.set(e,{lines:e.deletionLines,set:n}),n}function Nu(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Pu(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function Fu(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=Ll({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Yu(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=Bl({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=Yu(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Iu(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=Yu(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,Yu(i)+i.deletionCount,e.deletionLines.length),n}function Lu(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?su(e,t):pu(e,t)),!0)}function Ru(e,t){if(Ou(e.deletionLines,e.additionLines)==null)return[];let n=wl({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=Cu(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function zu(e,t,n){let r=e.map((e,t)=>{let n=Yu(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&Bu(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=Vu(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function Bu(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function Vu(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function Hu(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);Wu(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);Wu(s,c,i,r),r+=c,i+=c,n.push(Uu(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function Uu(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:Xu(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Zu(t.additionStart,r),deletionStart:Xu(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Zu(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${Xu(t.deletionStart,i)},${i} +${Xu(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return wu(s),s}function Wu(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function Gu(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(Yu(r)!==Yu(i)||r.deletionCount!==i.deletionCount||Ju(r)!==Ju(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Ku(r,i))return!0}return!1}function Ku(e,t){let n=qu(e),r=qu(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*qu(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function Ju(e){return Cc(e.additionStart,e.additionCount)}function Yu(e){return Cc(e.deletionStart,e.deletionCount)}function Xu(e,t){return t===0?e:e+1}function Zu(e,t){return t===0?e-1:e}function Qu(e){Tu(e);for(let t=0;t<e.hunks.length;t++)xu(e,t)}function $u(e){let t=e.lang??U(e.name),n=e.lang??(e.prevName==null?`text`:U(e.prevName));return t===`text`&&n===`text`}var ed=-1,td=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++ed}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:j},t=wo,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=bi(e.theme??j)?oa():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,fu(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&K(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Dl(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!K(t.diff,e)||$u(e)||pd(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!K(n,e)||!K(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Dl(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??ue}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=Ic(u);s==null&&i&&(a.additionLines[t]=ms(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0)if(this.editSessionActive)if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,fu(a,this.options.parseDiffOptions)),u=!0;else if(uu(a,a.additionLines))this.applyRecomputePreservingSessionType(a,du(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=Au(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}else Object.assign(a,gu(a,c,this.options.parseDiffOptions));return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Pu(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=fd(e),i.code.additionLines=ud(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,fu(r,this.options.parseDiffOptions)),i.code.additionLines[0]=dd(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,pu(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(uu(e,n)){this.applyRecomputePreservingSessionType(e,du(e,n,t));return}this.applyExpansionRemap(ku(e,t))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>co(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=j,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ae,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await ia(Co(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=pd(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Dl(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!$u(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??U(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??j}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!K(e,n.diff)||!Dl(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(K(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||$u(e)||pd(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||K(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&bi(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&bi(t.theme)}renderDiff(e=this.diff,t=de){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||$u(e)||pd(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!K(e,this.renderCache.diff),d=!so(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&To(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,To(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??U(e.name),this.highlighter??=oa();let t=this.highlighter!=null&&bi(i.theme),n=this.highlighter!=null&&_e(this.computedLang),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=de){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return mo({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=pd(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??U(e.name);let n=this.highlighter!=null&&bi(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&_e(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=ru(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(Yl({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=dd(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i==null||a==null||!K(i,e)||!Dl(n,this.getRenderOptions(i).options)||(a.result==null||!a.highlighted||!Dl(a.options,n)||!K(a.diff,i))&&(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!Dl(t,n.options)))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&K(n.diff,e)&&Dl(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&K(e,n.diff)&&Dl(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=md(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Ta(),deletionsGutterAST:Ta(),additionsGutterAST:Ta(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=zl({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,H(void 0,`buffer`,this.size)),h?.push(Ol(this.size))):(x.pushToGutter(`deletions`,H(void 0,`buffer`,this.size)),g?.push(Ol(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,Ea(t,n,r,i))};function T(e){C.flush(),a===`unified`?sd(`unified`,e,x):(sd(`deletions`,e,x),sd(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Yl({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&id(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=cd(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=cd(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),od({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&id(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&ad(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=cd(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=cd(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}od({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&ad(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(kl(e)),x.pushToGutter(`unified`,H(e,`metadata`,1))):(x.deletionsContentAST.push(kl(e)),x.pushToGutter(`deletions`,H(e,`metadata`,1)),k||(x.pushToGutter(`additions`,H(void 0,`buffer`,1)),x.additionsContentAST.push(Ol(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(kl(e)),x.pushToGutter(`unified`,H(e,`metadata`,1))):(x.additionsContentAST.push(kl(e)),x.pushToGutter(`additions`,H(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,H(void 0,`buffer`,1)),x.deletionsContentAST.push(Ol(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(Nl(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Ta(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,hs(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(V({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(V({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(V({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return a(this.renderFullAST(e,t))}renderPartialHTML(e,t){return a(t==null?e:V({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!ps(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(fs(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(fs(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){od({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}od({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return uo({fileOrDiff:e,mode:t,stickyHeader:n})}},nd=new Intl.PluralRules(`en-US`);function rd(e){return`${e} unmodified line${nd.select(e)===`one`?``:`s`}`}function id(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function ad(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function od({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,H(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,H(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,H(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function sd(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,jl({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(jl({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,jl({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(jl({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Ml(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?rd(n):`More unchanged context may be available`;c.pushToGutter(e,jl({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(jl({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function cd(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function ld(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function ud(e,t,n,r){let i=ld(e),a=ld(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=dd(e,r.getLineText(e));return l}function dd(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function fd(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function pd(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function md(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function hd(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function gd(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function _d(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function vd({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function yd(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Xs(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function bd(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function xd(e){let t={...e};return delete t.cacheKey,t}function Sd(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??U(e.name),r=t.lang??U(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function Cd(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function wd(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&Cd(n.lines,t.deletionLines)}var Td=-1,Ed=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Td}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:j},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Za,this.scrollSyncManager=new El,this.interactionManager=new Aa(`diff`,ja(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??j}getHunksRendererOptions(e){return yd(e)}createHunksRenderer(e){return new td(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=Cc(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`)if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}else c+=e.lines,l+=e.lines,u+=e.lines;else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(ja(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!_a(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Ys(this.editSession?.annotations,e,wo);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Js(t,e,wo))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;pa(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=vd(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||jd(this.pre,kd({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Md(this.headerElement,Ad({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ws(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?wl(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!bd(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(Dc(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await _d(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(Dd(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(K(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(Dd(e)),this.editor.__getDocumentSessionState())):(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=qs(t,wo,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Ec(t.contents),a=n!=null&&wd(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=xd(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,Tu(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??qs(this.lineAnnotations,wo),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=vd(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!Od(u,this.deletionFile)||!Od(d,this.additionFile)),y=e!=null&&!K(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&so(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=wl(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Lu(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,fe);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!K(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?Sd(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??U(i.name),c=oa({theme:o,lang:s});c==null?ia({themes:vi(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||To(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Yl({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&Sd(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?xc(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(Dd(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=Sc(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=Fu(e,this.hunksRenderer.getExpandedHunksMap(),t);return Lu(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Iu(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return Vl({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return Hl({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=Il(o);if(e<s){let c=Ll({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=Bl({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=Il(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){z(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||$u(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!gd(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!hd(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:Es(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Ds();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:Ks(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):Ks(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=xs;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:o}}=this,s=(n!==this.editSession?.diff&&K(r,n)?i:void 0)??a(e);if(this.headerCache.html=s,this.headerCache.fileDiff=n,s!==o){let e=document.createElement(`div`);e.innerHTML=s;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=s}if(this.isContainerManaged)return;let{renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d}=this.options;if(c!=null){let e=c(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,A,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let f=l?.(n)??void 0,p=u?.(n)??void 0,m=d?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,D,f),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,O,p),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,k,m),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Os(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Is(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=js(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=$s({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Ls(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Rs(this.themeCSSStyle.textContent??``,js(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&nc()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Qs(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=Nd(t[0]),o=Nd(t[1]);return i==null||o==null?!1:(r.gutter.innerHTML=a(i),r.content.innerHTML=a(o),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Us({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Us({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Us({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=Nd(r?.[0]),a=Nd(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=Nd(r?.[0]),o=Nd(r?.[1]),s=()=>{for(let[e,t]of[[n.gutter,i],[n.content,o]])t!=null&&(e.innerHTML=a(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Qs(this.pre,s):s(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Nd(t[0]),i=Nd(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};Cs(u,this.appliedPreAttributes)||(Gs(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Dd(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function Od(e,t){return e==null||t==null?e==null&&t==null:bc(e,t)}function kd({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ad({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function jd(e,t,n=!1){return!n&&e==null&&t}function Md(e,t,n=!1){return e==null&&t&&!n}function Nd(e){if(e!=null&&e.type===`element`)return e.children??[]}function Pd({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=uc(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=Ll({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=ql({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=Fd(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?Bl({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=Jl({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=Jl({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=fc(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function Fd(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return Id(e,t)}function Id(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var Ld=3e3,Rd=new Map,zd=-1,Bd=class extends Ed{__id=`little-virtualized-file-diff:${++zd}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:Rd,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=lc(n)}setMetrics(e,t=!1){let n=lc(e);!t&&ga(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache({includeEstimatedHeights:!1}),!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return ds(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!va(t,e),r=n&&Jd(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Yd(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=Rd,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.getRenderedDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??Rd);let a=this.getLatestAnnotations();if(t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&ps(this.renderRange)){let t=Vd(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=$d(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.startHydratedEditSession(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=lc(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=uc(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return Yl({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=ql({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=Jl({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??uc(this.metrics,n)+this.cache.fileAnnotationHeight,u;return Yl({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=ql({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=Jl({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!K(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=Dc(`clone`,e,t);if(await _d(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Dc(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await _d(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return Vl({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!K(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??Rd);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=uc(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=Pd({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Xd(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height!==this.height&&(e.name,t.height,this.height)}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=vd(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Qd(s,this.deletionFile)||!Qd(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=wl(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!K(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:!1}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),g&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.pendingRender=void 0,this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(this.getRenderedDiff()!==this.pendingRender?.diff)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!K(a,o),renderedDiffChanged:!K(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Zd(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Xd(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Hd(this.cache.heightDeltas),u=uc(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Gd(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Kd(i,e)*this.metrics.lineHeight+Ud(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=Ld}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Ud(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=Ll({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?ql({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?Bl({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Jl({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:qd({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=Ll({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Bl({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Xd(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=uc(this.metrics,i),h=e.hunks.length>0?fc(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(Yl({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?ql({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=Jl({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null)if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};M??=j;let ee=Math.round(M-w/2),te=Math.max(0,Math.ceil(p/s)-w),ne=Math.max(0,Math.min(ee,te)),re=ne*s,ie=ee<0?C+ee*s:C,ae=E[ne]??0,oe=re===0?0:g+ae,se=ne+ie/s,ce=se<E.length?v-E[se]:v-(k-t-_);return{startingLine:re,totalLines:ie,bufferBefore:oe,bufferAfter:Math.max(0,ce)}}};function Vd(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===us&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Hd(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function Ud({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Wd(e,n);return(t[Wd(e,r)]??0)-(t[i]??0)}function Wd(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Gd(e){return Math.ceil(e/Ld)*Ld}function Kd(e,t){let n=0;for(let r of e)r<t&&n++;return n}function qd({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Jd(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Yd(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Xd(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Zd(e){return typeof e==`function`?`custom`:e??`line-info`}function Qd(e,t){return e==null||t==null?e==null&&t==null:bc(e,t)}function $d(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function ef(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:tf(e.items,t.items)}function tf(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function nf(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(ne,``),t.before(r)):(r.setAttribute(re,``),t.after(r)),n?.observe(r),r}function rf(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var af=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),of=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],sf=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],cf=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],lf=Symbol(`CodeView.itemOptionsState`);function uf(e,t){Object.defineProperty(e,lf,{configurable:!1,enumerable:!1,value:t})}function df(e){return e[lf]}function ff(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var pf=120,mf=1,hf=`--diffs-overflow-override`,gf=12e6,_f=1e6,vf=2e6,yf=1e7,bf=11e6;function xf(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Sf=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Cf=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=se;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;constructor(e={theme:j},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??ce}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??se.hunkLineCount,lineHeight:e?.lineHeight??se.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??se.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??se.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??le}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return f&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<mf||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Sf&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(hf,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,pf)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(hf,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??nf(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){pa(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let e=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),{record:e,instance:t?.instance}});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear();let t=!1,n;for(let{record:r,instance:i}of e)try{r.editor.cleanUp(`discard`),i?.cleanUp()}catch(e){t||(t=!0,n=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),t)throw n}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(d),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))Of(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return Sa()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e)),this.syncItemEditors(t),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=wf(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;Tf(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!ga(r,i),o=!ga(n,this.getLayout());o&&this.syncLayout();let s=a||Ef(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||Df(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),va(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(pa(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):z(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{e.managerState!==`initialized`&&!e.workersFailed||(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??j;return aa()&&bi(e)?(this.clearReadySubscription(),!0):(_a(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return la({themes:vi(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=Pf(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new Bd(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new vc(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&ba(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null){xf(n);let r=df(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of of)ff(e,t,()=>this.options[t]);ff(e,`stickyHeader`,()=>this.options.stickyHeaders),ff(e,`collapsed`,e=>{let t=df(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),ff(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=df(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of sf)this.defineItemSharedCallback(e,`file`,t);for(let t of cf)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of af)ff(e,t,()=>this.options[t]);ff(e,`stickyHeader`,()=>this.options.stickyHeaders),ff(e,`hunkSeparators`,()=>this.options.hunkSeparators),ff(e,`collapsed`,e=>{let t=df(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),ff(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=df(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of sf)this.defineItemSharedCallback(e,`diff`,t);for(let t of cf)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return uf(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return uf(t,{id:e}),t}updateItemOptionsId(e,t){let n=df(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){ff(e,n,e=>{if(this.options[n]==null)return;let r=df(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){ff(e,n,e=>{let r=df(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=(e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)}),i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>bf}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),gf):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=rf(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=rf(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>bf&&t<i,o=n<_f&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(yf,r):vf):{pagedScrollTop:rf(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=rf(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${kf(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${kf(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=xa({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),Mf(this.stickyContainer,t.element,h),n.virtualizedSetup(),jf(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(Mf(this.stickyContainer,t.element,h),jf(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=rf(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=mf){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=rf(this.clampScrollTop(e)),i=rf(t),{scrollPageOffset:a}=this,o=rf(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;r===this.renderState.scrollTop&&r===i&&l===o&&!u||(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||rf(this.getScrollTop())===rf(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);ef(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function wf(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function Tf(e,t){return!_a(e.theme??j,t.theme??j)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Ef(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Df(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Of(e){return e instanceof SVGElement||Ks(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function kf(e){let t=Af(e.start,e.side),n=Af(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function Af(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function jf(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function Mf(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Nf(e){return(e.annotations?.length??0)>0}function Pf(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Nf(t.item)&&i.push(t);return i.length>0?i:void 0}var Ff=class e{options;tokensStable=[];tokensUnstable=[];lastUnstableCodeChunk=``;lastStableGrammarState;constructor(e){this.options=e}async enqueue(e){let t=(this.lastUnstableCodeChunk+e).split(`
|
|
1372
|
+
`),n=[],r=[],i=this.tokensUnstable.length;return t.forEach((e,i)=>{let a=i===t.length-1,o=this.options.highlighter.codeToTokens(e,{...this.options,grammarState:this.lastStableGrammarState}),s=o.tokens[0];a||s.push({content:`
|
|
1373
|
+
`,offset:0}),a?(r=s,this.lastUnstableCodeChunk=e):(this.lastStableGrammarState=o.grammarState,n.push(...s))}),as(this.tokensStable,n),this.tokensUnstable=r,{recall:i,stable:n,unstable:r}}close(){let e=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk=``,this.lastStableGrammarState=void 0,{stable:e}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk=``,this.lastStableGrammarState=void 0}clone(){let t=new e(this.options);return t.lastUnstableCodeChunk=this.lastUnstableCodeChunk,t.tokensUnstable=this.tokensUnstable,t.tokensStable=this.tokensStable,t.lastStableGrammarState=this.lastStableGrammarState,t}},If=class extends TransformStream{tokenizer;options;constructor(e){let t=new Ff(e),{allowRecalls:n=!1}=e;super({async transform(e,r){let{stable:i,unstable:a,recall:o}=await t.enqueue(e);n&&o>0&&r.enqueue({recall:o});for(let e of i)r.enqueue(e);if(n)for(let e of a)r.enqueue(e)},async flush(e){let{stable:r}=t.close();if(!n)for(let t of r)e.enqueue(t)}}),this.tokenizer=t,this.options=e}};function Lf(e){let t=document.createElement(`span`);return t.style=bn(e.htmlStyle??yn(e)),t.textContent=e.content,t}var Rf=-1,zf=class{options;__id=`file-stream:${++Rf}`;highlighter;stream;abortController;fileContainer;pre;code;gutterElement;contentElement;themeCSSStyle;appliedThemeCSS;currentRowCount=0;constructor(e={theme:j}){this.options=e,this.currentLineIndex=this.options.startingLineIndex??1}cleanUp(){pa(this.render),this.abortController?.abort(),this.abortController=void 0}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.options={...this.options,themeType:e},typeof this.options.theme!=`string`&&this.fileContainer!=null&&this.appliedThemeCSS!=null&&this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType))}async initializeHighlighter(){return this.highlighter=await ia(Co(this.options.lang,this.options)),this.highlighter}queuedSetupArgs;async setup(e,t){let n=this.queuedSetupArgs!=null;if(this.queuedSetupArgs=[e,t],n)return;this.highlighter??=await this.initializeHighlighter();let[r,i]=this.queuedSetupArgs;this.queuedSetupArgs=void 0;let a=r;this.setupStream(a,i,this.highlighter)}setupStream(e,t,n){let{disableLineNumbers:r=!1,overflow:i=`scroll`,theme:a=j,themeType:o=`system`}=this.options,s=this.getOrCreateFileContainer();s.parentElement??t.appendChild(s),this.pre??=document.createElement(`pre`),this.pre.parentElement??s.shadowRoot?.appendChild(this.pre);let c=typeof a==`string`?n.getTheme(a).type:void 0,l=Xo({theme:a,highlighter:n});this.applyThemeState(s,l,o,c);let u=Gs(this.pre,{type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:r,overflow:i,split:!1,totalLines:0});u.textContent=``,this.pre=u,this.code=Us({code:this.code,pre:u}),this.gutterElement=void 0,this.contentElement=void 0,this.currentRowCount=0,this.currentLineElement=void 0,this.currentLineIndex=this.options.startingLineIndex??1,this.abortController?.abort(),this.abortController=new AbortController;let{onStreamStart:d,onStreamClose:f,onStreamAbort:p}=this.options;this.stream?.cancel().catch(()=>{}),this.stream=e,this.stream.pipeThrough(typeof a==`string`?new If({...this.options,theme:a,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeTimeLimit:0}):new If({...this.options,themes:a,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:W(`token`),tokenizeTimeLimit:0})).pipeTo(new WritableStream({start(e){d?.(e)},close(){f?.()},abort(e){p?.(e)},write:this.handleWrite}),{signal:this.abortController.signal}).catch(e=>{e.name!==`AbortError`&&console.error(`FileStream pipe error:`,e)})}queuedTokens=[];handleWrite=e=>{`recall`in e&&this.queuedTokens.length>=e.recall?this.queuedTokens.length=this.queuedTokens.length-e.recall:this.queuedTokens.push(e),z(this.render),this.options.onStreamWrite?.(e)};currentLineIndex;currentLineElement;render=()=>{this.options.onPreRender?.(this);let{gutter:e,content:t}=this.getOrCreateStreamColumns(),n=document.createDocumentFragment(),r=document.createDocumentFragment();for(let e of this.queuedTokens)if(`recall`in e){if(this.currentLineElement==null)throw Error(`FileStream.render: no current line element, shouldnt be possible to get here`);if(e.recall>this.currentLineElement.childNodes.length)throw Error(`FileStream.render: Token recall exceed the current line, there's probably a bug...`);for(let t=0;t<e.recall;t++)this.currentLineElement.lastChild?.remove()}else{let t=Lf(e);if(this.currentLineElement==null){let{gutterLine:e,contentLine:t}=this.createLine();n.appendChild(e),r.appendChild(t)}if(this.currentLineElement?.appendChild(t),e.content===`
|
|
1374
|
+
`){this.currentLineIndex++;let{gutterLine:e,contentLine:t}=this.createLine();n.appendChild(e),r.appendChild(t)}}n.childNodes.length>0&&e.appendChild(n),r.childNodes.length>0&&t.appendChild(r),this.queuedTokens.length=0,this.options.onPostRender?.(this)};getOrCreateStreamColumns(){if(this.code==null)throw Error(`FileStream: expected code element to exist`);if(this.gutterElement!=null&&this.contentElement!=null)return{gutter:this.gutterElement,content:this.contentElement};let e=document.createElement(`div`);e.dataset.gutter=``;let t=document.createElement(`div`);return t.dataset.content=``,this.code.appendChild(e),this.code.appendChild(t),this.gutterElement=e,this.contentElement=t,{gutter:e,content:t}}updateRowSpan(){this.gutterElement!=null&&(this.gutterElement.style.gridRow=`span ${this.currentRowCount}`),this.contentElement!=null&&(this.contentElement.style.gridRow=`span ${this.currentRowCount}`)}createLine(){let e=this.currentLineIndex,t=`${e-1}`,n=document.createElement(`div`);n.dataset.columnNumber=`${e}`,n.dataset.lineType=`context`,n.dataset.lineIndex=t;let r=document.createElement(`span`);r.dataset.lineNumberContent=``,r.textContent=`${e}`,n.appendChild(r);let i=document.createElement(`div`);return i.dataset.line=`${e}`,i.dataset.lineType=`context`,i.dataset.lineIndex=t,this.currentRowCount+=1,this.updateRowSpan(),this.currentLineElement=i,{gutterLine:n,contentLine:i}}getOrCreateFileContainer(e){return e!=null&&e===this.fileContainer||e==null&&this.fileContainer!=null?this.fileContainer:(this.fileContainer!=null&&e!=null&&e!==this.fileContainer&&(this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0),this.fileContainer=e??document.createElement(`diffs-container`),this.fileContainer)}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??j,s=typeof o==`string`?o:{...o},c=js(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}this.themeCSSStyle=$s({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Ls(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}};function Bf(e,t){let{resolution:n,hunkIndex:r,startContentIndex:i,endContentIndex:a,indexesToDelete:o=new Set}=t,s=e.hunks[r];if(s==null)throw console.error({diff:e,hunkIndex:r}),Error(`resolveRegion: Invalid hunk index: ${r}`);if(i<0||a>=s.hunkContent.length||i>a)throw Error(`resolveRegion: Invalid content range, ${i}, ${a}`);let{hunks:c,additionLines:l,deletionLines:u}=e,d={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:${n[0]}-${r}:${i}-${a}`},f={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},p=r===c.length-1&&a===s.hunkContent.length-1,m=!e.isPartial;for(let[t,s]of c.entries()){Hf(e,d,f,Cc(s.deletionStart,s.deletionCount)-s.collapsedBefore,Cc(s.additionStart,s.additionCount)-s.collapsedBefore,s.collapsedBefore,m);let c={...s,hunkContent:[],additionStart:f.nextAdditionStart,deletionStart:f.nextDeletionStart,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:f.splitLineCount,unifiedLineStart:f.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,p]of s.hunkContent.entries())if(t!==r||e<i||e>a){Uf(p,d,u,l);let e={...p,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex};c.hunkContent.push(e),Gf(e,f,c)}else if(o.has(e))c.hunkContent.push({type:`context`,lines:0,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex});else if(p.type===`context`){Uf(p,d,u,l);let e={...p,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),Gf(e,f,c)}else{Wf(n,p,d,u,l);let e={type:`context`,lines:n===`deletions`?p.deletions:n===`additions`?p.additions:p.deletions+p.additions,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),Gf(e,f,c)}if(t===r&&p){let e=n===`deletions`?s.noEOFCRDeletions:s.noEOFCRAdditions;c.noEOFCRAdditions=e,c.noEOFCRDeletions=e}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),d.hunks.push(c)}let h=c.at(-1);if(h!=null&&!e.isPartial){let e=q(h.deletionStart,h.deletionCount),t=q(h.additionStart,h.additionCount),n=Math.min(u.length-e,l.length-t);Vf(d,u,l,e,t,n),f.splitLineCount+=n,f.unifiedLineCount+=n}return d.splitLineCount=f.splitLineCount,d.unifiedLineCount=f.unifiedLineCount,d}function Vf(e,t,n,r,i,a){for(let o=0;o<a;o++){let a=t[r+o],s=n[i+o];if(a==null||s==null)throw Error(`pushCollapsedContextLines: missing collapsed context line`);e.deletionLines.push(a),e.additionLines.push(s)}}function Hf(e,t,n,r,i,a,o){a<=0||(o&&(Vf(t,e.deletionLines,e.additionLines,r,i,a),n.nextAdditionLineIndex+=a,n.nextDeletionLineIndex+=a),n.nextAdditionStart+=a,n.nextDeletionStart+=a,n.splitLineCount+=a,n.unifiedLineCount+=a)}function Uf(e,t,n,r){if(e.type===`context`)for(let n=0;n<e.lines;n++){let i=r[e.additionLineIndex+n];if(i==null)throw console.error({additionLines:r,content:e,i:n}),Error(`pushContentLinesToDiff: Context line does not exist`);t.deletionLines.push(i),t.additionLines.push(i)}else{let i=Math.max(e.deletions,e.additions);for(let a=0;a<i;a++){if(a<e.deletions){let r=n[e.deletionLineIndex+a];if(r==null)throw console.error({deletionLines:n,content:e,i:a}),Error(`pushContentLinesToDiff: Deletion line does not exist`);t.deletionLines.push(r)}if(a<e.additions){let n=r[e.additionLineIndex+a];if(n==null)throw console.error({additionLines:r,content:e,i:a}),Error(`pushContentLinesToDiff: Addition line does not exist`);t.additionLines.push(n)}}}}function Wf(e,t,n,r,i){if(e===`deletions`||e===`both`)for(let e=0;e<t.deletions;e++){let i=r[t.deletionLineIndex+e];if(i==null)throw console.error({deletionLines:r,content:t,i:e}),Error(`pushResolveLinesToDiff: Deletion line does not exist`);n.deletionLines.push(i),n.additionLines.push(i)}if(e===`additions`||e===`both`)for(let e=0;e<t.additions;e++){let r=i[t.additionLineIndex+e];if(r==null)throw console.error({additionLines:i,content:t,i:e}),Error(`pushResolveLinesToDiff: Addition line does not exist`);n.deletionLines.push(r),n.additionLines.push(r)}}function Gf(e,t,n){e.type===`context`?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function Kf(e){let t=typeof e==`string`?e:e.type;return t===`accept`||t===`incoming`?`additions`:t===`reject`||t===`current`?`deletions`:`both`}function qf(e,t,n){return Bf(e,{resolution:Kf(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:Jf(t)})}function Jf(e){let t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}function Yf({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Xf(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:_p(n,e.startContentIndex)}}function Zf(e,t=6){t=Math.max(t,1);let n={deletionLines:[],additionLines:[],conflictStack:[],conflictBuilders:[],actions:[],hunks:[],nextConflictIndex:0,splitLineCount:0,unifiedLineCount:0,lastHunkEnd:0,activeHunk:void 0,maxContextLines:t,maxContextLines2:t*2},r=e.contents,i=r.length;if(i>0){let e=0,t=0,a=r.indexOf(`
|
|
1375
|
+
`,e);for(;a!==-1;)Qf(n,r.slice(e,a+1),t),e=a+1,t++,a=r.indexOf(`
|
|
1376
|
+
`,e);e<i&&Qf(n,r.slice(e),t)}if(n.conflictStack.length>0)throw Error(`parseMergeConflictDiffFromFile: unfinished merge conflict marker stack`);n.activeHunk!=null&&n.activeHunk.hunkContent.length>0&&(np(n,n.activeHunk,`trailing`),rp(n));for(let e=0;e<n.conflictBuilders.length;e++){let t=n.conflictBuilders[e];if(t==null||!t.completed)throw Error(`parseMergeConflictDiffFromFile: failed to build merge conflict action ${e}`)}if(n.hunks.length>0&&n.additionLines.length>0&&n.deletionLines.length>0){let e=n.hunks[n.hunks.length-1],t=Math.max(n.additionLines.length-q(e.additionStart,e.additionCount),0);n.splitLineCount+=t,n.unifiedLineCount+=t}let a=n.deletionLines.join(``),o=n.additionLines.join(``),s=mp(e,`current`,a),c=mp(e,`incoming`,o),l=`change`;o===``?l=`deleted`:a===``&&(l=`new`);let u={name:e.name,prevName:void 0,type:l,hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,isPartial:!1,deletionLines:n.deletionLines,additionLines:n.additionLines,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:merge-conflict-diff`};return{fileDiff:u,currentFile:s,incomingFile:c,actions:n.actions,markerRows:hp(u,n.actions)}}function Qf(e,t,n){let r=e.conflictStack[e.conflictStack.length-1];if(r==null){if(t.length>=7&&t.charCodeAt(0)===60&&dp(t)===`start`){cp(e,t,n);return}ap(e,t);return}let i=dp(t);if(i===`start`){cp(e,t,n);return}if(i===`base`){r.stage=`base`,r.baseMarkerLineIndex=n,r.markerLines.base=t;return}if(i===`separator`){r.stage=`incoming`,r.separatorLineIndex=n,r.markerLines.separator=t;return}if(i===`end`){let r=e.conflictStack.pop();if(r==null)throw Error(`parseMergeConflictDiffFromFile: encountered end marker before start marker`);sp(e,r,n,t);return}r.stage===`current`?op(e,`deletion`,t,r.conflictIndex,`current`):r.stage===`base`?ap(e,t,r.conflictIndex):op(e,`addition`,t,r.conflictIndex,`incoming`)}function $f(e){return e.activeHunk??=lp(e.additionLines.length+1,e.deletionLines.length+1),e.activeHunk}function ep(e,t,n,r){let i=e.conflictBuilders[t];if(i==null)throw Error(`parseMergeConflictDiffFromFile: failed to locate conflict action ${t}`);let a=i.action,o=e.hunks.length;if(a.hunkIndex<0)a.hunkIndex=o;else if(a.hunkIndex!==o)throw Error(`parseMergeConflictDiffFromFile: conflict ${t} spans multiple hunks and cannot be anchored`);if(a.startContentIndex<0&&(a.startContentIndex=r),a.endContentIndex=r,a.endMarkerContentIndex=r,n===`current`){a.currentContentIndex??=r;return}if(n===`base`){a.baseContentIndex??=r;return}a.incomingContentIndex=r}function tp(e,t,n,r){let i=e.hunkContent,a=i[i.length-1];return a?.type===`change`?(t===`addition`?a.additions++:a.deletions++,i.length-1):(i.push({type:`change`,additions:+(t===`addition`),deletions:+(t===`deletion`),additionLineIndex:n,deletionLineIndex:r}),i.length-1)}function np(e,t,n){let r=t.contextBufferCount,i=t.contextBufferAdditionStart,a=t.contextBufferDeletionStart;if(n===`leading`&&r>e.maxContextLines){let n=r-e.maxContextLines;i+=n,a+=n,r=e.maxContextLines,t.additionStart+=n,t.deletionStart+=n,t.additionLineIndex+=n,t.deletionLineIndex+=n}if(n===`trailing`&&r>e.maxContextLines&&(r=e.maxContextLines),r===0){t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0;return}let o=t.hunkContent,s=o[o.length-1],c;s?.type===`context`?(s.lines+=r,c=o.length-1):(o.push({type:`context`,lines:r,additionLineIndex:i,deletionLineIndex:a}),c=o.length-1),t.additionCount+=r,t.deletionCount+=r;let l=t.contextBufferBaseConflicts;if(l!=null){let n=i-t.contextBufferAdditionStart;for(let[t,i]of l)t>=n&&t<n+r&&ep(e,i,`base`,c)}t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0}function rp(e){if(e.activeHunk==null)return;let t=e.activeHunk;if(e.activeHunk=void 0,t.hunkContent.length===0)return;let n=0,r=0;for(let e of t.hunkContent)e.type===`context`?(n+=e.lines,r+=e.lines):(n+=Math.max(e.additions,e.deletions),r+=e.additions+e.deletions);let i=t.additionCount===0?t.additionStart-1:t.additionStart,a=t.deletionCount===0?t.deletionStart-1:t.deletionStart,o=Math.max(Cc(i,t.additionCount)-e.lastHunkEnd,0),s={collapsedBefore:o,additionStart:i,additionCount:t.additionCount,additionLines:t.additionLines,additionLineIndex:t.additionLineIndex,deletionStart:a,deletionCount:t.deletionCount,deletionLines:t.deletionLines,deletionLineIndex:t.deletionLineIndex,hunkContent:t.hunkContent,hunkContext:void 0,hunkSpecs:`@@ -${up(a,t.deletionCount)} +${up(i,t.additionCount)} @@\n`,splitLineStart:e.splitLineCount+o,splitLineCount:n,unifiedLineStart:e.unifiedLineCount+o,unifiedLineCount:r,noEOFCRAdditions:!1,noEOFCRDeletions:!1};e.hunks.push(s),e.splitLineCount+=o+n,e.unifiedLineCount+=o+r,e.lastHunkEnd=q(i,t.additionCount)}function ip(e){if(e.activeHunk==null)return;let t=e.activeHunk,n=t.contextBufferCount,r=n-e.maxContextLines2,i=t.contextBufferAdditionStart+n-e.maxContextLines,a=t.contextBufferDeletionStart+n-e.maxContextLines,o;if(t.contextBufferBaseConflicts!=null){let r=n-e.maxContextLines;for(let[e,n]of t.contextBufferBaseConflicts)e>=r&&(o??=new Map,o.set(e-r,n))}np(e,t,`trailing`);let s=t.additionCount,c=t.deletionCount;rp(e),e.activeHunk=lp(t.additionStart+s+r,t.deletionStart+c+r),e.activeHunk.contextBufferAdditionStart=i,e.activeHunk.contextBufferDeletionStart=a,e.activeHunk.contextBufferCount=e.maxContextLines,e.activeHunk.contextBufferBaseConflicts=o}function ap(e,t,n=-1){let r=$f(e);r.contextBufferCount===0&&(r.contextBufferAdditionStart=e.additionLines.length,r.contextBufferDeletionStart=e.deletionLines.length),e.additionLines.push(t),e.deletionLines.push(t),n>=0&&(r.contextBufferBaseConflicts??=new Map,r.contextBufferBaseConflicts.set(r.contextBufferCount,n)),r.contextBufferCount++}function op(e,t,n,r,i){let a=$f(e);a.hunkContent.length>0&&a.contextBufferCount>e.maxContextLines2&&(ip(e),a=e.activeHunk),np(e,a,a.hunkContent.length===0?`leading`:`before-change`);let o=e.additionLines.length,s=e.deletionLines.length;t===`addition`?e.additionLines.push(n):e.deletionLines.push(n);let c=tp(a,t,o,s);t===`addition`?(a.additionCount++,a.additionLines++):(a.deletionCount++,a.deletionLines++),ep(e,r,i,c)}function sp(e,t,n,r){if(t.separatorLineIndex==null||t.markerLines.separator==null)throw Error(`parseMergeConflictDiffFromFile: conflict ${t.conflictIndex} is missing a separator marker`);let i=e.conflictBuilders[t.conflictIndex];if(i==null)throw Error(`parseMergeConflictDiffFromFile: failed to finalize conflict ${t.conflictIndex}`);let a=i.action;a.markerLines.separator=t.markerLines.separator,a.markerLines.end=r,t.markerLines.base!=null&&(a.markerLines.base=t.markerLines.base),a.conflict={conflictIndex:t.conflictIndex,startLineIndex:t.startLineIndex,startLineNumber:t.startLineIndex+1,separatorLineIndex:t.separatorLineIndex,separatorLineNumber:t.separatorLineIndex+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:t.baseMarkerLineIndex,baseMarkerLineNumber:t.baseMarkerLineIndex==null?void 0:t.baseMarkerLineIndex+1};let o=a.currentContentIndex??a.incomingContentIndex;if(a.currentContentIndex??=o,a.incomingContentIndex??=o,a.startContentIndex<0&&o!=null&&(a.startContentIndex=o),a.endContentIndex<0&&o!=null&&(a.endContentIndex=o),a.endMarkerContentIndex<0&&o!=null&&(a.endMarkerContentIndex=o),a.hunkIndex<0||a.startContentIndex<0||a.endContentIndex<0||a.endMarkerContentIndex<0)throw Error(`parseMergeConflictDiffFromFile: failed to anchor merge conflict ${t.conflictIndex}`);e.actions[a.conflictIndex]=a,i.completed=!0}function cp(e,t,n){let r=e.nextConflictIndex;e.nextConflictIndex++,e.conflictStack.push({conflictIndex:r,stage:`current`,startLineIndex:n,markerLines:{start:t}}),e.conflictBuilders[r]={completed:!1,action:{conflict:{conflictIndex:r,startLineIndex:n,startLineNumber:n+1,separatorLineIndex:n,separatorLineNumber:n+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:void 0,baseMarkerLineNumber:void 0},conflictIndex:r,hunkIndex:-1,startContentIndex:-1,endContentIndex:-1,endMarkerContentIndex:-1,markerLines:{start:t,separator:``,end:``}}}}function lp(e,t){return{additionStart:e,deletionStart:t,additionCount:0,deletionCount:0,additionLines:0,deletionLines:0,additionLineIndex:Math.max(e-1,0),deletionLineIndex:Math.max(t-1,0),hunkContent:[],contextBufferAdditionStart:Math.max(e-1,0),contextBufferDeletionStart:Math.max(t-1,0),contextBufferCount:0,contextBufferBaseConflicts:void 0}}function up(e,t){return t===1?`${e}`:`${e},${t}`}function dp(e){if(e.length<7)return;let t=e.charCodeAt(0);if(t!==60&&t!==62&&t!==61&&t!==124)return;let n=fp(e);if(n<7)return;let r=1;for(;r<n&&e.charCodeAt(r)===t;)r++;if(!(r<7)){if(t===61)return r===n?`separator`:void 0;if(!(r!==n&&!pp(e.charCodeAt(r))))return t===60?`start`:t===62?`end`:`base`}}function fp(e){let t=e.length;return t>0&&e.charCodeAt(t-1)===10&&t--,t>0&&e.charCodeAt(t-1)===13&&t--,t}function pp(e){return e===9||e===10||e===11||e===12||e===13||e===32}function mp(e,t,n){return{...e,contents:n,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:merge-conflict-${t}`}}function hp(e,t){let n=[],r=Array(e.hunks.length),i=(t,n)=>{let i=e.hunks[t];if(i==null)return 0;let a=r[t];if(a==null){a=Array(i.hunkContent.length+1);let e=i.unifiedLineStart;a[0]=e;for(let t=0;t<i.hunkContent.length;t++){let n=i.hunkContent[t];e+=n.type===`context`?n.lines:n.deletions+n.additions,a[t+1]=e}r[t]=a}return a[Math.max(n,0)]??i.unifiedLineStart},a=(e,t)=>{let n=i(e,t),a=r[e]?.[Math.max(t+1,0)]??i(e,t+1);return Math.max(n,a-1)};for(let r of t){if(r==null)continue;let t=e.hunks[r.hunkIndex];if(t==null)continue;let o=i(r.hunkIndex,r.startContentIndex);if(n.push(gp(r,`marker-start`,r.startContentIndex,r.markerLines.start,o)),r.baseContentIndex!=null){let e=r.currentContentIndex,o=r.incomingContentIndex;if(e==null||o==null)continue;let s=r.markerLines.base;if(s==null)continue;let c=t.hunkContent[e],l=t.hunkContent[r.baseContentIndex],u=t.hunkContent[o];if(c?.type!==`change`||l?.type!==`context`||u?.type!==`change`)continue;let d=i(r.hunkIndex,e),f=i(r.hunkIndex,o);n.push(gp(r,`marker-base`,r.baseContentIndex,s,d+c.deletions)),n.push(gp(r,`marker-separator`,r.baseContentIndex,r.markerLines.separator,f),gp(r,`marker-end`,r.endMarkerContentIndex,r.markerLines.end,a(r.hunkIndex,r.endMarkerContentIndex)));continue}let s=r.currentContentIndex;if(s==null)continue;let c=t.hunkContent[s];if(c?.type!==`change`)continue;let l=i(r.hunkIndex,s),u=c.deletions>0?l+c.deletions:o;n.push(gp(r,`marker-separator`,s,r.markerLines.separator,u),gp(r,`marker-end`,r.endMarkerContentIndex,r.markerLines.end,a(r.hunkIndex,r.endMarkerContentIndex)))}return n}function gp(e,t,n,r,i){return{type:t,hunkIndex:e.hunkIndex,contentIndex:n,conflictIndex:e.conflictIndex,lineText:r,lineIndex:i}}function _p(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}var vp=class extends td{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:j},t,n,r){super(void 0,t,n,r),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(let t of e){let e=t==null?void 0:Xf(t,n);if(t==null||e==null)continue;let r={type:`actions`,hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(r)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=de){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=de){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":``})}getUnifiedLineDecoration({type:e,lineType:t}){let n=e===`change`?t===`change-deletion`?`current`:`incoming`:void 0;return{gutterLineType:e===`change`?`context`:t,gutterProperties:yp(n),contentProperties:bp(e,n)}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`current`:`incoming`:void 0;return{gutterLineType:t===`change`?`context`:t,gutterProperties:yp(n),contentProperties:bp(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),r=[],i=[];for(let e of t){if(e.type===`actions`){r.push({content:Sp({row:e,includeDefaultActions:n==="default",includeSlot:!0}),gutter:xp(`action`)});continue}(e.type===`marker-end`?i:r).push({content:Cp(e),gutter:xp(`marker`,e.type)})}return{before:r.length>0?r:void 0,after:i.length>0?i:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle=`unified`,e.lineDiffType=`none`,e.mergeConflictActionsType=this.options.mergeConflictActionsType??`default`,e}};function yp(e){return e==null?void 0:{"data-merge-conflict":e}}function bp(e,t){if(t!=null){if(e===`change`)return t===`current`||t===`incoming`?{"data-line-type":`context`,"data-merge-conflict":t}:void 0;if(t===`marker-start`||t===`marker-base`||t===`marker-separator`||t===`marker-end`)return{"data-merge-conflict":t}}}function xp(e,t){let n=H(void 0,`annotation`,1);return n.properties[`data-gutter-buffer`]=e===`action`?`merge-conflict-action`:`merge-conflict-${t??`marker`}`,n}function Sp({row:e,includeDefaultActions:t,includeSlot:n}){let r=t?wp(e.conflictIndex):[];return n&&r.push(V({tagName:`slot`,properties:{name:Yf({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":``}})),V({tagName:`div`,properties:{"data-merge-conflict-actions":``},children:[V({tagName:`div`,properties:{"data-merge-conflict-actions-content":``},children:r})]})}function Cp(e){return V({tagName:`div`,properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":``},children:[B(e.lineText.replace(/(?:\r\n|\n|\r)$/,``))]})}function wp(e){return[Tp({resolution:`current`,label:`Accept current change`,conflictIndex:e}),Ep(),Tp({resolution:`incoming`,label:`Accept incoming change`,conflictIndex:e}),Ep(),Tp({resolution:`both`,label:`Accept both`,conflictIndex:e})]}function Tp({resolution:e,label:t,conflictIndex:n}){return V({tagName:`button`,properties:{type:`button`,"data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[B(t)]})}function Ep(){return V({tagName:`span`,properties:{"data-merge-conflict-action-separator":``},children:[B(`|`)]})}function Dp(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&Op(e.conflict,t.conflict)}function Op(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}var kp=-1,Ap=class extends Ed{options;__id=`unresolved-file:${++kp}`;type=`unresolved-file`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:j},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw Error(`UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.`);this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(ja(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new vp(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return zp(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":``})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:r}){let{maxContextLines:i,onMergeConflictAction:a}=this.options;wrapper:{if(a!=null){let a=t!=null;if(a!==(n!=null)||a!==(r!=null))throw Error(`UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together`);if(t!=null&&n!=null&&r!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:r};break wrapper}if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!bc(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw Error(`UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.`);if(e??=this.computedCache.file,e==null)throw Error(`UnresolvedFile.getOrComputeDiff: file is null, should be impossible`);if(!bc(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){let t=Zf(e,i);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(t!=null||n!=null||r!=null)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!bc(e,this.computedCache.file))throw Error(`UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.`);if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){let e=Zf(this.computedCache.file,i);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(t!=null&&n!=null&&r!=null)return{fileDiff:t,actions:n,markerRows:r}}hydrate(e){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,fileContainer:o,prerenderedHTML:s,preventEmit:c=!1}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});l!=null&&(this.hydrateElements(o,s),this.setActiveMergeConflictState(l.actions,l.markerRows),Lp(this.pre,l.fileDiff,this.options.collapsed)||Rp(this.headerElement,l.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:l.fileDiff,lineAnnotations:a}),this.pre!=null&&this.renderMergeConflictActionSlots()),c||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,preventEmit:o=!1,...s}=e,c=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});if(c==null)return!1;this.setActiveMergeConflictState(c.actions,c.markerRows);let l=super.render({...s,fileDiff:c.fileDiff,lineAnnotations:a,preventEmit:!0});return l&&(this.renderMergeConflictActionSlots(),o||this.emitPostRender()),l}resolveConflict(e,t,n=this.computedCache.fileDiff){let r=this.conflictActions[e];if(n==null||r==null)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),Error(`UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match`);let i=qf(n,r,t),a=this.computedCache.file,{file:o,actions:s,markerRows:c}=jp({fileDiff:i,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:a,resolution:t});return{file:o,fileDiff:i,actions:s,markerRows:c}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error(`UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match`);let r={resolution:t,conflict:n.conflict},{file:i,fileDiff:a,actions:o,markerRows:s}=this.resolveConflict(e,t)??{};i!=null&&a!=null&&o!=null&&s!=null&&(this.computedCache={file:i,fileDiff:a,actions:o,markerRows:s},this.setActiveMergeConflictState(o,s),this.workerManager==null?this.render({forceRender:!0}):this.hunksRenderer.renderDiff(a),this.options.onMergeConflictResolve?.(i,r))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof vp&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType===`none`?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error(`UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match`);let n={resolution:e.resolution,conflict:t.conflict};if(this.options.onMergeConflictAction!=null){this.options.onMergeConflictAction(n,this);return}this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!=`function`||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}let t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){let r=this.conflictActions[n];if(r==null)continue;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),Error(`UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match`);let i=Xf(r,e);if(i==null)continue;let a=r.conflictIndex,o=Yf({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),s=`${n}-${o}`,c=this.conflictActionCache.get(s);if(c==null||!Dp(c.action,r)){c?.element.remove();let e=this.renderMergeConflictAction(r);if(e==null)continue;let t=Es(o);t.appendChild(e),this.fileContainer.appendChild(t),c={element:t,action:r},this.conflictActionCache.set(s,c)}t.delete(s)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!=`function`)return;let t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<`u`&&t instanceof DocumentFragment){let e=document.createElement(`div`);return e.style.display=`contents`,e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function jp({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:r,resolution:i}){let a=t[n];if(a==null)throw Error(`rebuildFileAndActions: missing resolved action for unresolved file rebuild`);let o=Pp(t,n,a,i),s=hp(e,o);return{file:Mp({fileDiff:e,resolvedAction:a,resolvedConflictIndex:n,previousFile:r,resolution:i}),actions:o,markerRows:s}}function Mp({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:r,resolution:i}){let a=Ec(n?.contents??``),{conflict:o}=e,s=Np(a,o,i),c=[...a.slice(0,o.startLineIndex),...s,...a.slice(o.endLineIndex+1)].join(``);return{name:n?.name??r.name,contents:c,cacheKey:n?.cacheKey==null?void 0:`${n.cacheKey}:mc-${t}-${i}`}}function Np(e,t,n){let r=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),i=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n===`current`?r:n===`incoming`?i:[...r,...i]}function Pp(e,t,n,r){let i=Fp(n.conflict,r);return e.map((e,r)=>{if(r!==t&&e!=null)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:Ip(e.conflict,i)}:e})}function Fp(e,t){let n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return(t===`current`?n:t===`incoming`?r:n+r)-(e.endLineIndex-e.startLineIndex+1)}function Ip(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex==null?void 0:e.baseMarkerLineIndex+t,baseMarkerLineNumber:e.baseMarkerLineNumber==null?void 0:e.baseMarkerLineNumber+t}}function Lp(e,t,n=!1){return!n&&e==null&&t!=null}function Rp(e,t,n=!1){return e==null&&t!=null&&!n}function zp(e,t){let n={...t,...e};return{...n,useTokenTransformer:Xs(n),hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType==`function`?`custom`:e?.mergeConflictActionsType}}function Bp(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var Vp=1e3,Hp=Vp*4,Up=[0,1e-6,.99999,1],Wp={overscrollSize:Vp,intersectionObserverMargin:Hp,resizeDebugging:!1},Gp=0,Kp=-1,qp=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Kp}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Wp,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Up,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),z(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),z(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),z(this.computeRenderRangeAndEmit)}requestHeightReconcile(e){this.reconcileQueue.add(e),z(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=xa({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,e-Gp,Gp=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,e-Gp,Gp=e))}t&&z(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){pa(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(e){return this.getScrollTop()+Jp(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),z(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.instancesChanged.delete(t),this.reconcileQueue.delete(t),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),z(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,z(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{e.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,z(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,z(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=xa({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&Bp(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)i.has(e)||e.onRender(t)&&i.add(e);this.scrollFix(r);for(let e of i)this.reconcileQueue.delete(e),e.reconcileHeights();for(let e of this.reconcileQueue)e.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&z(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=Jp(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=Jp(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=Jp(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=Jp(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&z(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=this.clampScrollTop(e),this.scrollTop=e,e}scrollTo({top:e,behavior:t=`auto`}){let{root:n}=this;if(n==null)return;let r=this.clampScrollTop(e);n instanceof Document?window.scrollTo({top:r,behavior:t}):n.scrollTo({top:r,behavior:t}),this.scrollDirty=!0,z(this.computeRenderRangeAndEmit)}clampScrollTop(e){return Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function Jp(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}function Yp(e){let t=[];for(let n of e){let e=pe.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function Xp(e){for(let t of Array.isArray(e)?e:[e])if(!pe.has(t))return!1;return!0}function Zp(e,t,n=[]){if(e===`text`||e===`ansi`)throw Error(`registerCustomLanguage: 'text' and 'ansi' are reserved language names`);if(he.has(e)){console.error(`registerCustomLanguage: lang: ${e} is already registered`);return}he.set(e,t);for(let t of n)xo(t,e)}async function Qp(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=_i(r)??gi(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function $p(e){return ji.getResolvedThemes(e)}function em(e,t){try{let n=Pi({name:e,load:t});ji.registerTheme(n.name,n.load)}catch(t){if(t instanceof Di){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}throw t}}function tm(e,t,n=!1){let r=kr({name:e,variablePrefix:W(`global`),variableDefaults:t,fontStyle:n});em(e,()=>Promise.resolve(r))}async function nm(e){for(let t of e)ea(t);let t=await ji.resolveThemes(e);for(let n=0;n<e.length;n++)ta(e[n],t[n]);return t}function rm(e){return`side`in e}function im(e){return!rm(e)}function am(e){let t=e[0];return t==null||rm(t)}function om(e){let t=e[0];return t==null||im(t)}function sm(e,t){return e==null||t==null?e===t:e.busyWorkers===t.busyWorkers&&e.diffCacheSize===t.diffCacheSize&&e.fileCacheSize===t.fileCacheSize&&e.managerState===t.managerState&&e.activeTasks===t.activeTasks&&e.queuedTasks===t.queuedTasks&&e.themeSubscribers===t.themeSubscribers&&e.totalWorkers===t.totalWorkers&&e.workersFailed===t.workersFailed}function cm(e){let t=document.createElement(`div`);t.dataset.line=`${e}`;let n=document.createElement(`div`);n.dataset.columnNumber=``,n.textContent=`${e}`;let r=document.createElement(`div`);return r.dataset.columnContent=``,t.appendChild(n),t.appendChild(r),{row:t,content:r}}function lm(e,t=!1){return V({tagName:`style`,children:[B(t?Fs(e):Is(e))],properties:{[ee]:t?``:void 0,[N]:t?void 0:``}})}function um(e){return V({tagName:`style`,children:[B(e)],properties:{[M]:``}})}function dm(e,t,n){let r=e.hunks[t];if(r==null)throw console.error({hunkIndex:t,diff:e}),Error(`diffAcceptRejectHunk: Invalid hunk index`);return Bf(e,{resolution:Kf(n),hunkIndex:t,...typeof n==`object`?{startContentIndex:n.changeIndex,endContentIndex:n.changeIndex}:{startContentIndex:0,endContentIndex:Math.max(0,(r.hunkContent.length??1)-1)}})}function fm(e){return e.includes(`\r
|
|
1377
|
+
`)?`CRLF`:e.includes(`\r`)?`CR`:e.includes(`
|
|
1378
|
+
`)?`LF`:`none`}function pm(e){let t=tl(e);if(t.length!==1)throw console.error(t),Error(`PatchDiff: Provided patch must include only 1 patch, with 1 diff`);let{files:n}=t[0];if(n.length!==1)throw console.error(n),Error(`FileDiff: Provided patch must contain exactly 1 file diff`);return n[0]}function mm(e){let t=e[0];if(t!==`+`&&t!==`-`&&t!==` `&&t!==`\\`){console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);return}let n=e.substring(1);return{line:n===``?`
|
|
1379
|
+
`:n,type:t===` `?`context`:t===`\\`?`metadata`:t===`+`?`addition`:`deletion`}}function hm(e,t){return{...e,lang:t}}function gm(e,t=10){let n=[],r;for(let i of e.split(`
|
|
1380
|
+
`)){let e=i.match(_);if(e!=null){r!=null&&(r.hunkLines.length>0&&(_m(r,t,`trailing`),vm(r,n)),r=void 0);let a=parseInt(e[3]),o=parseInt(e[1]),s=parseInt(e[4]??`1`),c=parseInt(e[2]??`1`);isNaN(a)||isNaN(o)||isNaN(s)||isNaN(c)?n.push(i):r={additionStart:a,deletionStart:o,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(r==null){n.push(i);continue}if(i.startsWith(` `))r.contextLines.push(i);else if(i!==``){if(r.hunkLines.length>0&&r.contextLines.length>t*2){let e=r.contextLines.length-t*2,i=r.contextLines.slice(-t);_m(r,t,`trailing`);let{additionCount:a,deletionCount:o}=r;vm(r,n),r={additionStart:r.additionStart+a+e,deletionStart:r.deletionStart+o+e,deletionCount:0,additionCount:0,contextLines:i,hunkLines:[]}}_m(r,t,r.hunkLines.length===0?`leading`:`before-change`),r.hunkLines.push(i),i.startsWith(`+`)?r.additionCount+=1:i.startsWith(`-`)&&(r.deletionCount+=1)}}r!=null&&r.hunkLines.length>0&&(_m(r,t,`trailing`),vm(r,n));let i=n.join(`
|
|
1381
|
+
`);return e.endsWith(`
|
|
1382
|
+
`)?`${i}\n`:i}function _m(e,t,n){if(n===`leading`&&e.contextLines.length>t){let n=e.contextLines.length-t;e.contextLines.splice(0,n),e.additionStart+=n,e.deletionStart+=n}return n===`trailing`&&e.contextLines.length>t&&(e.contextLines.length=t),e.contextLines.length>0&&(as(e.hunkLines,e.contextLines),e.additionCount+=e.contextLines.length,e.deletionCount+=e.contextLines.length,e.contextLines.length=0),e}function vm(e,t){t.push(`@@ -${ym(e.deletionStart,e.deletionCount)} +${ym(e.additionStart,e.additionCount)} @@`),as(t,e.hunkLines)}function ym(e,t){return t===1?`${e}`:`${e},${t}`}var bm=t({ALTERNATE_FILE_NAMES_GIT:()=>x,AttachedLanguages:()=>ge,AttachedThemes:()=>yi,CODE_VIEW_DIFF_OPTION_KEYS:()=>af,CODE_VIEW_FILE_OPTION_KEYS:()=>of,CODE_VIEW_FOOTER_ATTRIBUTE:()=>re,CODE_VIEW_HEADER_ATTRIBUTE:()=>ne,COMMIT_METADATA_SPLIT:()=>p,CORE_CSS_ATTRIBUTE:()=>ee,CUSTOM_HEADER_SLOT_ID:()=>A,CodeToTokenTransformStream:()=>If,CodeView:()=>Cf,DEFAULT_CODE_VIEW_FILE_METRICS:()=>se,DEFAULT_CODE_VIEW_LAYOUT:()=>ce,DEFAULT_COLLAPSED_CONTEXT_THRESHOLD:()=>1,DEFAULT_EXPANDED_REGION:()=>ue,DEFAULT_RENDER_RANGE:()=>de,DEFAULT_SMOOTH_SCROLL_SETTINGS:()=>le,DEFAULT_THEMES:()=>j,DEFAULT_TOKENIZE_MAX_LENGTH:()=>ae,DEFAULT_VIRTUAL_FILE_METRICS:()=>oe,DIFFS_DEVELOPMENT_BUILD:()=>f,DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY:()=>ie,DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE:()=>te,DIFFS_TAG_NAME:()=>d,DiffHunksRenderer:()=>td,EMPTY_RENDER_RANGE:()=>fe,EXTENSION_TO_FILE_FORMAT:()=>vo,FILENAME_HEADER_REGEX:()=>y,FILENAME_HEADER_REGEX_GIT:()=>b,FILE_CONTEXT_BLOB:()=>g,File:()=>oc,FileDiff:()=>Ed,FileRenderer:()=>ys,FileStream:()=>zf,GIT_DIFF_FILE_BREAK_REGEX:()=>m,HEADER_FILENAME_SUFFIX_SLOT_ID:()=>O,HEADER_METADATA_SLOT_ID:()=>k,HEADER_PREFIX_SLOT_ID:()=>D,HUNK_HEADER:()=>_,INDEX_LINE_METADATA:()=>S,InteractionManager:()=>Aa,MERGE_CONFLICT_BASE_MARKER_REGEX:()=>w,MERGE_CONFLICT_END_MARKER_REGEX:()=>E,MERGE_CONFLICT_SEPARATOR_MARKER_REGEX:()=>T,MERGE_CONFLICT_START_MARKER_REGEX:()=>C,RegisteredCustomLanguages:()=>he,ResizeManager:()=>Za,ResolvedLanguages:()=>pe,ResolvingLanguages:()=>me,SPLIT_WITH_NEWLINES:()=>v,SVGSpriteSheet:()=>xs,ScrollSyncManager:()=>El,ShikiStreamTokenizer:()=>Ff,THEME_CSS_ATTRIBUTE:()=>M,UNIFIED_DIFF_FILE_BREAK_REGEX:()=>h,UNSAFE_CSS_ATTRIBUTE:()=>N,UnresolvedFile:()=>Ap,VIRTUALIZED_FILE_DIFF_LAYOUT_CHECKPOINT_INTERVAL:()=>Ld,VirtualizedFile:()=>vc,VirtualizedFileDiff:()=>Bd,Virtualizer:()=>qp,areDiffLineAnnotationsEqual:()=>hd,areDiffRenderOptionsEqual:()=>Dl,areDiffTargetsEqual:()=>K,areFileRenderOptionsEqual:()=>oo,areFilesEqual:()=>bc,areHunkDataEqual:()=>gd,areLanguagesAttached:()=>_e,areLineAnnotationsEqual:()=>Ss,areObjectsEqual:()=>ga,areOptionsEqual:()=>va,arePrePropertiesEqual:()=>Cs,areRenderRangesEqual:()=>so,areSelectionsEqual:()=>ba,areThemesAttached:()=>bi,areThemesEqual:()=>_a,areVirtualWindowSpecsEqual:()=>Bp,areWorkerStatsEqual:()=>sm,attachResolvedLanguages:()=>ve,attachResolvedThemes:()=>Mi,cleanLastNewline:()=>Ic,cleanUpResolvedLanguages:()=>ye,cleanUpResolvedThemes:()=>Ni,clearRenderQueue:()=>ma,cloneFileDiffMetadata:()=>Sc,cloneHunks:()=>xc,codeToHtml:()=>ai,createAnnotationElement:()=>co,createAnnotationWrapperNode:()=>Es,createCSSVariablesTheme:()=>kr,createDiffSpanDecoration:()=>Pl,createEmptyRowBuffer:()=>Ol,createFileHeaderElement:()=>uo,createGutterGap:()=>H,createGutterItem:()=>Ea,createGutterUtilityContentNode:()=>Ds,createGutterUtilityElement:()=>Da,createGutterWrapper:()=>Ta,createHastElement:()=>V,createIconElement:()=>Ca,createNoNewlineElement:()=>kl,createPreElement:()=>mo,createPreWrapperProperties:()=>ho,createRowNodes:()=>cm,createSeparator:()=>jl,createSpanFromToken:()=>Lf,createStyleElement:()=>lm,createTextNodeElement:()=>B,createThemeStyleElement:()=>um,createTransformerWithState:()=>Fo,createUnsafeCSSStyleNode:()=>Os,createWindowFromScrollPosition:()=>xa,dequeueRender:()=>pa,detachString:()=>J,diffAcceptRejectHunk:()=>dm,disposeHighlighter:()=>ua,findCodeElement:()=>wa,formatCSSVariablePrefix:()=>W,getCustomExtensionsMap:()=>So,getCustomExtensionsVersion:()=>bo,getFiletypeFromFileName:()=>U,getHighlighterIfLoaded:()=>oa,getHighlighterOptions:()=>Co,getHighlighterThemeStyles:()=>Xo,getHunkSeparatorSlotName:()=>Ml,getIconForType:()=>lo,getLineAnnotationName:()=>wo,getLineAnnotationSource:()=>Vs,getLineEndingType:()=>fm,getLineNodes:()=>Qo,getOrCreateCodeNode:()=>Us,getResolvedLanguages:()=>Yp,getResolvedOrResolveLanguage:()=>_i,getResolvedOrResolveTheme:()=>ra,getResolvedThemes:()=>$p,getSharedHighlighter:()=>ia,getSingularPatch:()=>pm,getThemes:()=>vi,getTotalLineCountFromHunks:()=>Nl,getUnresolvedDiffHunksRendererOptions:()=>zp,hasResolvedLanguages:()=>Xp,hasResolvedThemes:()=>ao,hydratePartialDiff:()=>Dc,isDefaultRenderRange:()=>To,isDiffAnnotation:()=>rm,isDiffAnnotationCollection:()=>am,isFileAnnotation:()=>im,isFileAnnotationCollection:()=>om,isHighlighterLoaded:()=>aa,isHighlighterLoading:()=>sa,isHighlighterNull:()=>ca,isWorkerContext:()=>be,parseDiffFromFile:()=>wl,parseLineType:()=>mm,parsePatchFiles:()=>tl,patchScrollbarGutterSize:()=>Rs,pluckInteractionOptions:()=>ja,prefersReducedMotion:()=>Sa,preloadHighlighter:()=>la,prerenderHTMLIfNecessary:()=>Ws,processFile:()=>$c,processLine:()=>Eo,processPatch:()=>Zc,pushOrJoinSpan:()=>Fl,queueRender:()=>z,recordLineAnnotationSource:()=>Hs,registerCustomCSSVariableTheme:()=>tm,registerCustomLanguage:()=>Zp,registerCustomTheme:()=>em,releaseStringDetachBuffer:()=>Hc,renderDiffWithHighlighter:()=>ru,renderFileWithHighlighter:()=>ss,replaceCustomExtensions:()=>yo,resolveConflict:()=>qf,resolveLanguage:()=>gi,resolveLanguages:()=>Qp,resolveRegion:()=>Bf,resolveTheme:()=>na,resolveThemes:()=>nm,setCustomExtension:()=>xo,setLanguageOverride:()=>hm,setPreNodeProperties:()=>Gs,trimPatchContext:()=>gm,wrapCoreCSS:()=>Fs,wrapThemeCSS:()=>Ls,wrapUnsafeCSS:()=>Is}),xm={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Sm={display:`contents`};function Cm(){return null}var wm=`diffs-container`,Tm=/(?=^From [a-f0-9]+ .+$)/m,Em=/(?=^diff --git)/gm,Dm=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,Om=/(?<=\n)/,km=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Am=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,jm=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Mm=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Nm=`header-prefix`,Pm=`header-filename-suffix`,Fm=`header-metadata`,Im=`header-custom`,Y={dark:`pierre-dark`,light:`pierre-light`},Lm=`data-theme-css`,Rm=`data-unsafe-css`,zm=`data-diffs-scrollbar-measure`,Bm=`--diffs-scrollbar-gutter-measured`,Vm=1e5,Hm={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...Hm});var Um=Object.freeze({fromStart:0,fromEnd:0}),Wm={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Gm={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function Km(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}var X=e(r(),1),Z=n();function qm({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function Jm(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Ym(n,e.startContentIndex)}}function Ym(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function Xm({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d}){let f=n?.(e),p=r?.(e),m=i?.(e),h=a?.(e);return(0,Z.jsxs)(Z.Fragment,{children:[f==null?(0,Z.jsxs)(Z.Fragment,{children:[p!=null&&(0,Z.jsx)(`div`,{slot:`header-prefix`,children:p}),m!=null&&(0,Z.jsx)(`div`,{slot:`header-filename-suffix`,children:m}),h!=null&&(0,Z.jsx)(`div`,{slot:`header-metadata`,children:h})]}):(0,Z.jsx)(`div`,{slot:Im,children:f}),o!=null&&l?.map((e,t)=>(0,Z.jsx)(`div`,{slot:Km(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Zm(t,e);return(0,Z.jsx)(`div`,{slot:n,style:Sm,children:c(t,d)},n)}),s!=null&&(0,Z.jsx)(`div`,{slot:`gutter-utility-slot`,style:xm,children:s(u)})]})}function Zm(e,t){let n=Jm(e,t);return n==null?void 0:qm({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function Qm({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c}){let l=t?.(e),u=n?.(e),d=r?.(e),f=i?.(e);return(0,Z.jsxs)(Z.Fragment,{children:[l==null?(0,Z.jsxs)(Z.Fragment,{children:[u!=null&&(0,Z.jsx)(`div`,{slot:`header-prefix`,children:u}),d!=null&&(0,Z.jsx)(`div`,{slot:`header-filename-suffix`,children:d}),f!=null&&(0,Z.jsx)(`div`,{slot:`header-metadata`,children:f})]}):(0,Z.jsx)(`div`,{slot:Im,children:l}),a!=null&&o?.map((e,t)=>(0,Z.jsx)(`div`,{slot:Km(e),children:a(e)},t)),s!=null&&(0,Z.jsx)(`div`,{slot:`gutter-utility-slot`,style:xm,children:s(c)})]})}function $m(e){let t=(0,X.useRef)(e);return(0,X.useInsertionEffect)(()=>void(t.current=e)),(0,X.useCallback)((...e)=>t.current(...e),[])}function eh(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function th(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var nh=new Set;function rh(e){let t=[],n=new Set;for(let r of ih(e.themes)){let e=sh(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return rh({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return rh({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function ih(e){return ah(e)?[e]:e}function ah(e){return sh(e)||oh(e)}function oh(e){return typeof e.name==`string`&&typeof e.load==`function`}function sh(e){return typeof e.getThemes==`function`}function ch(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var lh=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},uh=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},dh=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function fh(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new lh(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new uh(i));let c=r,l=s().then(e=>{let a=ch(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new dh(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var ph=fh();function mh(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=ph.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,ph.getResolvedTheme(n)??ph.seedResolvedTheme(n,e);nh.has(n)||(nh.add(n),t.loadThemeSync(e))}}var hh=new Map,gh=new Map,_h=new Map,vh=new Set;function yh(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(vh.has(n.name))continue;let e=hh.get(n.name);e??(e=n,hh.set(n.name,e)),vh.add(e.name),t.loadLanguageSync(e.data)}}function bh(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}async function xh(e){if(bh())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=gh.get(e);if(t!=null)return t;try{let t=_h.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Nr,e)&&(t=Nr[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return hh.has(e)||hh.set(e,n),n});return gh.set(e,n),await n}finally{gh.delete(e)}}function Sh(e){return hh.get(e)??xh(e)}function Ch({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:wh(t)}}function wh(e){return async()=>pr(ch(await e()))}var Th=`pierre`,Eh=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Dh=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Oh=[...Dh,...Eh],kh=new Set(Dh);function Ah(e){return kh.has(e)?`light`:`dark`}var jh={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},Mh={"pierre-dark":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.g),__vite__mapDeps([4,1])),"pierre-dark-soft":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.y),__vite__mapDeps([4,1])),"pierre-dark-vibrant":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e._),__vite__mapDeps([4,1])),"pierre-dark-protanopia-deuteranopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.b),__vite__mapDeps([4,1])),"pierre-dark-tritanopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.v),__vite__mapDeps([4,1])),"pierre-light":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.d),__vite__mapDeps([4,1])),"pierre-light-soft":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.m),__vite__mapDeps([4,1])),"pierre-light-vibrant":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.f),__vite__mapDeps([4,1])),"pierre-light-protanopia-deuteranopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.h),__vite__mapDeps([4,1])),"pierre-light-tritanopia":()=>i(()=>import(`./vendor-pierre-theme-D9JzKBPc.js`).then(e=>e.p),__vite__mapDeps([4,1]))};function Nh(e){return Ch({name:e,collection:Th,colorScheme:Ah(e),displayName:jh[e],load:Mh[e]})}var Ph=rh({themes:Oh.map(e=>Nh(e))}),Fh=`shiki`,Ih=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],Lh=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),Rh=new Set(Ih);function zh(e){return Rh.has(e)?`light`:`dark`}var Bh={andromeeda:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.dt),__vite__mapDeps([2,1])),"aurora-x":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ut),__vite__mapDeps([2,1])),"ayu-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.lt),__vite__mapDeps([2,1])),"ayu-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ct),__vite__mapDeps([2,1])),"ayu-mirage":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.st),__vite__mapDeps([2,1])),"catppuccin-frappe":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.ot),__vite__mapDeps([2,1])),"catppuccin-latte":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.at),__vite__mapDeps([2,1])),"catppuccin-macchiato":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.it),__vite__mapDeps([2,1])),"catppuccin-mocha":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.rt),__vite__mapDeps([2,1])),"dark-plus":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.nt),__vite__mapDeps([2,1])),dracula:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.et),__vite__mapDeps([2,1])),"dracula-soft":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.tt),__vite__mapDeps([2,1])),"everforest-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.$),__vite__mapDeps([2,1])),"everforest-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Q),__vite__mapDeps([2,1])),"github-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.J),__vite__mapDeps([2,1])),"github-dark-default":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Z),__vite__mapDeps([2,1])),"github-dark-dimmed":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.X),__vite__mapDeps([2,1])),"github-dark-high-contrast":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.Y),__vite__mapDeps([2,1])),"github-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.G),__vite__mapDeps([2,1])),"github-light-default":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.q),__vite__mapDeps([2,1])),"github-light-high-contrast":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.K),__vite__mapDeps([2,1])),"gruvbox-dark-hard":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.W),__vite__mapDeps([2,1])),"gruvbox-dark-medium":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.U),__vite__mapDeps([2,1])),"gruvbox-dark-soft":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.H),__vite__mapDeps([2,1])),"gruvbox-light-hard":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.V),__vite__mapDeps([2,1])),"gruvbox-light-medium":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.B),__vite__mapDeps([2,1])),"gruvbox-light-soft":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.z),__vite__mapDeps([2,1])),horizon:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.L),__vite__mapDeps([2,1])),"horizon-bright":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.R),__vite__mapDeps([2,1])),houston:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.I),__vite__mapDeps([2,1])),"kanagawa-dragon":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.F),__vite__mapDeps([2,1])),"kanagawa-lotus":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.P),__vite__mapDeps([2,1])),"kanagawa-wave":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.N),__vite__mapDeps([2,1])),laserwave:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.M),__vite__mapDeps([2,1])),"light-plus":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.j),__vite__mapDeps([2,1])),"material-theme":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.E),__vite__mapDeps([2,1])),"material-theme-darker":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.A),__vite__mapDeps([2,1])),"material-theme-lighter":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.k),__vite__mapDeps([2,1])),"material-theme-ocean":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.O),__vite__mapDeps([2,1])),"material-theme-palenight":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.D),__vite__mapDeps([2,1])),"min-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.T),__vite__mapDeps([2,1])),"min-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.w),__vite__mapDeps([2,1])),monokai:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.C),__vite__mapDeps([2,1])),"night-owl":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.x),__vite__mapDeps([2,1])),"night-owl-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.S),__vite__mapDeps([2,1])),nord:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.b),__vite__mapDeps([2,1])),"one-dark-pro":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.y),__vite__mapDeps([2,1])),"one-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.v),__vite__mapDeps([2,1])),plastic:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e._),__vite__mapDeps([2,1])),poimandres:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.g),__vite__mapDeps([2,1])),red:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.h),__vite__mapDeps([2,1])),"rose-pine":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.f),__vite__mapDeps([2,1])),"rose-pine-dawn":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.m),__vite__mapDeps([2,1])),"rose-pine-moon":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.p),__vite__mapDeps([2,1])),"slack-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.d),__vite__mapDeps([2,1])),"slack-ochin":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.u),__vite__mapDeps([2,1])),"snazzy-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.l),__vite__mapDeps([2,1])),"solarized-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.c),__vite__mapDeps([2,1])),"solarized-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.s),__vite__mapDeps([2,1])),"synthwave-84":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.o),__vite__mapDeps([2,1])),"tokyo-night":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.a),__vite__mapDeps([2,1])),vesper:()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.i),__vite__mapDeps([2,1])),"vitesse-black":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.r),__vite__mapDeps([2,1])),"vitesse-dark":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.n),__vite__mapDeps([2,1])),"vitesse-light":()=>i(()=>import(`./vendor-shikijs-themes-C7F1vBnG.js`).then(e=>e.t),__vite__mapDeps([2,1]))};function Vh(e){return Ch({name:e,collection:Fh,colorScheme:zh(e),load:Bh[e]})}var Hh=rh({themes:Object.freeze([...Ih.map(e=>Vh(e)),...Lh.map(e=>Vh(e))])});function Uh(e){if(bh())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(ph.hasRegisteredTheme(e))return;let t=Hh.getTheme(e);if(t!=null){ph.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function Wh(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Gh(e){Uh(e);let t=await ph.resolveTheme(e);return Wh(e,t),t}function Kh(e){return ph.getResolvedTheme(e)??Gh(e)}var qh;async function Jh({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){qh??=ii({themes:[],langs:[`text`],engine:n===`shiki-wasm`?ri(i(()=>import(`./vendor-shiki-DzFPeSWm.js`).then(e=>e.t),__vite__mapDeps([3,1]))):hi()});let r=Xh(qh)?await qh:qh;qh=r;let a=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Sh(e);`then`in t?a.push(t):yh(t,r)}let o=[];for(let t of e){let e=Kh(t);`then`in e?o.push(e):mh(e,qh)}return(a.length>0||o.length>0)&&await Promise.all([Promise.all(a).then(e=>{yh(e,r)}),Promise.all(o).then(e=>{mh(e,r)})]),r}function Yh(){if(qh!=null&&!(`then`in qh))return qh}function Xh(e=qh){return e!=null&&`then`in e}for(let e of Ph.getThemes())ph.registerThemeIfAbsent(e.name,e.load);function Zh(e=Y){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Qh(e){return ph.hasResolvedThemes(e)}function $h(e,t){return eh(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var eg=new Map,tg=0,ng={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function rg(e){if(eg.has(e))return eg.get(e)??`text`;if(ng[e]!=null)return ng[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(eg.has(t[1]))return eg.get(t[1])??`text`;if(ng[t[1]]!=null)return ng[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return eg.has(n)?eg.get(n)??`text`:ng[n]??`text`}function ig(){return tg}function ag(){return Object.fromEntries(eg)}function og(e){return(e.lang??rg(e.name))===`text`}var sg=10,cg=13;function lg(e){let t=[0];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===sg||r===cg)&&(r===cg&&n+1<e.length&&e.charCodeAt(n+1)===sg&&n++,t.push(n+1))}return t}function ug(e){let t=lg(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}function dg(e){return{type:`text`,value:e}}function Q({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function fg({name:e,width:t=16,height:n=16,properties:r}){return Q({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[Q({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function pg(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function mg(e){return Q({tagName:`div`,properties:{"data-gutter":``},children:e})}function hg(e,t,n,r={}){return Q({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[Q({tagName:`span`,properties:{"data-line-number-content":``},children:[dg(`${t}`)]})]})}function gg(e,t,n){return Q({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function _g(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(dg(`
|
|
1383
|
+
`)),e}var vg=Symbol(`no-token`),yg=Symbol(`multiple-tokens`);function bg(e){let t=xg(e);if(t!=null)return t;let n=vg,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Cg(e,a);for(let t of e.children)Sg(t)}else Sg(e);r.push(e),i=[],a=void 0;return}for(let e of i)Sg(e);r.push(Q({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==vg){if(e===yg){n=yg;return}if(n===vg){n=e;return}n!==e&&(n=yg)}};for(let t of e.children){let e=t.type===`element`?bg(t):vg;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function xg(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Sg(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Sg(t)}}function Cg(e,t){e.properties[`data-char`]=t}function wg(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=pg(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&bg(a),i.push(_g(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Eg,Tg),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Tg}}var Tg=No({classPrefix:`hl-`}),Eg={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Dg(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Og=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,kg=/^0(?:\.0+)?%?$/;function Ag(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function jg(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Mg(e){if(e==null)return null;let t=jg(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Ng(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Og.test(t))return!0;let n=Ag(t);return n!=null&&kg.test(n)}function Pg(e,t,n){if(t==null||n==null)return!1;let r=Mg(e),i=Mg(t),a=Mg(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Fg=new WeakMap;function Ig(e){let t=Fg.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;Lg(r,`editor.background`,i),Lg(r,`editor.foreground`,a),Lg(r,`sideBar.background`,o),Lg(r,`sideBar.foreground`,s),Lg(r,`input.background`,n[`input.background`]??o),Lg(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),Lg(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),Lg(r,`gitDecoration.addedResourceForeground`,Rg(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),Lg(r,`gitDecoration.modifiedResourceForeground`,Rg(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),Lg(r,`gitDecoration.deletedResourceForeground`,Rg(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Ng(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Ng(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(zg(l,o)||Pg(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Fg.set(e,u),u}function Lg(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Rg(...e){for(let t of e)if(t!=null&&t!==``)return t}function zg(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Bg({theme:e=Y,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Ig(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Dg(`global`)}fg:${a.fg};`,r+=`${Dg(`global`)}bg:${a.bg};`,r+=Vg(i,n)}else{let n=t.getTheme(e.dark),i=Ig(n);r+=`${Dg(`global`)}dark:${i.fg};`,r+=`${Dg(`global`)}dark-bg:${i.bg};`,r+=Vg(n,`dark`),n=t.getTheme(e.light),i=Ig(n),r+=`${Dg(`global`)}light:${i.fg};`,r+=`${Dg(`global`)}light-bg:${i.bg};`,r+=Vg(n,`light`)}return r}function Vg(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Dg(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Dg(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Dg(`global`)}${t}modified-color:${a};`),n}function Hg(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var Ug={forcePlainText:!1};function Wg(e,t,{theme:n=Y,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=Ug){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=wg(i),f=a?`text`:e.lang??rg(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Bg({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Dg(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Dg(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Hg(t.codeToHast(l?Gg(c??ug(e.contents),o,s):e.contents,h)),_=l?Array(o):g;return l&&_.push(...g),{code:_,themeStyles:m,baseThemeType:p}}function Gg(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function Kg(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function qg(e,t){return eh(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Jg(e){let t=e.lang??rg(e.name),n=e.lang??(e.prevName==null?`text`:rg(e.prevName));return t===`text`&&n===`text`}function Yg(e){return{...Hm,...e}}function Xg(e,t){let n=Zg(e,t);return t?n:e.diffHeaderHeight+n}function Zg(e,t){return e.paddingTop??(t?e.spacing:0)}function Qg(e){return e.paddingBottom??e.spacing}function $g(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function e_({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function t_(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),r=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);return n<=0&&r<=0?!1:n!==r}function n_({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-(n.additionLineIndex+n.additionCount),i=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function r_({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=n_({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function i_({type:e,metrics:t}){return t.hunkSeparatorHeight??$g(e)}function a_({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function o_({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function s_(e){return e!==`simple`&&e!==`metadata`}function c_({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!o_({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=i_({type:e,metrics:t}),a=a_({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function l_({type:e,metrics:t}){if(!s_(e))return;let n=i_({type:e,metrics:t}),r=a_({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function u_({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=d_({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=c.unifiedCount+e<n,a=c.splitCount+r<n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=e_({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),s=n===c.finalHunkIndex?r_({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,l=o.fromStart+o.fromEnd;function u(e,n){return s==null||s.collapsedLines<=0||s.fromStart+s.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?s.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?s.collapsedLines:0}let d=o.collapsedLines===0;function f(){return d?0:(d=!0,o.collapsedLines)}if(c.shouldSkip(l,l))c.incrementCounts(l,l),f();else{let e=r.unifiedLineStart-o.rangeSize,i=r.splitLineStart-o.rangeSize,a=r.deletionLineIndex-o.rangeSize,s=r.additionLineIndex-o.rangeSize,l=r.deletionStart-o.rangeSize,u=r.additionStart-o.rangeSize;if(m_(c,o.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-o.fromEnd,i=r.splitLineStart-o.fromEnd,a=r.deletionLineIndex-o.fromEnd,s=r.additionLineIndex-o.fromEnd,l=r.deletionStart-o.fromEnd,u=r.additionStart-o.fromEnd,m_(c,o.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}),()=>{f()})))break hunkIterator}let p=r.unifiedLineStart,m=r.splitLineStart,h=r.deletionLineIndex,g=r.additionLineIndex,_=r.deletionStart,v=r.additionStart,y=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===y;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),f();else if(m_(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=p+t,s=m+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:u(o,s),type:`context`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:g+t,lineNumber:v+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{f()}))break hunkIterator;p+=e.lines,m+=e.lines,h+=e.lines,g+=e.lines,_+=e.lines,v+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=h_(c,e,t);(s[0]?.[0]??0)>0&&f();for(let[l,d]of s)for(let s=l;s<d;s++){let l=u(p+s,t===`unified`?m+(s<e.deletions?s:s-e.deletions):m+s);if(c.emit(g_({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:p,splitLineIndex:m,additionLineIndex:g,deletionLineIndex:h,additionLineNumber:v,deletionLineNumber:_,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}f(),c.incrementCounts(o,a),p+=o,m+=a,h+=e.deletions,g+=e.additions,_+=e.deletions,v+=e.additions}}if(s!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=s,a=r+i;if(m_(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:!1,unifiedLineIndex:p+t,splitLineIndex:m+t},additionLine:{unifiedLineIndex:p+t,splitLineIndex:m+t,lineIndex:g+t,lineNumber:v+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function d_({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=f_({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function f_({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=e_({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?r_({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function p_(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function m_(e,t,n,r,i,a){let[o,s]=p_(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function h_(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function g_({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}function __(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}function v_({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function y_({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}var b_={forcePlainText:!1};function x_(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=b_){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Bg({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??C_();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}u_({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&S_({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=w_({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function S_({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:l}){if(e==null||t==null||o===`none`||(e=__(e),t=__(t),e.length>l||t.length>l))return;let u=o===`char`?c(e,t):s(e,t),d=[],f=[],p=o===`word-alt`,m=u.at(-1);for(let e of u){let t=e===m;!e.added&&!e.removed?(y_({item:e,arr:d,enableJoin:p,isNeutral:!0,isLastItem:t}),y_({item:e,arr:f,enableJoin:p,isNeutral:!0,isLastItem:t})):e.removed?y_({item:e,arr:d,enableJoin:p,isLastItem:t}):y_({item:e,arr:f,enableJoin:p,isLastItem:t})}let h=0;for(let e of d)e[0]===1&&i.push(v_({line:n,spanStart:h,spanLength:e[1].length})),h+=e[1].length;h=0;for(let e of f)e[0]===1&&a.push(v_({line:r,spanStart:h,spanLength:e[1].length})),h+=e[1].length}function C_(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function w_({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=Y,...l}}){let u=s??rg(e.name),d=s??rg(t.name),{state:f,transformers:p}=wg(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Dg(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Dg(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Hg(i.codeToHast(__(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Hg(i.codeToHast(__(t.contents),m)))}}function T_(e){let t=[];for(let n of e){let e=hh.get(n);if(e==null)throw Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t}function E_(e){for(let t of Array.isArray(e)?e:[e])if(!hh.has(t))return!1;return!0}async function D_(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=Sh(r)??xh(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function O_(e){return ph.getResolvedThemes(e)}async function k_(e){for(let t of e)Uh(t);let t=await ph.resolveThemes(e);for(let n=0;n<e.length;n++)Wh(e[n],t[n]);return t}var A_=e(u(),1),j_=Symbol(`IGNORE_RESPONSE`),M_=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`)}},N_=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:n=Y,useTokenTransformer:r=!1,lineDiffType:i=`word-alt`,maxLineDiffLength:a=1e3,tokenizeMaxLineLength:o=1e3,preferredHighlighter:s=`shiki-js`}){this.options=e,this.preferredHighlighter=s,this.renderOptions={theme:n,useTokenTransformer:r,lineDiffType:i,maxLineDiffLength:a,tokenizeMaxLineLength:o},this.fileCache=new A_.default.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new A_.default.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey==null?void 0:this.fileCache.get(e.cacheKey)}getDiffResultCache(e){return e.cacheKey==null?void 0:this.diffCache.get(e.cacheKey)}inspectCaches(){let{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??Y,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:n=this.renderOptions.lineDiffType??`word-alt`,maxLineDiffLength:r=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:i=this.renderOptions.tokenizeMaxLineLength??1e3}){let{lifecycleGeneration:a}=this,o=++this.renderOptionsRequestVersion,s=()=>this.isCurrentLifecycle(a)&&this.renderOptionsRequestVersion===o;try{let a={theme:e,useTokenTransformer:t,lineDiffType:n,maxLineDiffLength:r,tokenizeMaxLineLength:i};if(this.isInitialized()||await this.initialize(),!s()||qg(a,this.renderOptions))return;let o=Zh(e),c=[];if(eh(a.theme,this.renderOptions.theme)||(c=Qh(o)?O_(o):await k_(o)),!s())return;if(this.highlighter!=null)mh(c,this.highlighter);else{let e=await Jh({themes:o,langs:[`text`],preferredHighlighter:this.preferredHighlighter});if(!s())return;this.highlighter=e}let l=this.setRenderOptionsOnWorkers(a,c);this.renderOptions=a,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(let e of this.themeSubscribers)e.onThemeChange();await l}catch(e){if(e instanceof M_||!s())return;throw e}}getFileRenderOptions(){let{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:n}=this.renderOptions;return{theme:t,useTokenTransformer:n,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();let n=[];for(let r of this.workers){if(!r.initialized)throw Error(`setRenderOptionsOnWorkers: Somehow we have an uninitialized worker`);n.push(new Promise((n,i)=>{let a=this.generateRequestId(),o={type:`set-render-options`,id:a,request:{type:`set-render-options`,id:a,renderOptions:e,resolvedThemes:t},resolve:n,reject:i,requestStart:Date.now()};this.activeTaskById.set(a,o),r.pendingSetupRequestId=a,r.worker.postMessage(o.request)}))}await Promise.all(n)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast??=requestAnimationFrame(this._broadcastStateChanges)}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);let e=this.getStats();for(let t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);let t=this.activeRequestByInstance.get(e);if(t!=null){let n=this.activeTaskById.get(t);I_(n)?(this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeActiveTask(n)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0)if(this.initialized===!1){let{lifecycleGeneration:t}=this;this.initialized=new Promise((n,r)=>{(async()=>{try{let r=Zh(this.renderOptions.theme),i=[];if(i=Qh(r)?O_(r):await k_(r),!this.isCurrentLifecycle(t)){n();return}let a=[];if(a=E_(e)?T_(e):await D_(e),!this.isCurrentLifecycle(t)){n();return}let[o]=await Promise.all([Jh({themes:r,langs:[`text`,...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(i,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),n();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),n()}catch(e){if(e instanceof M_||!this.isCurrentLifecycle(t)){n();return}this.initialized=!1,this.workersFailed=!0,this.queueBroadcastStateChanges(),r(e)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(e,t){this.workersFailed=!1;let n=[],r=ig(),i=r>0?ag():void 0;this.workers.length>0&&this.terminateWorkers();for(let a=0;a<(this.options.poolSize??8);a++){let a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set([`text`,...t.map(({name:e})=>e)]),customExtensionsVersion:0};a.addEventListener(`message`,e=>{this.handleWorkerMessage(o,e.data)}),a.addEventListener(`error`,e=>console.error(`Worker error:`,e,o)),this.workers.push(o),n.push(new Promise((n,a)=>{let s=this.generateRequestId(),c={type:`initialize`,id:s,request:{type:`initialize`,id:s,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:i==null?void 0:r,customExtensionMap:i},resolve(){o.initialized=!0,n()},reject:a,requestStart:Date.now()};this.activeTaskById.set(s,c),this.executeTask(o,c)}))}await Promise.all(n)}drainQueue=()=>{if(this._queuedDrain=void 0,this.initialized===!0&&this.queuedTasks.length!==0){for(let e=0;e<this.queuedTasks.length;){let t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}let n=F_(t),r=this.getAvailableWorker(n);if(r==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,r),this.resolveLanguagesAndExecuteTask(r,t,n)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){let n=this.getFileResultCache(t);og(t)||n!=null&&$h(n.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:`file`,file:t})}primeFileHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}let t=this.getFileResultCache(e),n=this.getFileHighlightKey(e);if(n==null||og(e)||t!=null&&$h(t.options,this.getFileRenderOptions()))return;let r=this.getTaskByHighlightKey(n);r==null?this.submitCacheTask({type:`file`,file:e},n):r.primeCache=!0}getPlainFileAST(e,t,n,r){if(this.highlighter==null){this.queueInitialization();return}return Wg(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,lines:r})}highlightDiffAST(e,t){let n=this.getDiffResultCache(t);Jg(t)||n!=null&&qg(n.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:`diff`,diff:t})}primeDiffHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}let t=this.getDiffResultCache(e),n=this.getDiffHighlightKey(e);if(n==null||Jg(e)||t!=null&&qg(t.options,this.getDiffRenderOptions()))return;let r=this.getTaskByHighlightKey(n);r==null?this.submitCacheTask({type:`diff`,diff:e},n):r.primeCache=!0}getPlainDiffAST(e,t,n,r,i){return this.highlighter==null?void 0:x_(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:n,expandedHunks:r,collapsedContextThreshold:i})}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(e=>{console.error(e)})}cancelActiveWorkerTasks(){let e=new M_;for(let t of this.activeTaskById.values())`reject`in t&&t.reject(e)}terminateWorkers(){for(let e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?`waiting`:this.initialized===!0?`initialized`:`initializing`,totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.getHighlightKeyForRequest(t),r=n==null?void 0:this.getTaskByHighlightKey(n);if(r!=null){this.detachInstanceFromQueuedTasks(e,r),this.addInstanceToTask(r,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);let i=this.generateRequestId(),a=Date.now(),{renderOptionsVersion:o}=this,s=(()=>{switch(t.type){case`file`:return{type:`file`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,renderOptionsVersion:o,requestStart:a};case`diff`:return{type:`diff`,id:i,request:{...t,id:i},instances:new Set([e]),primeCache:!1,highlightKey:n,renderOptionsVersion:o,requestStart:a}}})();this.enqueueRenderTask(s,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();let n=this.generateRequestId(),r=Date.now(),{renderOptionsVersion:i}=this,a=(()=>{switch(e.type){case`file`:return{type:`file`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:i,requestStart:r};case`diff`:return{type:`diff`,id:n,request:{...e,id:n},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:i,requestStart:r}}})();this.enqueueRenderTask(a)}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,n){try{let r=n.filter(t=>!e.langs.has(t));if(r.length>0&&(E_(r)?t.request.resolvedLanguages=T_(r):t.request.resolvedLanguages=await D_(r)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch{this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){let n=this.activeTaskById.get(t.id);try{if(n==null)throw j_;if(t.type===`error`){let e=Error(t.error);if(t.stack&&(e.stack=t.stack),`reject`in n)n.reject(e);else if(I_(n))this.notifyHighlightError(n,e);else throw Error(`handleWorkerMessage: unknown task type`);throw e}switch(t.requestType){case`initialize`:if(n.type!==`initialize`)throw Error(`handleWorkerMessage: task/response dont match`);this.syncCustomExtensionVersion(e,n.request),n.resolve();break;case`set-render-options`:if(n.type!==`set-render-options`)throw Error(`handleWorkerMessage: task/response dont match`);n.resolve();break;case`file`:{if(n.type!==`file`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!$h(i,this.getFileRenderOptions()))throw j_;let{request:a}=n;this.syncCustomExtensionVersion(e,a),a.file.cacheKey!=null&&this.fileCache.set(a.file.cacheKey,{result:r,options:i}),this.notifyFileInstances(n,r,i);break}case`diff`:{if(n.type!==`diff`)throw Error(`handleWorkerMessage: task/response dont match`);let{result:r,options:i}=t;if(!this.isCurrentRenderTask(n)||!qg(i,this.getDiffRenderOptions()))throw j_;let{request:a}=n;this.syncCustomExtensionVersion(e,a),a.diff.cacheKey!=null&&this.diffCache.set(a.diff.cacheKey,{result:r,options:i}),this.notifyDiffInstances(n,r,i);break}}}catch(e){e!==j_&&console.error(e,n,t)}this.cleanWorkerAndTask(e,n,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain??(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,I_(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,n=t?.id){e.requestId===n&&(e.requestId=void 0),e.pendingSetupRequestId===n&&(e.pendingSetupRequestId=void 0),t!=null&&(I_(t)&&(this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){P_(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(let n of F_(t))e.langs.add(n);try{e.worker.postMessage(t.request)}catch(n){console.error(`Failed to post message to worker:`,n),I_(t)?this.notifyHighlightError(t,n):`reject`in t&&t.reject(n),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;let n=ig();e.customExtensionsVersion>=n||(t.customExtensionsVersion=n,t.customExtensionMap=ag())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(let n of this.workers){if(n.requestId!=null||n.pendingSetupRequestId!=null||!n.initialized)continue;if(t=n,e.length===0)break;let r=!0;for(let t of e)if(!n.langs.has(t)){r=!1;break}if(r)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case`file`:return this.getFileHighlightKey(e.file);case`diff`:return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(let t of L_(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){let n=this.queuedTaskByInstance.get(e);n!=null&&n!==t&&(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(n,e),!n.primeCache&&n.instances.size===0&&this.removeQueuedTask(n))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){let t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){let t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(let e of Array.from(this.activeTaskById.values()))I_(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(let t of L_(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(let t of L_(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(let t of L_(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.file,t,n)}notifyDiffInstances(e,t,n){for(let r of e.instances)this.activeRequestByInstance.get(r)===e.id&&r.onHighlightSuccess(e.request.diff,t,n)}notifyHighlightError(e,t){for(let n of L_(e))this.activeRequestByInstance.get(n)===e.id&&n.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`file`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&th(t,n.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(let n of this.iterateRenderTasks())if(n.type===`diff`&&this.isCurrentRenderTask(n)&&n.instances.has(e)&&Kg(n.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){let t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(let e of this.queuedTasks)yield e;for(let e of this.activeTaskById.values())I_(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function P_(e){return e.type===`initialize`||e.type===`file`||e.type===`diff`}function F_(e){let t=new Set;if(e.type===`initialize`||e.type===`set-render-options`)return[];switch(e.type){case`file`:t.add(e.request.file.lang??rg(e.request.file.name));break;case`diff`:t.add(e.request.diff.lang??rg(e.request.diff.name)),t.add(e.request.diff.lang??rg(e.request.diff.prevName??`-`))}return t.delete(`text`),Array.from(t)}function I_(e){return e?.type===`file`||e?.type===`diff`}function L_(e){return e.instances}var R_=(0,X.createContext)(void 0);function z_(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function B_(e,t){let n=e?.theme??Y,r=t?.theme??Y,i=V_(e),a=V_(t);return eh(n,r)&&z_(e,t,[`theme`,`parseDiffOptions`])&&z_(i,a)}function V_(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}var H_=new Set,U_=null;function W_(e){H_.add(e),U_??=requestAnimationFrame(G_)}function G_(e){let t=new Set(H_);H_.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}U_=H_.size>0?requestAnimationFrame(G_):null}function K_(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function q_({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function J_(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}var Y_=`-1,-1`;function X_(e){return e?.some(e=>e.lineNumber===0)??!1}function Z_(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function Q_(e){return e.startingLine===0&&e.totalLines>0}function $_(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function ev(){return Q({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[fg({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}var tv=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;activeLineHighlightSide;activeLineNumberOnly=!1;editorAttached=!1;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}setEditorAttached(e){this.editorAttached!==e&&(this.editorAttached=e,this.setSelectionDirty(),this.renderSelection())}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){let n=!(e===this.selectedRange||K_(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.activeLineHighlightSide=t?.activeLineSide,this.activeLineNumberOnly=t?.lineNumberOnly??!1,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&vv(e.composedPath())||(yv(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(yv(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(yv(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){yv(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();yv(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);yv(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=ov(i)&&this.hoveredLine?.lineElement===i.lineElement;av(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),av(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),ov(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(cv(i)&&p!=null){p(i);break}if(sv(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!ov(i))break;av(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,yv(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),yv(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),yv(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();vv(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;e.preventDefault();let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;let r=this.currentSelectionEnds(),i=r?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),a=r?.top??i;i!=null&&a!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:a,current:i},t&&(this.selectionAnchor={lineNumber:a.lineNumber,side:a.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let n=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if($_(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=a(ev());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);iv(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(dv(t));if(iv(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(iv(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(iv(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&vv(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=dv(e);if(t&&vv(n))return;let r=fv(e);return r==null?this.pathFromAnnotationSlot(e):dv(r)}pathFromAnnotationSlot(e){let t=mv(pv(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:dv(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=hv(t)?t:hv(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}K_(r??void 0,i??void 0)||(this.activeLineHighlightSide=void 0,this.activeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}highlightLineNumberOnly(){return this.activeLineHighlightSide==null?this.activeLineNumberOnly||this.editorAttached:this.activeLineNumberOnly}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end),s=this.highlightLineNumberOnly();for(let e of t){let t=this.activeLineHighlightSide;if(t!=null&&(t===`additions`&&e.hasAttribute(`data-deletions`)||t===`deletions`&&e.hasAttribute(`data-additions`)))continue;let[r,c]=e.children,l=c.children.length;if(l!==r.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;e<l;e++){let t=c.children[e],l=r.children[e];if(!(t instanceof HTMLElement)||!(l instanceof HTMLElement))continue;let u=this.parseLineIndex(t,n);if((u??0)>o)break;if(u==null||u<a)continue;let d=i?`single`:u===a?`first`:u===o?`last`:``;l.setAttribute(`data-selected-line`,d),!s&&(t.setAttribute(`data-selected-line`,d),l.nextSibling instanceof HTMLElement&&t.nextSibling instanceof HTMLElement&&(t.nextSibling.hasAttribute(`data-line-annotation`)||t.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(i?(d=`last`,t.setAttribute(`data-selected-line`,`first`)):u===a?d=``:u===o&&t.setAttribute(`data-selected-line`,``),t.nextSibling.setAttribute(`data-selected-line`,d),l.nextSibling.setAttribute(`data-selected-line`,d)))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);lv(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=_v(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=_v(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:uv(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:uv(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:gv(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:gv(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function nv({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:rv({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function rv({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function iv(e){return e!=null&&`kind`in e&&e.kind===`line`}function av(e){return e!=null&&`kind`in e&&e.kind===`token`}function ov(e){return iv(e)||av(e)}function sv(e){return`type`in e&&e.type===`line-info`}function cv(e){return`kind`in e&&e.kind===`merge-conflict-action`}function lv(e){return e===`current`||e===`incoming`||e===`both`}function uv(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function dv(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function fv(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function pv(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function mv(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function hv(e){return e!=null&&typeof e.elementFromPoint==`function`}function gv(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function _v(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function vv(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}function yv(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}[...n]}var bv=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,t){let n=new Set,r=0,i=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(r===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;r++;let n=i.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let a=e.firstElementChild;a instanceof HTMLElement||(a=null),n==null?(n={type:`code`,codeElement:e,numberElement:a,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,n),this.observe(e),a!=null&&(this.observedNodes.set(a,n),this.observe(a))):(this.observedNodes.set(e,n),i.delete(e),n.numberElement===a?n.numberElement==null?n.numberWidth=0:(i.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),i.delete(n.numberElement)),a!=null&&(this.observe(a),i.delete(a),this.observedNodes.set(a,n)),n.numberElement=a,n.numberWidth=0))}if(r>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),r=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let n=r.get(t);n??(n=[],r.set(t,n)),n.push(e)}for(let[e,t]of r){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[r,a]=t,o=r.firstElementChild,s=a.firstElementChild;if(!(r instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=i.get(o);if(c!=null){this.observedNodes.set(o,c),this.observedNodes.set(s,c),i.delete(o),i.delete(s);continue}let l=o.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:r,child:o,childHeight:l},column2:{container:a,child:s,childHeight:u},currentHeight:`auto`},n.add({child1:o,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of n)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);n.clear()}for(let[e,t]of i)this.unobserve(e),t.type===`code`?Cv(t):wv(t);i.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:xv(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Sv(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;if(!(!i&&!a)&&(t.codeWidth=e,t.numberWidth=r,i&&t.codeElement.style.setProperty(`--diffs-column-width`,`${typeof e==`number`?`${e}px`:`auto`}`),a&&t.codeElement.style.setProperty(`--diffs-column-number-width`,`${r===0?`auto`:`${r}px`}`),i||a&&e!==`auto`)){let n=typeof e==`number`?Math.max(e-r,0):0;t.codeElement.style.setProperty(`--diffs-column-content-width`,`${n>0?`${n}px`:`auto`}`)}}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function xv(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Sv(e){return Math.max(Math.ceil(e),0)}function Cv(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`))}function wv(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function Tv(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function Ev(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!vh.has(t))return!1;return!0}function Dv(e){for(let t of Zh(e))if(!nh.has(t))return!1;return!0}function Ov(e){return Q({tagName:`div`,children:[Q({tagName:`div`,children:e.annotations?.map(e=>Q({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function kv(e,t){return Q({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function Av(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function jv({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return Q({tagName:`div`,children:[t===`custom`?Q({tagName:`slot`,properties:{name:Im}}):Mv({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[Nv(r)]],properties:i})}function Mv({name:e,prevName:t,iconType:n}){let r=[Q({tagName:`slot`,properties:{name:Nm}}),fg({name:Av(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(Q({tagName:`div`,children:[Q({tagName:`bdi`,children:[dg(t)]})],properties:{"data-prev-name":``}})),r.push(fg({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(Q({tagName:`div`,children:[Q({tagName:`bdi`,children:[dg(e)]})],properties:{"data-title":``}})),r.push(Q({tagName:`slot`,properties:{name:Pm}})),Q({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Nv(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(Q({tagName:`span`,children:[dg(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(Q({tagName:`span`,children:[dg(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(Q({tagName:`slot`,properties:{name:Fm}})),Q({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Pv(e){return Q({tagName:`pre`,properties:Fv(e)})}function Fv({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function Iv(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Zh(t),preferredHighlighter:n}}function Lv(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var Rv=-1,zv=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++Rv}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;textDoucmentCache=new WeakMap;constructor(e={theme:Y},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Dv(e.theme??Y)?Yh():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=Bv(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!$h(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!og(e),result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??rg(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=Y,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,useTokenTransformer:Lv(this.options),tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result==null||!th(e,n.file)||!$h(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,ug(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:ug(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){return this.textDoucmentCache.get(e)?.lineCount??this.getOrCreateLineCache(e).length}updateRenderCache(e,t){if(this.renderCache==null)return;let{result:n}=this.renderCache;if(n!=null){for(let[r,i]of e)n.code[r]={type:`element`,tagName:`div`,properties:{"data-line":r+1,"data-line-type":`context`,"data-line-index":r},children:i.map(([e,n,r])=>e===0&&n===``?r===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:r}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`--diffs-token-${t}:${n};`},children:[{type:`text`,value:r}]})};n.baseThemeType=t,this.renderCache.isDirty=!0}}applyDocumentChange(e){if(this.renderCache==null)return;let{file:t,result:n}=this.renderCache;if(n!=null&&n.code.length!==e.lineCount){n.code.length=Math.min(n.code.length,e.lineCount);for(let t=n.code.length;t<e.lineCount;t++)n.code.push({type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]});this.renderCache.isDirty=!0}this.textDoucmentCache.set(t,e)}renderFile(e=this.renderCache?.file,t=Wm){if(e==null)return;let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||og(e)||Bv(a.length,this.getTokenizeMaxLength()),c=!th(e,this.renderCache.file),l=!Tv(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??rg(e.name);let t=this.highlighter!=null&&Dv(n.theme),i=this.highlighter!=null&&Ev(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=Wm){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=Bv(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??rg(e.name);let n=this.highlighter!=null&&Qh(Zh(this.options.theme)),r=t||this.highlighter!=null&&Ev(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:Wg(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=mg(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=Q_(t)?Z_(this.lineAnnotations):void 0;d!=null&&(c.children.push(gg(`context`,`annotation`,1)),s.push(Ov({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>Km(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(hg(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(gg(`context`,`annotation`,1)),s.push(Ov({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>Km(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return jv({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return a(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(Q({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=mg();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,kv(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return a(t?Q({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await Jh(Iv(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!th(e,this.renderCache.file)||!this.renderCache.highlighted||!$h(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!$h(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&th(e,n.file)&&$h(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return Pv({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Bv(e,t){return e>t}var Vv=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1384
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
1385
|
+
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
1386
|
+
</symbol>
|
|
1387
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
1388
|
+
<path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
|
|
1389
|
+
</symbol>
|
|
1390
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
1391
|
+
<path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
|
|
1392
|
+
</symbol>
|
|
1393
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
1394
|
+
<path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
|
|
1395
|
+
</symbol>
|
|
1396
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
1397
|
+
<path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
|
|
1398
|
+
</symbol>
|
|
1399
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
1400
|
+
<path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
|
|
1401
|
+
</symbol>
|
|
1402
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
1403
|
+
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
|
|
1404
|
+
</symbol>
|
|
1405
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
1406
|
+
<path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
|
|
1407
|
+
</symbol>
|
|
1408
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
1409
|
+
<path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
|
|
1410
|
+
</symbol>
|
|
1411
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
1412
|
+
<path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
|
|
1413
|
+
</symbol>
|
|
1414
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
1415
|
+
<path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
1416
|
+
</symbol>
|
|
1417
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
1418
|
+
<path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
|
|
1419
|
+
</symbol>
|
|
1420
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
1421
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
|
|
1422
|
+
</symbol>
|
|
1423
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
1424
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
|
|
1425
|
+
</symbol>
|
|
1426
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
1427
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
|
|
1428
|
+
</symbol>
|
|
1429
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
1430
|
+
<path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
|
|
1431
|
+
</symbol>
|
|
1432
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
1433
|
+
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
1434
|
+
</symbol>
|
|
1435
|
+
</svg>`;function Hv(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function Uv(e,t){return e==null||t==null?e===t:Gv(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var Wv={};function Gv(e=Wv,t=Wv){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Kv(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function qv(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function Jv(){let e=document.createElement(`style`);return e.setAttribute(Rm,``),e}var Yv;function Xv(e){if(Yv!=null)return Yv;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(zm,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),Yv=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),Yv}function Zv(e){return`${Bm}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var Qv=`@layer base {
|
|
1436
|
+
:host {
|
|
1437
|
+
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
1438
|
+
"Courier New", monospace;
|
|
1439
|
+
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
1440
|
+
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
1441
|
+
--diffs-mixer: light-dark(#000, #fff);
|
|
1442
|
+
--diffs-gap-fallback: 8px;
|
|
1443
|
+
--diffs-scrollbar-gutter-fallback: 6px;
|
|
1444
|
+
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
1445
|
+
--diffs-added-light: #0dbe4e;
|
|
1446
|
+
--diffs-added-dark: #5ecc71;
|
|
1447
|
+
--diffs-modified-light: #009fff;
|
|
1448
|
+
--diffs-modified-dark: #69b1ff;
|
|
1449
|
+
--diffs-deleted-light: #ff2e3f;
|
|
1450
|
+
--diffs-deleted-dark: #ff6762;
|
|
1451
|
+
--diffs-warning-light: #d5a910;
|
|
1452
|
+
--diffs-warning-dark: #ffd452;
|
|
1453
|
+
color-scheme: light dark;
|
|
1454
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1455
|
+
font-size: var(--diffs-font-size, 13px);
|
|
1456
|
+
line-height: var(--diffs-line-height, 20px);
|
|
1457
|
+
font-feature-settings: var(--diffs-font-features);
|
|
1458
|
+
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
1459
|
+
--diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));
|
|
1460
|
+
--diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));
|
|
1461
|
+
--diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));
|
|
1462
|
+
--diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));
|
|
1463
|
+
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
1464
|
+
--diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));
|
|
1465
|
+
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
1466
|
+
--diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark)))));
|
|
1467
|
+
--diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark)))));
|
|
1468
|
+
--diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark)))));
|
|
1469
|
+
--diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));
|
|
1470
|
+
--diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2)));
|
|
1471
|
+
--diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));
|
|
1472
|
+
--diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2)));
|
|
1473
|
+
--diffs-selection-base: var(--diffs-modified-base);
|
|
1474
|
+
--diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));
|
|
1475
|
+
background-color: var(--diffs-bg);
|
|
1476
|
+
color: var(--diffs-fg);
|
|
1477
|
+
display: block;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
pre, code, [data-error-wrapper] {
|
|
1481
|
+
isolation: isolate;
|
|
1482
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1483
|
+
outline: none;
|
|
1484
|
+
margin: 0;
|
|
1485
|
+
padding: 0;
|
|
1486
|
+
display: block;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
pre, code {
|
|
1490
|
+
background-color: var(--diffs-bg);
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
code {
|
|
1494
|
+
contain: content;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
input, button {
|
|
1498
|
+
font-family: inherit;
|
|
1499
|
+
font-size: inherit;
|
|
1500
|
+
line-height: inherit;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
*, :before, :after {
|
|
1504
|
+
box-sizing: border-box;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
[data-icon-sprite] {
|
|
1508
|
+
display: none;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
[data-diffs-header], [data-separator] {
|
|
1512
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
[data-diffs-header][data-sticky] {
|
|
1516
|
+
z-index: 1;
|
|
1517
|
+
background-color: var(--diffs-bg);
|
|
1518
|
+
position: sticky;
|
|
1519
|
+
top: 0;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
[data-file-info] {
|
|
1523
|
+
color: var(--fg);
|
|
1524
|
+
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
1525
|
+
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
1526
|
+
padding: 10px;
|
|
1527
|
+
font-weight: 700;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
[data-diff], [data-file] {
|
|
1531
|
+
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
1532
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
1533
|
+
|
|
1534
|
+
&[data-dehydrated] {
|
|
1535
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
1539
|
+
background-color: var(--diffs-bg-context);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
@supports (-webkit-touch-callout: none) {
|
|
1544
|
+
:host {
|
|
1545
|
+
--diffs-scrollbar-gutter-fallback: 0px;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
[data-line] span {
|
|
1550
|
+
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
1551
|
+
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
1552
|
+
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
1553
|
+
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
1554
|
+
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
|
|
1558
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
1559
|
+
--diffs-computed-diff-line-bg: var(--diffs-bg);
|
|
1560
|
+
--diffs-computed-selected-line-bg: var(--diffs-bg);
|
|
1561
|
+
color: var(--diffs-fg);
|
|
1562
|
+
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
1563
|
+
|
|
1564
|
+
@media (pointer: fine) {
|
|
1565
|
+
&:where([data-hovered]) {
|
|
1566
|
+
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
1567
|
+
var(--diffs-computed-selected-line-bg) 97%,
|
|
1568
|
+
var(--diffs-bg-hover-override, var(--diffs-mixer))), color-mix(in lab,
|
|
1569
|
+
var(--diffs-computed-selected-line-bg) 91%,
|
|
1570
|
+
var(--diffs-bg-hover-override, var(--diffs-mixer))));
|
|
1571
|
+
--diffs-line-bg: var(--diffs-computed-hovered-line-bg, inherit);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
[data-line], [data-no-newline] {
|
|
1577
|
+
&[data-decoration-bg] {
|
|
1578
|
+
--mix-deco-light: 92%;
|
|
1579
|
+
--mix-deco-dark: 85%;
|
|
1580
|
+
|
|
1581
|
+
&[data-decoration-bg-depth="2"] {
|
|
1582
|
+
--mix-deco-light: 88%;
|
|
1583
|
+
--mix-deco-dark: 80%;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
&[data-decoration-bg-depth="3"] {
|
|
1587
|
+
--mix-deco-light: 85%;
|
|
1588
|
+
--mix-deco-dark: 78%;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
@media (pointer: fine) {
|
|
1592
|
+
&[data-hovered]:not([data-selected-line]) {
|
|
1593
|
+
--mix-deco-light: 85%;
|
|
1594
|
+
--mix-deco-dark: 85%;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
&[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="2"] {
|
|
1598
|
+
--mix-deco-light: 83%;
|
|
1599
|
+
--mix-deco-dark: 83%;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
&[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="3"] {
|
|
1603
|
+
--mix-deco-light: 81%;
|
|
1604
|
+
--mix-deco-dark: 81%;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
1609
|
+
var(--diffs-bg) var(--mix-deco-light),
|
|
1610
|
+
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
1611
|
+
var(--diffs-bg) var(--mix-deco-dark),
|
|
1612
|
+
var(--diffs-decoration-bg)));
|
|
1613
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
1614
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
1615
|
+
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
1620
|
+
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
1621
|
+
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
1622
|
+
--diffs-computed-diff-line-bg: var(--diffs-annotation-bg);
|
|
1623
|
+
--diffs-computed-selected-line-bg: var(--diffs-annotation-bg);
|
|
1624
|
+
--diffs-line-bg: var(--diffs-annotation-bg);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
[data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] {
|
|
1628
|
+
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
1629
|
+
--diffs-computed-diff-line-bg: var(--diffs-bg-context);
|
|
1630
|
+
--diffs-computed-selected-line-bg: var(--diffs-bg-context);
|
|
1631
|
+
--diffs-line-bg: var(--diffs-bg-context);
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
1635
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
1636
|
+
var(--diffs-bg) 78%,
|
|
1637
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
1638
|
+
var(--diffs-bg) 68%,
|
|
1639
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
1640
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
1641
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
1642
|
+
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
1646
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
1647
|
+
var(--diffs-bg) 78%,
|
|
1648
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
1649
|
+
var(--diffs-bg) 68%,
|
|
1650
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
1651
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
1652
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
1653
|
+
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
1657
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
1658
|
+
--diffs-computed-diff-line-bg: var(--diffs-bg);
|
|
1659
|
+
--diffs-computed-selected-line-bg: var(--diffs-bg);
|
|
1660
|
+
--diffs-line-bg: var(--diffs-bg);
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
:where([data-background]) {
|
|
1664
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1665
|
+
--mix-light: 91%;
|
|
1666
|
+
--mix-dark: 85%;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
& [data-line], & [data-no-newline] {
|
|
1670
|
+
--mix-light: 88%;
|
|
1671
|
+
--mix-dark: 80%;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
1675
|
+
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
1676
|
+
|
|
1677
|
+
&[data-line-type="change-deletion"] {
|
|
1678
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
1679
|
+
|
|
1680
|
+
@media (pointer: fine) {
|
|
1681
|
+
&[data-hovered] {
|
|
1682
|
+
--mix-light: 80%;
|
|
1683
|
+
--mix-dark: 75%;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
1688
|
+
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
1689
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
1693
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
1694
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
1695
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
1696
|
+
var(--diffs-diff-line-mix-target)));
|
|
1697
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
1698
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
&[data-line-type="change-addition"] {
|
|
1702
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
1703
|
+
|
|
1704
|
+
@media (pointer: fine) {
|
|
1705
|
+
&[data-hovered] {
|
|
1706
|
+
--mix-light: 80%;
|
|
1707
|
+
--mix-dark: 70%;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
1712
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
1713
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
1717
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
1718
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
1719
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
1720
|
+
var(--diffs-diff-line-mix-target)));
|
|
1721
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
1722
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
&[data-merge-conflict="current"] {
|
|
1726
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
1727
|
+
|
|
1728
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
1729
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
1730
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
@media (pointer: fine) {
|
|
1734
|
+
&[data-hovered] {
|
|
1735
|
+
--mix-light: 80%;
|
|
1736
|
+
--mix-dark: 70%;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
1741
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
1742
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
1743
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
1744
|
+
var(--diffs-diff-line-mix-target)));
|
|
1745
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
1746
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
&[data-merge-conflict="incoming"] {
|
|
1750
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
1751
|
+
|
|
1752
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
1753
|
+
color: var(--diffs-modified-base);
|
|
1754
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
@media (pointer: fine) {
|
|
1758
|
+
&[data-hovered] {
|
|
1759
|
+
--mix-light: 80%;
|
|
1760
|
+
--mix-dark: 70%;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
1765
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
1766
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
1767
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
1768
|
+
var(--diffs-diff-line-mix-target)));
|
|
1769
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
1770
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
|
|
1776
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
1777
|
+
|
|
1778
|
+
&:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
1779
|
+
--mix-selection-light: 82%;
|
|
1780
|
+
--mix-selection-dark: 75%;
|
|
1781
|
+
|
|
1782
|
+
@media (pointer: fine) {
|
|
1783
|
+
&[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
1784
|
+
--mix-selection-light: 75%;
|
|
1785
|
+
--mix-selection-dark: 70%;
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
&:where([data-gutter-buffer], [data-column-number])[data-selected-line] {
|
|
1791
|
+
--mix-selection-light: 75%;
|
|
1792
|
+
--mix-selection-dark: 60%;
|
|
1793
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
1794
|
+
|
|
1795
|
+
@media (pointer: fine) {
|
|
1796
|
+
&[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
1797
|
+
--mix-selection-light: 70%;
|
|
1798
|
+
--mix-selection-dark: 55%;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
&:where([data-editor-overlay]), &[data-selected-line] {
|
|
1804
|
+
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
1805
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
1806
|
+
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
1807
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
1808
|
+
var(--diffs-selection-mix-target)));
|
|
1809
|
+
--diffs-line-bg: var(--diffs-computed-selected-line-bg, inherit);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
[data-gutter-buffer], [data-column-number] {
|
|
1814
|
+
&[data-selected-line] {
|
|
1815
|
+
color: var(--diffs-selection-number-fg);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
[data-no-newline] {
|
|
1820
|
+
user-select: none;
|
|
1821
|
+
|
|
1822
|
+
& span {
|
|
1823
|
+
opacity: .6;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
[data-diff-type="split"][data-overflow="scroll"] {
|
|
1828
|
+
grid-template-columns: 1fr 1fr;
|
|
1829
|
+
display: grid;
|
|
1830
|
+
|
|
1831
|
+
& [data-additions] {
|
|
1832
|
+
border-left: 1px solid var(--diffs-bg);
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
& [data-deletions] {
|
|
1836
|
+
border-right: 1px solid var(--diffs-bg);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
[data-code] {
|
|
1841
|
+
grid-auto-flow: dense;
|
|
1842
|
+
grid-template-columns: var(--diffs-code-grid);
|
|
1843
|
+
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
1844
|
+
overscroll-behavior-x: none;
|
|
1845
|
+
tab-size: var(--diffs-tab-size, 2);
|
|
1846
|
+
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
1847
|
+
padding-bottom: max(0px,
|
|
1848
|
+
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
1849
|
+
var(--diffs-scrollbar-gutter)));
|
|
1850
|
+
scrollbar-gutter: stable;
|
|
1851
|
+
align-self: flex-start;
|
|
1852
|
+
display: grid;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
[data-diffs-scrollbar-measure] {
|
|
1856
|
+
opacity: 0;
|
|
1857
|
+
pointer-events: none;
|
|
1858
|
+
scrollbar-gutter: auto;
|
|
1859
|
+
grid-template-columns: none;
|
|
1860
|
+
width: 100px;
|
|
1861
|
+
height: 100px;
|
|
1862
|
+
padding: 0;
|
|
1863
|
+
position: absolute;
|
|
1864
|
+
top: -200px;
|
|
1865
|
+
left: -200px;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
[data-container-size] {
|
|
1869
|
+
container-type: inline-size;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
[data-code]::-webkit-scrollbar {
|
|
1873
|
+
width: 0;
|
|
1874
|
+
height: var(--diffs-scrollbar-gutter);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
[data-code]::-webkit-scrollbar-track {
|
|
1878
|
+
background: none;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
[data-code]::-webkit-scrollbar-thumb {
|
|
1882
|
+
background-color: #0000;
|
|
1883
|
+
background-clip: content-box;
|
|
1884
|
+
border: 1px solid #0000;
|
|
1885
|
+
border-radius: 3px;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
[data-code]::-webkit-scrollbar-corner {
|
|
1889
|
+
background-color: #0000;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
@supports ((-moz-appearance: none)) {
|
|
1893
|
+
[data-code] {
|
|
1894
|
+
scrollbar-width: thin;
|
|
1895
|
+
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
1896
|
+
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
1901
|
+
& [data-code], &[data-overflow="wrap"] {
|
|
1902
|
+
padding-top: 0;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
[data-gutter] {
|
|
1907
|
+
grid-template-rows: subgrid;
|
|
1908
|
+
grid-template-columns: subgrid;
|
|
1909
|
+
z-index: 3;
|
|
1910
|
+
background-color: var(--diffs-bg);
|
|
1911
|
+
grid-column: 1;
|
|
1912
|
+
display: grid;
|
|
1913
|
+
position: relative;
|
|
1914
|
+
|
|
1915
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1916
|
+
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
[data-content] {
|
|
1921
|
+
grid-template-rows: subgrid;
|
|
1922
|
+
grid-template-columns: subgrid;
|
|
1923
|
+
background-color: var(--diffs-bg);
|
|
1924
|
+
grid-column: 2;
|
|
1925
|
+
min-width: 0;
|
|
1926
|
+
display: grid;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
[data-diff-type="split"][data-overflow="wrap"] {
|
|
1930
|
+
grid-auto-flow: dense;
|
|
1931
|
+
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
1932
|
+
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
1933
|
+
display: grid;
|
|
1934
|
+
|
|
1935
|
+
& [data-deletions] {
|
|
1936
|
+
display: contents;
|
|
1937
|
+
|
|
1938
|
+
& [data-gutter] {
|
|
1939
|
+
grid-column: 1;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
& [data-content] {
|
|
1943
|
+
border-right: 1px solid var(--diffs-bg);
|
|
1944
|
+
grid-column: 2;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
& [data-additions] {
|
|
1949
|
+
display: contents;
|
|
1950
|
+
|
|
1951
|
+
& [data-gutter] {
|
|
1952
|
+
border-left: 1px solid var(--diffs-bg);
|
|
1953
|
+
grid-column: 3;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
& [data-content] {
|
|
1957
|
+
grid-column: 4;
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
[data-overflow="scroll"] [data-gutter] {
|
|
1963
|
+
position: sticky;
|
|
1964
|
+
left: 0;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
[data-interactive-lines] [data-line] {
|
|
1968
|
+
cursor: pointer;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
[data-interactive-line-numbers] [data-column-number] {
|
|
1972
|
+
cursor: pointer;
|
|
1973
|
+
touch-action: none;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
[data-content-buffer], [data-gutter-buffer] {
|
|
1977
|
+
user-select: none;
|
|
1978
|
+
min-height: 1lh;
|
|
1979
|
+
position: relative;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
[data-gutter-buffer] {
|
|
1983
|
+
padding-left: 2ch;
|
|
1984
|
+
padding-right: 1ch;
|
|
1985
|
+
|
|
1986
|
+
&:before {
|
|
1987
|
+
content: "";
|
|
1988
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1989
|
+
display: block;
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
[data-gutter-buffer="annotation"] {
|
|
1994
|
+
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
1995
|
+
min-height: 0;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
[data-gutter-buffer="buffer"] {
|
|
1999
|
+
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
[data-content-buffer] {
|
|
2003
|
+
background-position: 5px 0;
|
|
2004
|
+
background-size: 8px 8px;
|
|
2005
|
+
background-origin: border-box;
|
|
2006
|
+
background-image: repeating-linear-gradient(-45deg,
|
|
2007
|
+
transparent,
|
|
2008
|
+
transparent calc(3px * 1.414),
|
|
2009
|
+
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
2010
|
+
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
2011
|
+
grid-column: 1;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
[data-separator] {
|
|
2015
|
+
box-sizing: content-box;
|
|
2016
|
+
background-color: var(--diffs-bg);
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
[data-separator="simple"] {
|
|
2020
|
+
min-height: 4px;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
2024
|
+
background-color: var(--diffs-bg-separator);
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
2028
|
+
height: 32px;
|
|
2029
|
+
position: relative;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
[data-separator-wrapper] {
|
|
2033
|
+
user-select: none;
|
|
2034
|
+
fill: currentColor;
|
|
2035
|
+
background-color: var(--diffs-bg);
|
|
2036
|
+
align-items: center;
|
|
2037
|
+
height: 100%;
|
|
2038
|
+
display: flex;
|
|
2039
|
+
position: absolute;
|
|
2040
|
+
inset-inline: 0;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
[data-content] [data-separator-wrapper] {
|
|
2044
|
+
display: none;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
[data-separator="metadata"] [data-separator-wrapper] {
|
|
2048
|
+
background-color: var(--diffs-bg-separator);
|
|
2049
|
+
height: 100%;
|
|
2050
|
+
color: var(--diffs-fg-number);
|
|
2051
|
+
white-space: nowrap;
|
|
2052
|
+
text-overflow: ellipsis;
|
|
2053
|
+
min-width: min-content;
|
|
2054
|
+
padding-inline: 1ch;
|
|
2055
|
+
inset-inline: 100% auto;
|
|
2056
|
+
overflow: hidden;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
[data-separator="line-info"] {
|
|
2060
|
+
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
2061
|
+
|
|
2062
|
+
& [data-separator-wrapper] {
|
|
2063
|
+
min-width: 16px;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
2068
|
+
margin-block: 0;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
[data-separator="line-info"][data-separator-first] {
|
|
2072
|
+
margin-top: 0;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
[data-separator="line-info"][data-separator-last] {
|
|
2076
|
+
margin-bottom: 0;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
[data-expand-index] [data-separator-wrapper] {
|
|
2080
|
+
grid-template-columns: 32px auto;
|
|
2081
|
+
display: grid;
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
2085
|
+
grid-template-columns: 32px 32px auto;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
[data-expand-button], [data-separator-content] {
|
|
2089
|
+
background-color: var(--diffs-bg-separator);
|
|
2090
|
+
flex: none;
|
|
2091
|
+
align-items: center;
|
|
2092
|
+
display: flex;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
[data-expand-index] [data-separator-content]:hover {
|
|
2096
|
+
cursor: pointer;
|
|
2097
|
+
text-decoration: underline;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
[data-expand-button] {
|
|
2101
|
+
cursor: pointer;
|
|
2102
|
+
min-width: 32px;
|
|
2103
|
+
color: var(--diffs-fg-number);
|
|
2104
|
+
border-right: 2px solid var(--diffs-bg);
|
|
2105
|
+
flex-shrink: 0;
|
|
2106
|
+
justify-content: center;
|
|
2107
|
+
align-self: stretch;
|
|
2108
|
+
|
|
2109
|
+
&:hover {
|
|
2110
|
+
color: var(--diffs-fg);
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
&[data-expand-all-button] {
|
|
2114
|
+
display: none;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
[data-expand-down] [data-icon] {
|
|
2119
|
+
transform: scaleY(-1);
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
[data-separator-content] {
|
|
2123
|
+
height: 100%;
|
|
2124
|
+
color: var(--diffs-fg-number);
|
|
2125
|
+
flex: auto;
|
|
2126
|
+
justify-content: flex-start;
|
|
2127
|
+
padding: 0 1ch;
|
|
2128
|
+
overflow: hidden;
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
2132
|
+
& [data-separator-content] {
|
|
2133
|
+
user-select: none;
|
|
2134
|
+
height: 100%;
|
|
2135
|
+
overflow: clip;
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
[data-unmodified-lines] {
|
|
2140
|
+
text-overflow: ellipsis;
|
|
2141
|
+
white-space: nowrap;
|
|
2142
|
+
flex: 0 auto;
|
|
2143
|
+
min-width: 0;
|
|
2144
|
+
display: block;
|
|
2145
|
+
overflow: hidden;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
@supports (width: 1cqi) {
|
|
2149
|
+
[data-unified] {
|
|
2150
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
2151
|
+
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
2152
|
+
width: 100cqi;
|
|
2153
|
+
|
|
2154
|
+
& [data-separator-content] {
|
|
2155
|
+
border-radius: 6px;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
2160
|
+
border-top-left-radius: unset;
|
|
2161
|
+
border-bottom-left-radius: unset;
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
[data-gutter] {
|
|
2166
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
2167
|
+
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
& [data-separator="line-info"] [data-separator-content] {
|
|
2171
|
+
border-top-left-radius: 6px;
|
|
2172
|
+
border-bottom-left-radius: 6px;
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
2176
|
+
border-top-left-radius: unset;
|
|
2177
|
+
border-bottom-left-radius: unset;
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
[data-additions] {
|
|
2182
|
+
& [data-content] [data-separator="line-info"] {
|
|
2183
|
+
background-color: var(--diffs-bg);
|
|
2184
|
+
|
|
2185
|
+
& [data-separator-wrapper] {
|
|
2186
|
+
display: none;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
2191
|
+
background-color: var(--diffs-bg-separator);
|
|
2192
|
+
border-top-right-radius: 6px;
|
|
2193
|
+
border-bottom-right-radius: 6px;
|
|
2194
|
+
height: 100%;
|
|
2195
|
+
display: block;
|
|
2196
|
+
|
|
2197
|
+
& [data-separator-content], & [data-expand-button] {
|
|
2198
|
+
display: none;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
2204
|
+
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
2208
|
+
background-color: var(--diffs-bg-separator);
|
|
2209
|
+
height: 100%;
|
|
2210
|
+
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
2211
|
+
border-top-right-radius: 6px;
|
|
2212
|
+
border-bottom-right-radius: 6px;
|
|
2213
|
+
display: block;
|
|
2214
|
+
|
|
2215
|
+
& [data-separator-content], & [data-expand-button] {
|
|
2216
|
+
display: none;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
2221
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
2222
|
+
border-top-left-radius: 6px;
|
|
2223
|
+
border-bottom-left-radius: 6px;
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
@media (pointer: fine) {
|
|
2228
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
2229
|
+
&[data-separator-multi-button] {
|
|
2230
|
+
& [data-expand-up] {
|
|
2231
|
+
border-top-left-radius: 6px;
|
|
2232
|
+
border-bottom-left-radius: unset;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
& [data-expand-down] {
|
|
2236
|
+
border-bottom-left-radius: 6px;
|
|
2237
|
+
border-top-left-radius: unset;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
@media (pointer: coarse) {
|
|
2245
|
+
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
2246
|
+
grid-template-columns: 34px 34px auto;
|
|
2247
|
+
|
|
2248
|
+
& [data-separator-content] {
|
|
2249
|
+
grid-column: unset;
|
|
2250
|
+
grid-row: unset;
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
@supports (width: 1cqi) {
|
|
2255
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
2256
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
2257
|
+
border-top-left-radius: 6px;
|
|
2258
|
+
border-bottom-left-radius: 6px;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
&[data-separator-multi-button] {
|
|
2262
|
+
& [data-expand-up] {
|
|
2263
|
+
border-top-left-radius: 6px;
|
|
2264
|
+
border-bottom-left-radius: 6px;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
& [data-expand-down] {
|
|
2268
|
+
border-bottom-left-radius: unset;
|
|
2269
|
+
border-top-left-radius: unset;
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
@media (pointer: fine) {
|
|
2277
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
2278
|
+
grid-template-rows: 50% 50%;
|
|
2279
|
+
display: grid;
|
|
2280
|
+
|
|
2281
|
+
& [data-separator-content] {
|
|
2282
|
+
grid-area: 1 / 2 / -1;
|
|
2283
|
+
min-width: min-content;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
& [data-expand-button] {
|
|
2287
|
+
grid-column: 1;
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
2292
|
+
grid-template-columns: 34px auto;
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
2296
|
+
grid-template-columns: 100% auto;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
2300
|
+
& [data-separator-multi-button] {
|
|
2301
|
+
& [data-expand-up] {
|
|
2302
|
+
border-bottom: 1px solid var(--diffs-bg);
|
|
2303
|
+
border-right: 2px solid var(--diffs-bg);
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
& [data-expand-down] {
|
|
2307
|
+
border-top: 1px solid var(--diffs-bg);
|
|
2308
|
+
border-right: 2px solid var(--diffs-bg);
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
2315
|
+
display: none;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
[data-line-annotation] {
|
|
2319
|
+
min-height: var(--diffs-annotation-min-height, 0);
|
|
2320
|
+
z-index: 2;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
[data-merge-conflict-actions] {
|
|
2324
|
+
z-index: 2;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
[data-separator="custom"] {
|
|
2328
|
+
grid-template-columns: subgrid;
|
|
2329
|
+
display: grid;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
[data-line], [data-column-number], [data-no-newline] {
|
|
2333
|
+
padding-inline: 1ch;
|
|
2334
|
+
position: relative;
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
[data-indicators="classic"] [data-line] {
|
|
2338
|
+
padding-inline-start: 2ch;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
[data-indicators="classic"] {
|
|
2342
|
+
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
2343
|
+
&[data-no-newline], &[data-line] {
|
|
2344
|
+
&:before {
|
|
2345
|
+
user-select: none;
|
|
2346
|
+
width: 1ch;
|
|
2347
|
+
height: 1lh;
|
|
2348
|
+
display: inline-block;
|
|
2349
|
+
position: absolute;
|
|
2350
|
+
top: 0;
|
|
2351
|
+
left: 0;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
& [data-line-type="change-addition"] {
|
|
2357
|
+
&[data-line], &[data-no-newline] {
|
|
2358
|
+
&:before {
|
|
2359
|
+
content: "+";
|
|
2360
|
+
color: var(--diffs-addition-base);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
& [data-line-type="change-deletion"] {
|
|
2366
|
+
&[data-line], &[data-no-newline] {
|
|
2367
|
+
&:before {
|
|
2368
|
+
content: "-";
|
|
2369
|
+
color: var(--diffs-deletion-base);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
[data-indicators="bars"] {
|
|
2376
|
+
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
2377
|
+
&[data-column-number] {
|
|
2378
|
+
&:before {
|
|
2379
|
+
content: "";
|
|
2380
|
+
user-select: none;
|
|
2381
|
+
contain: strict;
|
|
2382
|
+
width: 4px;
|
|
2383
|
+
height: 100%;
|
|
2384
|
+
display: block;
|
|
2385
|
+
position: absolute;
|
|
2386
|
+
top: 0;
|
|
2387
|
+
left: 0;
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
& [data-line-type="change-deletion"] {
|
|
2393
|
+
&[data-column-number] {
|
|
2394
|
+
&:before {
|
|
2395
|
+
background-image: linear-gradient(0deg,
|
|
2396
|
+
var(--diffs-bg-deletion) 50%,
|
|
2397
|
+
var(--diffs-deletion-base) 50%);
|
|
2398
|
+
background-repeat: repeat;
|
|
2399
|
+
background-size: 2px 2px;
|
|
2400
|
+
background-size: calc(1lh / round(1lh / 2px))
|
|
2401
|
+
calc(1lh / round(1lh / 2px));
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
& [data-line-type="change-addition"] {
|
|
2407
|
+
&[data-column-number] {
|
|
2408
|
+
&:before {
|
|
2409
|
+
background-color: var(--diffs-addition-base);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
[data-overflow="wrap"] {
|
|
2416
|
+
& [data-line], & [data-annotation-content] {
|
|
2417
|
+
white-space: pre-wrap;
|
|
2418
|
+
word-break: break-word;
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
[data-overflow="scroll"] [data-line] {
|
|
2423
|
+
white-space: pre;
|
|
2424
|
+
min-height: 1lh;
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
[data-column-number] {
|
|
2428
|
+
box-sizing: content-box;
|
|
2429
|
+
text-align: right;
|
|
2430
|
+
user-select: none;
|
|
2431
|
+
color: var(--diffs-fg-number);
|
|
2432
|
+
padding-left: 2ch;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
[data-line-number-content] {
|
|
2436
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
2437
|
+
z-index: 1;
|
|
2438
|
+
display: inline-block;
|
|
2439
|
+
position: relative;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
[data-disable-line-numbers] {
|
|
2443
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
2444
|
+
min-width: 4px;
|
|
2445
|
+
padding: 0;
|
|
2446
|
+
|
|
2447
|
+
&:before {
|
|
2448
|
+
min-width: 0;
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
& [data-line-number-content] {
|
|
2453
|
+
display: none;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
& [data-gutter-utility-slot] {
|
|
2457
|
+
right: unset;
|
|
2458
|
+
justify-content: flex-start;
|
|
2459
|
+
left: 0;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
2463
|
+
left: 6px;
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
[data-file][data-disable-line-numbers] {
|
|
2468
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
2469
|
+
border-right: 0;
|
|
2470
|
+
min-width: 0;
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
[data-diff-span] {
|
|
2475
|
+
box-decoration-break: clone;
|
|
2476
|
+
border-radius: 3px;
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
[data-line-type="change-addition"] [data-diff-span] {
|
|
2480
|
+
background-color: var(--diffs-bg-addition-emphasis);
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
[data-line-type="change-deletion"] [data-diff-span] {
|
|
2484
|
+
background-color: var(--diffs-bg-deletion-emphasis);
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
2488
|
+
color: var(--diffs-fg);
|
|
2489
|
+
padding-left: 1ch;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
2493
|
+
align-items: center;
|
|
2494
|
+
display: flex;
|
|
2495
|
+
|
|
2496
|
+
&:after {
|
|
2497
|
+
color: var(--diffs-fg-conflict-marker);
|
|
2498
|
+
font-size: .75rem;
|
|
2499
|
+
font-style: normal;
|
|
2500
|
+
line-height: 1.25rem;
|
|
2501
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
2502
|
+
padding-left: 1ch;
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
[data-merge-conflict="marker-start"]:after {
|
|
2507
|
+
content: "(Current Change)";
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
[data-merge-conflict="marker-end"]:after {
|
|
2511
|
+
content: "(Incoming Change)";
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
[data-merge-conflict-actions-content] {
|
|
2515
|
+
min-height: 1.75rem;
|
|
2516
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
2517
|
+
color: var(--diffs-fg);
|
|
2518
|
+
align-items: center;
|
|
2519
|
+
gap: .25rem;
|
|
2520
|
+
padding-inline: .5rem;
|
|
2521
|
+
font-size: .75rem;
|
|
2522
|
+
line-height: 1.2;
|
|
2523
|
+
display: flex;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
[data-merge-conflict-action] {
|
|
2527
|
+
appearance: none;
|
|
2528
|
+
color: var(--diffs-fg-number);
|
|
2529
|
+
font: inherit;
|
|
2530
|
+
cursor: pointer;
|
|
2531
|
+
background: none;
|
|
2532
|
+
border: 0;
|
|
2533
|
+
padding: 0;
|
|
2534
|
+
font-style: normal;
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
[data-merge-conflict-action]:hover {
|
|
2538
|
+
color: var(--diffs-fg);
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
[data-merge-conflict-action="current"]:hover {
|
|
2542
|
+
color: var(--diffs-addition-base);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
[data-merge-conflict-action="incoming"]:hover {
|
|
2546
|
+
color: var(--diffs-modified-base);
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
[data-merge-conflict-action-separator] {
|
|
2550
|
+
color: var(--diffs-fg-number);
|
|
2551
|
+
opacity: .6;
|
|
2552
|
+
user-select: none;
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
[data-diffs-header="default"] {
|
|
2556
|
+
background-color: var(--diffs-bg);
|
|
2557
|
+
justify-content: space-between;
|
|
2558
|
+
align-items: center;
|
|
2559
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
2560
|
+
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
2561
|
+
z-index: 2;
|
|
2562
|
+
flex-direction: row;
|
|
2563
|
+
padding-inline: 16px;
|
|
2564
|
+
display: flex;
|
|
2565
|
+
position: relative;
|
|
2566
|
+
top: 0;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
[data-header-content] {
|
|
2570
|
+
align-items: center;
|
|
2571
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
2572
|
+
white-space: nowrap;
|
|
2573
|
+
flex-direction: row;
|
|
2574
|
+
min-width: 0;
|
|
2575
|
+
display: flex;
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
2579
|
+
text-overflow: ellipsis;
|
|
2580
|
+
white-space: nowrap;
|
|
2581
|
+
direction: rtl;
|
|
2582
|
+
min-width: 0;
|
|
2583
|
+
overflow: hidden;
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
[data-prev-name] {
|
|
2587
|
+
opacity: .7;
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
[data-rename-icon] {
|
|
2591
|
+
fill: currentColor;
|
|
2592
|
+
flex-grow: 0;
|
|
2593
|
+
flex-shrink: 0;
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
[data-diffs-header="default"] [data-metadata] {
|
|
2597
|
+
white-space: nowrap;
|
|
2598
|
+
align-items: center;
|
|
2599
|
+
gap: 1ch;
|
|
2600
|
+
display: flex;
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
[data-diffs-header="default"] [data-additions-count] {
|
|
2604
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
2605
|
+
color: var(--diffs-addition-base);
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
[data-diffs-header="default"] [data-deletions-count] {
|
|
2609
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
2610
|
+
color: var(--diffs-deletion-base);
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
[data-change-icon] {
|
|
2614
|
+
fill: currentColor;
|
|
2615
|
+
flex-shrink: 0;
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
2619
|
+
color: var(--diffs-modified-base);
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
[data-change-icon="new"] {
|
|
2623
|
+
color: var(--diffs-addition-base);
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
[data-change-icon="deleted"] {
|
|
2627
|
+
color: var(--diffs-deletion-base);
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
[data-change-icon="file"] {
|
|
2631
|
+
opacity: .6;
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
[data-annotation-content] {
|
|
2635
|
+
z-index: 2;
|
|
2636
|
+
isolation: isolate;
|
|
2637
|
+
align-self: flex-start;
|
|
2638
|
+
min-width: 0;
|
|
2639
|
+
display: flow-root;
|
|
2640
|
+
position: relative;
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
2644
|
+
width: var(--diffs-column-content-width, auto);
|
|
2645
|
+
left: var(--diffs-column-number-width, 0);
|
|
2646
|
+
position: sticky;
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
[data-annotation-slot] {
|
|
2650
|
+
text-wrap-mode: wrap;
|
|
2651
|
+
word-break: normal;
|
|
2652
|
+
white-space-collapse: collapse;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
[data-gutter-utility-slot] {
|
|
2656
|
+
touch-action: none;
|
|
2657
|
+
justify-content: flex-end;
|
|
2658
|
+
display: flex;
|
|
2659
|
+
position: absolute;
|
|
2660
|
+
top: 0;
|
|
2661
|
+
bottom: 0;
|
|
2662
|
+
right: 0;
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
[data-utility-button] {
|
|
2666
|
+
appearance: none;
|
|
2667
|
+
cursor: pointer;
|
|
2668
|
+
width: 1lh;
|
|
2669
|
+
height: 1lh;
|
|
2670
|
+
font-size: var(--diffs-font-size, 13px);
|
|
2671
|
+
line-height: var(--diffs-line-height, 20px);
|
|
2672
|
+
background-color: var(--diffs-modified-base);
|
|
2673
|
+
color: var(--diffs-bg);
|
|
2674
|
+
fill: currentColor;
|
|
2675
|
+
z-index: 4;
|
|
2676
|
+
touch-action: none;
|
|
2677
|
+
border: none;
|
|
2678
|
+
border-radius: 4px;
|
|
2679
|
+
justify-content: center;
|
|
2680
|
+
align-items: center;
|
|
2681
|
+
margin-right: calc(-1lh + 1ch);
|
|
2682
|
+
padding: 0;
|
|
2683
|
+
display: flex;
|
|
2684
|
+
position: relative;
|
|
2685
|
+
|
|
2686
|
+
&:before {
|
|
2687
|
+
content: "";
|
|
2688
|
+
display: block;
|
|
2689
|
+
position: absolute;
|
|
2690
|
+
inset: 0 0 0 -4px;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
[data-decoration-bar-stack] {
|
|
2695
|
+
pointer-events: none;
|
|
2696
|
+
isolation: isolate;
|
|
2697
|
+
z-index: 1;
|
|
2698
|
+
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
2699
|
+
box-sizing: content-box;
|
|
2700
|
+
border-left: 2px solid var(--diffs-bg);
|
|
2701
|
+
border-right: 2px solid var(--diffs-bg);
|
|
2702
|
+
width: 6px;
|
|
2703
|
+
position: absolute;
|
|
2704
|
+
top: 0;
|
|
2705
|
+
bottom: 0;
|
|
2706
|
+
right: -2px;
|
|
2707
|
+
|
|
2708
|
+
[data-decoration-bar-depth="1"] & {
|
|
2709
|
+
background-color: color-mix(in lab,
|
|
2710
|
+
var(--diffs-bg) 20%,
|
|
2711
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
[data-decoration-bar-depth="2"] & {
|
|
2715
|
+
background-color: color-mix(in lab,
|
|
2716
|
+
var(--diffs-bg) 45%,
|
|
2717
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
[data-decoration-bar-depth="3"] & {
|
|
2721
|
+
background-color: color-mix(in lab,
|
|
2722
|
+
var(--diffs-bg) 65%,
|
|
2723
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
[data-decoration-bar-start] & {
|
|
2727
|
+
border-top-left-radius: 5px;
|
|
2728
|
+
border-top-right-radius: 5px;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
[data-decoration-bar-end] & {
|
|
2732
|
+
z-index: 3;
|
|
2733
|
+
border-bottom-right-radius: 5px;
|
|
2734
|
+
border-bottom-left-radius: 5px;
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
[data-placeholder] {
|
|
2739
|
+
contain: strict;
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
[data-error-wrapper] {
|
|
2743
|
+
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
2744
|
+
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
2745
|
+
scrollbar-width: none;
|
|
2746
|
+
max-height: 400px;
|
|
2747
|
+
overflow: auto;
|
|
2748
|
+
|
|
2749
|
+
& [data-error-message] {
|
|
2750
|
+
color: var(--diffs-deletion-base);
|
|
2751
|
+
font-size: 18px;
|
|
2752
|
+
font-weight: bold;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
& [data-error-stack] {
|
|
2756
|
+
color: var(--diffs-fg-number);
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
@layer theme, rendered, unsafe;
|
|
2762
|
+
`,$v=`@layer base, theme, rendered, unsafe;`,ey=RegExp(`${iy(Bm)}\\s*:\\s*[^;]+;`);function ty(e){return`${$v}
|
|
2763
|
+
@layer unsafe {
|
|
2764
|
+
${e}
|
|
2765
|
+
}`}function ny(e,t=`system`,n){return`${$v}
|
|
2766
|
+
@layer rendered {
|
|
2767
|
+
:host {${t===`system`?``:`
|
|
2768
|
+
color-scheme: ${t};`}
|
|
2769
|
+
${Zv(n)}
|
|
2770
|
+
${e}
|
|
2771
|
+
}
|
|
2772
|
+
}`}function ry(e,t){let n=Zv(t);return e.replace(ey,n)}function iy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ay(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function oy({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function sy({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=cy(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function cy(){let e=document.createElement(`style`);return e.setAttribute(Lm,``),e}function ly(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function uy(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.tabIndex=0,e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(Qv)),t.adoptedStyleSheets=[e]}connectedCallback(){Xv(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(wm,t)}var dy=[``],fy=-1,py=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++fy}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(e={theme:Y},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new zv(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new bv,this.interactionManager=new tv(`file`,nv(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(nv(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!eh(this.appliedThemeCSS.theme,this.options.theme??Y)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,e===`wrap`),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.annotationCache.clear(),this.pre=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0,this.unsafeCSSStyle=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1,this.editor?.cleanUp(),this.editor=void 0}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;this.hydrateElements(t,n),my(this.pre,i,this.options.collapsed)||hy(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),ly(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(ay(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?dy:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.file;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(r=>{e.__syncRenderView(r,t,n,this.lineAnnotations,this.renderRange)})}attachEditor(e){return this.editor?.cleanUp(),this.editor=e,this.interactionManager.setEditorAttached(!0),this.syncRenderViewToEditor(),()=>{this.editor=void 0,this.interactionManager.setEditorAttached(!1)}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t){this.fileRenderer.updateRenderCache(e,t)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);this.editor?.__postponeBackgroundTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)&&o!==this.lineAnnotations,m=!th(this.file,e);if(!c&&!n&&Tv(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(ay(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,Gm);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.managersDirty=!0,a||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{file:e,workerManager:t}=this;e==null||e.cacheKey==null||t==null||og(e)||this.fileRenderer.getOrCreateLineCache(e).length>(this.options.tokenizeMaxLength??1e5)||t.primeFileHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${Km(r)}`,a=this.annotationCache.get(i);if(a==null||!Hv(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Kv(Km(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=qv();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Jv(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=ty(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??Y,s=typeof o==`string`?o:{...o},c=Xv(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=sy({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:ny(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=ry(this.themeCSSStyle.textContent??``,Xv(e)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=oy({code:this.code});let n=this.fileRenderer.renderCodeAST(e);if(this.code.childElementCount>=2)for(let e=0;e<2;e++){let t=this.code.children[e],r=n[e];t.innerHTML=a(r.children),t.style.cssText=r.properties.style}else this.code.innerHTML=a(n);t.contains(this.code)||t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l||!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))return!1;let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??a(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:o,renderCustomHeader:s,renderHeaderMetadata:c}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Im,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=o?.(n)??void 0,a=c?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Nm,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Pm,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Fm,a),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:J_(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):J_(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Vv;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};Uv(i,this.appliedPreAttributes)||(uy(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function my(e,t,n=!1){return!n&&e==null&&t!=null}function hy(e,t,n=!1){return e==null&&t!=null&&!n}var gy=5e3,_y=-1;function vy(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var yy=class extends py{virtualizer;metrics;__id=`virtualized-file:${++_y}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=Hm,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&z_(this.metrics,e)||(this.metrics=e,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!B_(t,e),r=vy(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;let n=this.code.children[1];if(!(n instanceof HTMLElement))return e;let r=X_(this.lineAnnotations);if(this.renderRange!=null&&r&&Q_(this.renderRange)){let t=by(n)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!r&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let r=Number(n),i=t.getBoundingClientRect().height,a=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(a=!0),i+=t.nextElementSibling.getBoundingClientRect().height);let o=this.getLineHeight(r,a);i!==o&&(e=!0,i===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(r):this.cache.heights.set(r,i))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));prepareCodeViewItem(e,t,n,r){let i=this.syncLineAnnotations(r),a=n?.resetFileLayoutCache===!0||i;n?.metrics!=null&&(this.metrics=n.metrics,a=!0);let{collapsed:o=!1}=this.options;return this.currentCollapsed!==o&&(this.currentCollapsed=o,a=!0),a&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;let{disableFileHeader:t=!1,collapsed:n=!1}=this.options,r=this.fileRenderer.getLineCount(this.file)-1,i=Xg(this.metrics,t);if(n||r<0)return{top:i,height:0};let a=Math.min(Math.max(e-1,0),r),{overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics;if(i+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())return{top:i+a*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(a);i=c?.top??i;for(let e=c?.lineIndex??0;e<a;e++)i+=this.getLineHeight(e,!1);return{top:i,height:this.getLineHeight(a,!1)}}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;let{disableFileHeader:t=!1,collapsed:n=!1,overflow:r=`scroll`}=this.options;if(n||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(this.file)-1;if(i<0)return;let a=Xg(this.metrics,t),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(r===`scroll`&&!this.hasLineAnnotations()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.file,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.file==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1,overflow:a=`scroll`}=this.options,{lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(this.file),c=Xg(this.metrics,r),l=Qg(this.metrics);if(this.height+=c,i){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,a===`scroll`&&!this.hasLineAnnotations())this.height+=s*o;else for(let e=0;e<s;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(s>0&&(this.height+=l),this.fileContainer!=null&&t&&!n){let e=this.fileContainer.getBoundingClientRect();e.height!==this.height&&(this.file.name,e.height,this.height)}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{heights:r,checkpoints:i}=this.cache,a=this.renderRange;if(super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.layoutDirty=!0,r.size>0&&r.clear(),i.length>0&&(i.length=0),this.isSimpleMode()&&this.computeApproximateSize(),n&&a!==void 0&&this.file!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.file,this.top??0,e);t.bufferAfter!==a.bufferAfter&&this.updateBuffers(t)}}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=this.file==null||!th(this.file,t),{forceRenderOverride:o,isSetup:s}=this;this.forceRenderOverride=void 0;let c=this.syncLineAnnotations(r);if(c&&this.resetLayoutCache(),this.file=t,e=this.getOrCreateFileContainerNode(e),this.file==null)return console.error(`VirtualizedFile.render: attempting to virtually render when we dont have file`),!1;if(s)this.top??=this.getVirtualizedTop(),a&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!0));else{this.computeApproximateSize();let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);let l=this.virtualizer.getWindowSpecs(),u=this.top??0,d=this.computeRenderRangeFromWindow(this.file,u,l);return super.render({file:this.file,fileContainer:e,renderRange:d,lineAnnotations:r,forceRender:(o??n)||c,...i})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%gy===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,overflow:a=`scroll`}=this.options,{hunkLineCount:o,lineHeight:s}=this.metrics,c=this.fileRenderer.getLineCount(e),l=this.height,u=Xg(this.metrics,i),d=c>0?Qg(this.metrics):0,{fileAnnotationHeight:f}=this.cache,p=u+f,m=Math.max(0,l-u-f-d),h=X_(this.lineAnnotations),g=t+u,_=f>0&&h&&g<r&&g+f>n;if(t<n-l||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d};if(c<=o)return{startingLine:0,totalLines:o,bufferBefore:0,bufferAfter:0};let v=Math.ceil(Math.max(r-n,0)/s),y=Math.ceil(v/o)*o+o*2,b=y/o,x=(n+r)/2;if(a===`scroll`&&!this.hasLineAnnotations()){let e=t+p,i=e+m;if(!_&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d};let a=Math.floor(_&&x<t+p?0:(x-(t+p))/s),h=Math.floor(a/o)-Math.floor(b/2),g=Math.ceil(c/o),v=Math.max(0,Math.min(h,g))*o,S=h<0?y+h*o:y,C=v===0?0:f+v*s,w=Math.min(S,c-v);return{startingLine:v,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(c-v-w)*s)}}let S=b,C=[],w=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-y*s*2),o),T=t+(w?.top??p),E=w?.lineIndex??0,D,O,k,A=w?.lineIndex??0;for(let e=A;e<c;e++){let i=E%o===0,a=Math.floor(E/o);if(i&&(C[a]=T-(t+p),k!=null)){if(k<=0)break;k--}let s=this.getLineHeight(e,!1);T>n-s&&T<r&&(D??=a),T+s>x&&(O??=a),k==null&&T>=r&&i&&(k=S),E++,T+=s}if(D==null)if(_)D=0,O=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d};O??=D;let j=Math.round(O-b/2),M=Math.max(0,Math.ceil(c/o)-b),N=Math.max(0,Math.min(j,M)),ee=N*o,te=j<0?y+j*o:y,ne=C[N]??0,re=ee===0?0:f+ne,ie=N+te/o,ae=ie<C.length?m-C[ie]:m-(T-t-p);return{startingLine:ee,totalLines:te,bufferBefore:re,bufferAfter:Math.max(0,ae)}}};function by(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Y_&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function xy({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o}){let s=Xg(t,n),c=s,l=i?!0:a,u=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=e_({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:l,hunkIndex:n,collapsedContextThreshold:o}),d=(a.fromStart+a.fromEnd)*t.lineHeight;if(s+=d,c+=d,a.collapsedLines>0){let e=c_({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;s+=e,c+=e}s+=i.splitLineCount*t.lineHeight,c+=i.unifiedLineCount*t.lineHeight;let f=Sy(i);s+=f.split*t.lineHeight,c+=f.unified*t.lineHeight;let p=n===u?r_({fileDiff:e,hunkIndex:n,expandedHunks:l,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(p!=null){let e=(p.fromStart+p.fromEnd)*t.lineHeight;if(s+=e,c+=e,p.collapsedLines>0){let e=l_({type:r,metrics:t})?.totalHeight??0;s+=e,c+=e}}}if(e.hunks.length>0){let e=Qg(t);s+=e,c+=e}return{splitHeight:s,unifiedHeight:c}}function Sy(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return Cy(e,t)}function Cy(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var wy=new TextEncoder,Ty=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ey=/[\uD800-\uDFFF]/,Dy=1024,Oy=new Uint8Array(Dy);function ky(){Oy.length!==Dy&&(Oy=new Uint8Array(Dy))}function $(e){if(e.length===0)return e;if(Ey.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Oy.length<t&&(Oy=new Uint8Array(t));let{written:n}=wy.encodeInto(e,Oy);return Ty.decode(Oy.subarray(0,n))}function Ay(e,t,n){try{return jy(e,t,n)}finally{ky()}}function jy(e,t,n=!1){let r=Yy(e),i=r?Ry(e):zy(e),a,o=[];for(let e of i){if(r&&!Em.test(e)){if(a==null)a=$(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}if(!r&&!By(e)){if(a==null)a=$(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=Ny(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function My(e,t){try{return Ny(e,t)}finally{ky()}}function Ny(e,{cacheKey:t,isGitDiff:n=Em.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=Xy(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Ly(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Ky(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?Iy(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Iy(r.contents):[],cacheKey:Qy(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(jm),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=$(r.trim()),n!==r&&(c.prevName=$(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Am:km):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=$(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=$(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=$(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=$(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=$(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=$(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Mm)??[];t!=null&&(c.prevObjectId=$(t)),n!=null&&(c.newObjectId=$(n)),r!=null&&(c.mode=$(r))}e.startsWith(`rename from `)&&(c.prevName=$(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=$(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
2773
|
+
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
2774
|
+
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:Qy(p.hunkContext),hunkSpecs:$(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&Wy(t)&&!Gy(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=$y(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=eb(t);(g==null||g.type!==`change`)&&(g=tb(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=eb(t);(g==null||g.type!==`change`)&&(g=tb(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=eb(t);(g==null||g.type!==`context`)&&(g=tb(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=__(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=__(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(b.additionStart-1-o,0),c.hunks.push(b),o=b.additionStart+b.additionCount-1;for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=e.additionStart+e.additionCount-1,n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),c}}function Py(e,t,n=!1){let r=[],i=Fy(e)?e.split(Tm):[e];for(let e of i)try{r.push(Ay(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function Fy(e){return e.startsWith(`From `)||e.includes(`
|
|
2775
|
+
From `)}function Iy(e){let t=Ly(e);for(let e=0;e<t.length;e++)t[e]=$(t[e]);return t}function Ly(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
2776
|
+
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function Ry(e){return Xy(e,`diff --git`)}function zy(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=Uy(e,r);if(i<=0&&a<=0){if(Vy(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=Uy(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=Ky(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function By(e){return Vy(e,0)}function Vy(e,t){let n=Uy(e,t);return Hy(e,t,`---`)&&Hy(e,n,`+++`)}function Hy(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
|
|
2777
|
+
`||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function Uy(e,t){let n=e.indexOf(`
|
|
2778
|
+
`,t);return n===-1?e.length:n+1}function Wy(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Gy(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
2779
|
+
`&&n!==`\r`)return!1}return!0}function Ky(e){if(!e.startsWith(`@@ -`))return;let t=4,n=qy(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=qy(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=qy(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=qy(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=Jy(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function qy(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function Jy(e){return e.endsWith(`\r
|
|
2780
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
2781
|
+
`)?e.slice(0,-1):e}function Yy(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
2782
|
+
diff --git`)}function Xy(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:Zy(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=Zy(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function Zy(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Qy(e){return e==null?e:$(e)}function $y(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function eb(e){let t=e.slice(1);return $(t===``?`
|
|
2783
|
+
`:t)}function tb(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function nb(e,t,n,r=!1){let i=My(l(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(i==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return t.lang!=null&&(i.lang=t.lang),i}var rb=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function ib(e){return Q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ab(e){return Q({tagName:`div`,children:[Q({tagName:`span`,children:[dg(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function ob(e){return Q({tagName:`div`,children:[fg({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function sb({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(Q({tagName:`div`,children:[dg(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(ob(`up`)),s++),o||(e.push(ob(`down`)),s++)):(e.push(ob(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(Q({tagName:`div`,children:[Q({tagName:`span`,children:[dg(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(Q({tagName:`div`,children:[dg(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(Q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(Q({tagName:`slot`,properties:{name:i}})),Q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function cb(e,t){return`hunk-separator-${e}-${t}`}function lb(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function ub(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function db(e){return e===``?[]:e.split(Om)}function fb(e,t){let n=nb({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function pb(e,t){let n=e.deletionLines.join(``),r=n===`
|
|
2784
|
+
`?`
|
|
2785
|
+
`:`
|
|
2786
|
+
`,i=nb({name:e.prevName??e.name,contents:n},{name:e.name,contents:r,lang:e.lang},t);return{hunks:i.hunks,splitLineCount:i.splitLineCount,unifiedLineCount:i.unifiedLineCount,additionLines:[``],deletionLines:i.deletionLines,type:i.type}}function mb(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return hb(e,fb(e,n));let r=Array.from(t);if(r.length===0)return hb(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||__(r)===__(i))return hb(e,fb(e,n))}let i=gb(e,r);if(i.size===0)return hb(e,fb(e,n));for(let t of i)if(!vb(e,t,n))return hb(e,fb(e,n));return Cb(e),t_(e)?hb(e,fb(e,n)):hb(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function hb(e,t){return Object.assign(e,t),t}function gb(e,t){let n=new Set;for(let r of t){let t=_b(e,r);if(t==null)return new Set;n.add(t)}return n}function _b(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function vb(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=nb({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(bb(r,s),yb(e,t),!0)}function yb(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
2787
|
+
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
2788
|
+
`)}function bb(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>xb(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,Sb(e)}function xb(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function Sb(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function Cb(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(i.additionStart-1-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,Sb(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=i.additionStart+i.additionCount-1;if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-(r.additionLineIndex+r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var wb=-1,Tb=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++wb}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:Y},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Dv(e.theme??Y)?Yh():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}getRenderDiff(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Um}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return;let{result:r,diff:i}=this.renderCache;if(r==null)return;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[];for(let[n,r]of e){let e=a[n]?.properties??{},s=r.map(e=>e[2]).join(``),c=n<i.additionLines.length,l=c?i.additionLines[n]??``:``,u=__(l);c&&(i.additionLines[n]=Fb(l,s),u!==s&&o.push(n)),a[n]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??n+1,"data-line-index":e[`data-line-index`]??n,"data-line-type":e[`data-line-type`]??`context`},children:r.map(([e,n,r])=>e===0&&n===``?r===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:r}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`--diffs-token-${t}:${n};`},children:[{type:`text`,value:r}]})}}!n&&o.length>0&&Object.assign(i,mb(i,o,this.options.parseDiffOptions)),r.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;t.additionLines=db(e.getText());let r=t.additionLines.length,i=n.code.additionLines,a=i.length;r<a&&(i.length=r);for(let t=a;t<r;t++)i[t]??=Pb(t,e);t.isPartial||(r===0?(Object.assign(t,pb(t,this.options.parseDiffOptions)),i[0]=Pb(0,e)):Object.assign(t,fb(t,this.options.parseDiffOptions))),this.renderCache.isDirty=!0}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>Ov(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=Y,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=Vm,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await Jh(Iv(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Ib(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!qg(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!Jg(e),options:t,result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??rg(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:Lv(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Kg(e,n.diff)||!qg(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Wm){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||Jg(e)||Ib(e,this.getTokenizeMaxLength()),l=!Kg(e,this.renderCache.diff),u=!Tv(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,ub(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??rg(e.name);let t=this.highlighter!=null&&Dv(i.theme),n=this.highlighter!=null&&Ev(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Wm){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Pv({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Ib(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??rg(e.name);let n=this.highlighter!=null&&Dv(this.options.theme??Y),r=t||this.highlighter!=null&&Ev(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:x_(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!this.renderCache.highlighted||!qg(this.renderCache.options,n)||!Kg(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!qg(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Kg(e,n.diff)&&qg(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=[],m=[],h=[],g=[],{additionLines:_,deletionLines:v}=n,y={rowCount:0,hunkSeparators:u,additionsContentAST:p,deletionsContentAST:m,unifiedContentAST:h,unifiedGutterAST:mg(),deletionsGutterAST:mg(),additionsGutterAST:mg(),expansionLineCount:c,hunkData:g,incrementRowCount(e=1){y.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:y.unifiedGutterAST.children.push(t);break;case`deletions`:y.deletionsGutterAST.children.push(t);break;case`additions`:y.additionsGutterAST.children.push(t)}}},b=n_({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),x={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(y.pushToGutter(`additions`,gg(void 0,`buffer`,this.size)),p?.push(ib(this.size))):(y.pushToGutter(`deletions`,gg(void 0,`buffer`,this.size)),m?.push(ib(this.size))),this.size=0,this.side=void 0}}},S=(e,t,n,r,i)=>{y.pushToGutter(e,hg(t,n,r,i))};function C(e){x.flush(),a===`unified`?Mb(`unified`,e,y):(Mb(`deletions`,e,y),Mb(`additions`,e,y))}this.pushFileLevelAnnotations(e,a,t,y),u_({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&x.flush(),r>0&&C({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let p=a===`unified`?f:l,m={type:c,hunkIndex:t,lineIndex:p,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(m);n?.before!=null&&kb(n.before,y);let r=s==null?void 0:v[s.lineIndex],i=o==null?void 0:_[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});S(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Nb(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Nb(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),jb({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,p),createAnnotationElement:e=>this.createAnnotationElement(e),context:y}),n?.after!=null&&kb(n.after,y)}else{let n=this.getSplitInjectedRowsForLine?.(m);n?.before!=null&&Ab(n.before,y,x);let r=s==null?void 0:v[s.lineIndex],i=o==null?void 0:_[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();if(f!=null){if(x.side!=null&&x.side!==f)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);x.side=f,x.increment()}let h=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,p);if(h!=null&&x.size>0&&x.flush(),s!=null){let e=Nb(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);S(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Nb(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);S(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}jb({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...h,createAnnotationElement:e=>this.createAnnotationElement(e),context:y}),n?.after!=null&&Ab(n.after,y,x)}let h=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,g=h?n.noEOFCRDeletions:!1,w=h?n.noEOFCRAdditions:!1,T=(s?.noEOFCR??!1)||g,E=(o?.noEOFCR??!1)||w;if(E||T){if(a===`split`&&x.flush(),T){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(y.unifiedContentAST.push(ab(e)),y.pushToGutter(`unified`,gg(e,`metadata`,1))):(y.deletionsContentAST.push(ab(e)),y.pushToGutter(`deletions`,gg(e,`metadata`,1)),E||(y.pushToGutter(`additions`,gg(void 0,`buffer`,1)),y.additionsContentAST.push(ib(1))))}if(E){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(y.unifiedContentAST.push(ab(e)),y.pushToGutter(`unified`,gg(e,`metadata`,1))):(y.additionsContentAST.push(ab(e)),y.pushToGutter(`additions`,gg(e,`metadata`,1)),T||(y.pushToGutter(`deletions`,gg(void 0,`buffer`,1)),y.deletionsContentAST.push(ib(1))))}y.incrementRowCount(1)}i>0&&u!==`simple`&&C({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:b,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),y.incrementRowCount(1)}}),a===`split`&&x.flush();let w=Math.max(lb(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),T=t.bufferBefore>0||t.bufferAfter>0,E=!f&&e.type!==`deleted`,D=!f&&e.type!==`new`,O=y.rowCount>0||T;p=E&&O?p:void 0,m=D&&O?m:void 0,h=f&&O?h:void 0;let k=this.createPreElement(m!=null&&p!=null,w);return{unifiedGutterAST:f&&O?y.unifiedGutterAST.children:void 0,unifiedContentAST:h,deletionsGutterAST:D&&O?y.deletionsGutterAST.children:void 0,deletionsContentAST:m,additionsGutterAST:E&&O?y.additionsGutterAST.children:void 0,additionsContentAST:p,hunkData:g,preNode:k,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:w,rowCount:y.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=mg(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,kv(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(Q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(Q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(Q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return a(this.renderFullAST(e,t))}renderPartialHTML(e,t){return a(t==null?e:Q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!Q_(n))return;let i=e.type===`new`?[]:Eb(Z_(this.deletionAnnotations)),a=e.type===`deleted`?[]:Eb(Z_(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){jb({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}jb({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(Km(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(Km(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return jv({fileOrDiff:e,mode:t,stickyHeader:n})}};function Eb(e){return e?.map(e=>Km(e))??[]}var Db=new Intl.PluralRules(`en-US`);function Ob(e){return`${e} unmodified line${Db.select(e)===`one`?``:`s`}`}function kb(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Ab(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function jb({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,gg(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,gg(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,gg(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Mb(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,sb({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(sb({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,sb({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(sb({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=cb(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,sb({type:c.hunkSeparators,content:Ob(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(sb({type:c.hunkSeparators,content:Ob(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Nb(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Pb(e,t){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${e},${e}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t.getLineText(e)}]}]}}function Fb(e,t){return e.endsWith(`\r
|
|
2789
|
+
`)?t+`\r
|
|
2790
|
+
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
2791
|
+
`)?t+`
|
|
2792
|
+
`:t}function Ib(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Lb(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Rb(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function zb(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var Bb=-1,Vb=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Bb}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;fastRefreshTimeout;constructor(e={theme:Y},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new bv,this.scrollSyncManager=new rb,this.interactionManager=new tv(`diff`,nv(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return zb(e)}createHunksRenderer(e){return new Tb(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.hunksRenderer.getRenderDiff()??this.fileDiff;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=o.splitLineStart,l=o.unifiedLineStart;if(e<n){let t=n-e;i=Math.max(l-t,0),a=Math.max(c-t,0);break hunkIterator}if(e>=n+s){if(o===r){let t=e-(n+s);i=l+o.unifiedLineCount+t,a=c+o.splitLineCount+t;break hunkIterator}continue}for(let r of o.hunkContent)if(r.type===`context`)if(e<n+r.lines){let t=e-n;a=c+t,i=l+t;break hunkIterator}else n+=r.lines,c+=r.lines,l+=r.lines;else{let o=t===`deletions`?r.deletions:r.additions;if(e<n+o){let o=e-n;i=l+(t===`additions`?r.deletions:0)+o,a=c+o;break hunkIterator}n+=o,c+=Math.max(r.deletions,r.additions),l+=r.deletions+r.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(nv(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!eh(this.appliedThemeCSS.theme,this.options.theme??Y)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,t===`wrap`),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1,this.editor?.cleanUp(),this.editor=void 0,this.fastRefreshTimeout!=null&&(clearTimeout(this.fastRefreshTimeout),this.fastRefreshTimeout=void 0)}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.hydrateElements(t,n),Wb(this.pre,Hb({fileDiff:s,oldFile:a,newFile:o}),this.options.collapsed)||Gb(this.headerElement,Ub({fileDiff:s,oldFile:a,newFile:o}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:a,newFile:o,lineAnnotations:i}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),ly(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?nb(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,deferManagers:r=!1,forceRender:i=!1,preventEmit:a=!1,lineAnnotations:o,fileContainer:s,containerWrapper:c,renderRange:l}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);this.editor?.__postponeBackgroundTokenizeToNextFrame();let{collapsed:u=!1,themeType:d=`system`}=this.options,f=u?void 0:l,p=this.hasThemeChanged(),m=e!=null&&t!=null&&(!th(e,this.deletionFile)||!th(t,this.additionFile)),h=n!=null&&n!==this.fileDiff,g=o!=null&&(o.length>0||this.lineAnnotations.length>0)&&o!==this.lineAnnotations;if(!u&&Tv(f,this.renderRange)&&!i&&!g&&!p&&(n!=null&&n===this.fileDiff||n==null&&!m))return this.applyCachedThemeState(d);let{renderRange:_}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&m&&(h=!0,this.fileDiff=nb(e,t,this.options.parseDiffOptions)):this.fileDiff=n,h&&(this.cachedHeaderHTML=void 0),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:v=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,c),this.applyCachedThemeState(d),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,Gm);e!=null&&this.applyThemeState(s,e.themeStyles,d,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(s);if(!(this.canPartiallyRender(i,g,m||h||p)&&this.applyPartialRender({previousRenderRange:_,renderRange:f}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(s,t.themeStyles,d,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,s),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,r||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiff;e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(r=>{e.__syncRenderView(r,t,n,this.lineAnnotations,this.renderRange)})}attachEditor(e){return this.editor?.cleanUp(),this.editor=e,this.interactionManager.setEditorAttached(!0),this.syncRenderViewToEditor(),()=>{this.editor=void 0,this.interactionManager.setEditorAttached(!1)}}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.getRenderDiff();n!=null&&(this.fileDiff=n),this.rerender(),this.interactionManager.setSelectionDirty(),t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}rerenderFromDocument(e){this.hunksRenderer.applyDocumentChange(e);let t=this.hunksRenderer.getRenderDiff();t!=null&&(this.fileDiff=t),this.hunksRenderer.clearRenderCache(),this.rerender()}updateRenderCache(e,t,n,r){this.hunksRenderer.updateRenderCache(e,t,r),n===!0&&(this.options.diffStyle===`split`?(this.fastRefreshTimeout!=null&&clearTimeout(this.fastRefreshTimeout),this.fastRefreshTimeout=setTimeout(()=>{this.fastRefreshTimeout=void 0,this.fastRefreshDiffView()},100)):this.refreshDiffView())}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{fileDiff:e,workerManager:t}=this;if(e==null||t==null||Jg(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Rb(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${Km(r)}`,a=this.annotationCache.get(i);if(a==null||!Lb(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Kv(Km(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=qv();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:J_(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):J_(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Vv;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??a(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:o,renderHeaderFilenameSuffix:s,renderHeaderMetadata:c}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Im,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let l=o?.(n)??void 0,u=s?.(n)??void 0,d=c?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Nm,l),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Pm,u),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Fm,d),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Jv(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=ty(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??Y,s=typeof o==`string`?o:{...o},c=Xv(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=sy({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:ny(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=ry(this.themeCSSStyle.textContent??``,Xv(e)))}applyHunksToDOM(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=oy({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=oy({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=oy({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}fastRefreshDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=Kb(r?.[0]),a=Kb(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshDiffView(){let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(this.options.diffStyle??`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null)return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=Kb(r?.[0]),o=Kb(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,o]])t!=null&&(e.innerHTML=a(t))};Array.isArray(t)?(n(`deletions`,t[0]),n(`additions`,t[1])):n(`unified`,t),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Kb(t[0]),i=Kb(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,r){function i(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};Uv(u,this.appliedPreAttributes)||(uy(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Hb({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ub({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Wb(e,t,n=!1){return!n&&e==null&&t}function Gb(e,t,n=!1){return e==null&&t&&!n}function Kb(e){if(e!=null&&e.type===`element`)return e.children??[]}var qb=5e3,Jb=-1,Yb=class extends Vb{__id=`little-virtualized-file-diff:${++Jb}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=Yg(n)}setMetrics(e,t=!1){let n=Yg(e);!t&&z_(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!X_(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!B_(t,e),r=n&&rx(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:ix(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&Q_(this.renderRange)){let t=Xb(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=ox(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());prepareCodeViewItem(e,t,n,r){let i=!Kg(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=Yg(n.metrics),o=!0,s=!0);let{collapsed:c=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=Xg(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return u_({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=c_({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=l_({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??Xg(this.metrics,t)+this.cache.fileAnnotationHeight,l;return u_({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=c_({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=l_({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)};setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let r=this.renderRange;if(super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0}),n&&r!==void 0&&this.fileDiff!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,this.fileDiff==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1}=this.options,a=Xg(this.metrics,r);if(this.height+=a,i){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight(),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();let e=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(e==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return e}ensureEstimatedDiffHeights(){if(this.fileDiff==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:r,unifiedHeight:i}=xy({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=r,this.cache.estimatedUnifiedHeight=i}validateComputedHeight(){if(this.fileContainer==null||this.fileDiff==null)return;let e=this.fileContainer.getBoundingClientRect();e.height!==this.height&&(this.fileDiff.name,e.height,this.height)}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,forceRender:i=!1,lineAnnotations:a,...o}={}){let{forceRenderOverride:s,isSetup:c}=this;this.forceRenderOverride=void 0;let l=this.syncLineAnnotations(a);if(l&&this.resetLayoutCache({includeEstimatedHeights:!1}),this.fileDiff??=r??(t!=null&&n!=null?nb(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(c)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);let u=this.virtualizer.getWindowSpecs(),d=this.top??0,f=this.computeRenderRangeFromWindow(this.fileDiff,d,u);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:f,oldFile:t,newFile:n,lineAnnotations:a,forceRender:(s??i)||l,...o})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return ax(this.options.hunkSeparators)}approximateLayoutCheckpoints(){if(this.cache.checkpoints.length>0||this.fileDiff==null||this.fileDiff.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,r=this.fileDiff.hunks.length-1,i=this.getDiffStyle(),a=this.getHunkSeparatorType(),o=t?!0:this.hunksRenderer.getExpandedHunksMap(),s=Zb(this.cache.heightDeltas),c=Xg(this.metrics,e)+this.cache.fileAnnotationHeight,l=0,u=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=l,o=l+e,u=ex(a);for(;u<o;){let e=u-a,r=c+(e>0?n:0)+e*this.metrics.lineHeight+tx(i,e)*this.metrics.lineHeight+Qb(s,t,t+e);this.cache.checkpoints.push({renderedLineIndex:u,lineIndex:t+e,top:r}),u+=qb}c+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Qb(s,t,t+e)+r,l=o};for(let e=0;e<this.fileDiff.hunks.length;e++){let t=this.fileDiff.hunks[e];if(t==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let s=e_({isPartial:this.fileDiff.isPartial,rangeSize:t.collapsedBefore,expandedHunks:o,hunkIndex:e,collapsedContextThreshold:n}),c=s.collapsedLines>0?c_({type:a,metrics:this.metrics,hunkIndex:e,hunkSpecs:t.hunkSpecs})?.totalHeight??0:0;u({rowCount:s.fromStart,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.rangeSize});let l=c;u({rowCount:s.fromEnd,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.fromEnd,preSeparatorHeight:l}),s.fromEnd>0&&(l=0);let d=e===r?r_({fileDiff:this.fileDiff,hunkIndex:e,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:`VirtualizedFileDiff`}):void 0,f=d!=null&&d.collapsedLines>0?l_({type:a,metrics:this.metrics})?.totalHeight??0:0,p=d==null?0:d.fromStart+d.fromEnd,m=i===`split`?t.splitLineCount:t.unifiedLineCount,h=i===`split`?t.splitLineStart:t.unifiedLineStart;u({rowCount:m,startLineIndex:h,preSeparatorHeight:l,postSeparatorHeight:p===0?f:0,metadataOffsets:nx({diffStyle:i,hunk:t,rowCount:m})}),d!=null&&p>0&&u({rowCount:p,startLineIndex:h+m,postSeparatorHeight:f})}this.cache.totalLines=l}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=e_({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=r_({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=this.height,f=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,l),p=Xg(this.metrics,i),m=e.hunks.length>0?Qg(this.metrics):0,{fileAnnotationHeight:h}=this.cache,g=p+h,_=Math.max(0,d-p-h-m),v=this.hasFileAnnotations(e),y=t+p,b=h>0&&v&&y<r&&y+h>n;if(t<n-d||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};if(f<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),f=this.cache.totalLines>0?this.cache.totalLines:f;let x=Math.ceil(Math.max(r-n,0)/c),S=Math.ceil(x/s)*s+s,C=S/s,w=C,T=[],E=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*c*2),s),O=t+(D?.top??g),k=D?.renderedLineIndex??0,A,j,M;if(u_({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:i,collapsedBefore:a,collapsedAfter:o,deletionLine:c,additionLine:d})=>{let f=d==null?c.splitLineIndex:d.splitLineIndex,p=d==null?c.unifiedLineIndex:d.unifiedLineIndex,m=(d?.noEOFCR??!1)||(c?.noEOFCR??!1),h=(a>0?c_({type:u,metrics:this.metrics,hunkIndex:e,hunkSpecs:i?.hunkSpecs}):void 0)?.totalHeight??0;O+=h;let _=k%s===0,v=Math.floor(k/s);if(_&&(T[v]=O-(t+g+h),M!=null)){if(M<=0)return!0;M--}let y=this.getLineHeight(l===`split`?f:p,m);return O>n-y&&O<r&&(A??=v),j==null&&O+y>E&&(j=v),M==null&&O>=r&&_&&(M=w),k++,O+=y,o>0&&(O+=l_({type:u,metrics:this.metrics})?.totalHeight??0),!1}}),A==null)if(b)A=0,j=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};j??=A;let N=Math.round(j-C/2),ee=Math.max(0,Math.ceil(f/s)-C),te=Math.max(0,Math.min(N,ee)),ne=te*s,re=N<0?S+N*s:S,ie=T[te]??0,ae=ne===0?0:h+ie,oe=te+re/s,se=oe<T.length?_-T[oe]:_-(O-t-g);return{startingLine:ne,totalLines:re,bufferBefore:ae,bufferAfter:Math.max(0,se)}}};function Xb(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Y_&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Zb(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function Qb({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=$b(e,n);return(t[$b(e,r)]??0)-(t[i]??0)}function $b(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function ex(e){return Math.ceil(e/qb)*qb}function tx(e,t){let n=0;for(let r of e)r<t&&n++;return n}function nx({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function rx(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function ix(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function ax(e){return typeof e==`function`?`custom`:e??`line-info`}function ox(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var sx=(0,X.createContext)(void 0);function cx(){return(0,X.useContext)(sx)}function lx(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function ux(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var dx=1e3,fx=dx*4,px=[0,1e-6,.99999,1],mx={overscrollSize:dx,intersectionObserverMargin:fx,resizeDebugging:!1},hx=0,gx=-1,_x=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++gx}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...mx,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:px,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),W_(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),W_(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),W_(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=q_({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,e-hx,hx=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,e-hx,hx=e))}t&&W_(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+vx(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),W_(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),W_(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,W_(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{e.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,W_(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,W_(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=q_({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&ux(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)i.has(e)||e.onRender(t)&&i.add(e);this.scrollFix(r);for(let e of i)e.reconcileHeights();n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&W_(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=vx(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=vx(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=vx(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=vx(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&W_(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function vx(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var yx=(0,X.createContext)(void 0);function bx(){return(0,X.useContext)(yx)}var xx=typeof window>`u`?X.useEffect:X.useLayoutEffect;function Sx({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c,contentEditable:l}){let u=bx(),d=r!==void 0,f=(0,X.useContext)(R_),p=cx(),m=(0,X.useRef)(null),h=$m(r=>{if(r!=null){if(m.current!=null)throw Error(`File: An instance should not already exist when a node is created`);u==null?m.current=new py(Cx({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),c?void 0:f,!0):m.current=new yy(Cx({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),u,a,c?void 0:f,!0),m.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(m.current==null)throw Error(`File: A File instance should exist when unmounting`);m.current.cleanUp(),m.current=null}});return xx(()=>{if(m.current==null)return;let i=Cx({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),a=!B_(m.current.options,i);m.current.setOptions(i),m.current.render({file:e,lineAnnotations:n,forceRender:a}),r!==void 0&&m.current.setSelectedLines(r)}),xx(()=>{if(l&&m.current!=null){if(p===void 0)throw Error(`File: Editor is not attached`);return p.edit(m.current)}},[l,p]),{ref:h,getHoveredLine:(0,X.useCallback)(()=>m.current?.getHoveredLine(),[])}}function Cx({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:r,hasEditor:i,hasGutterRenderUtility:a}){let o=n&&i,s=t||a||r;if(!s&&!o)return e;let c={...e};return s&&(c={...c,controlledSelection:t,renderCustomHeader:r?Cm:e?.renderCustomHeader,renderGutterUtility:a?Cm:e?.renderGutterUtility}),o&&(c={...c,useTokenTransformer:!0,enableGutterUtility:!1,enableLineSelection:!1,lineHoverHighlight:`disabled`}),c}function wx({file:e,lineAnnotations:t,selectedLines:n,options:r,metrics:i,className:a,style:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,prerenderedHTML:f,renderGutterUtility:p,disableWorkerPool:m=!1,contentEditable:h=!1}){let{ref:g,getHoveredLine:_}=Sx({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:f,hasGutterRenderUtility:p!=null,hasCustomHeader:c!=null,disableWorkerPool:m,contentEditable:h});return(0,Z.jsx)(wm,{ref:g,className:a,style:o,children:lx(Qm({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderFilenameSuffix:u,renderHeaderMetadata:d,renderGutterUtility:p,lineAnnotations:t,getHoveredLine:_}),f)})}var Tx=typeof window>`u`?X.useEffect:X.useLayoutEffect;function Ex({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c,contentEditable:l}){let u=bx(),d=r!==void 0,f=(0,X.useContext)(R_),p=cx(),m=(0,X.useRef)(null),h=$m(r=>{if(r!=null){if(m.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);u==null?m.current=new Vb(Dx({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),c?void 0:f,!0):m.current=new Yb(Dx({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),u,a,c?void 0:f,!0),m.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(m.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);m.current.cleanUp(),m.current=null}});return Tx(()=>{let{current:i}=m;if(i==null)return;let a=Dx({controlledSelection:d,contentEditable:l,hasCustomHeader:s,hasEditor:p!==void 0,hasGutterRenderUtility:o,options:t}),c=!B_(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),Tx(()=>{if(l&&m.current!=null){if(p===void 0)throw Error(`FileDiff: Editor is not attached`);return p.edit(m.current)}},[l,p]),{ref:h,getHoveredLine:(0,X.useCallback)(()=>m.current?.getHoveredLine(),[])}}function Dx({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:r,hasEditor:i,hasGutterRenderUtility:a}){let o=n&&i,s=t||a||r;if(!s&&!o)return e;let c={...e};return s&&(c={...c,controlledSelection:t,renderCustomHeader:r?Cm:e?.renderCustomHeader,renderGutterUtility:a?Cm:e?.renderGutterUtility}),o&&(c={...c,useTokenTransformer:!0,enableGutterUtility:!1,enableLineSelection:!1,expandUnchanged:!0,lineHoverHighlight:`disabled`}),c}function Ox(e){let t=Py(e);if(t.length!==1)throw console.error(t),Error(`PatchDiff: Provided patch must include only 1 patch, with 1 diff`);let{files:n}=t[0];if(n.length!==1)throw console.error(n),Error(`FileDiff: Provided patch must contain exactly 1 file diff`);return n[0]}function kx({patch:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:p,disableWorkerPool:m=!1,contentEditable:h=!1}){let g=Ax(e),{ref:_,getHoveredLine:v}=Ex({fileDiff:g,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:p!=null,hasCustomHeader:l!=null,disableWorkerPool:m,contentEditable:h});return(0,Z.jsx)(wm,{ref:_,className:a,style:o,children:lx(Xm({fileDiff:g,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderAnnotation:c,lineAnnotations:r,renderGutterUtility:p,getHoveredLine:v}),s)})}function Ax(e){return(0,X.useMemo)(()=>Ox(e),[e])}function jx(e,t){try{let n=Ch({name:e,load:t});ph.registerTheme(n.name,n.load)}catch(t){if(t instanceof lh){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}throw t}}function Mx(e,t=10){let n=[],r;for(let i of e.split(`
|
|
2793
|
+
`)){let e=i.match(Dm);if(e!=null){r!=null&&(r.hunkLines.length>0&&(Nx(r,t,`trailing`),Px(r,n)),r=void 0);let a=parseInt(e[3]),o=parseInt(e[1]),s=parseInt(e[4]??`1`),c=parseInt(e[2]??`1`);isNaN(a)||isNaN(o)||isNaN(s)||isNaN(c)?n.push(i):r={additionStart:a,deletionStart:o,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(r==null){n.push(i);continue}if(i.startsWith(` `))r.contextLines.push(i);else if(i!==``){if(r.hunkLines.length>0&&r.contextLines.length>t*2){let e=r.contextLines.length-t*2,i=r.contextLines.slice(-t);Nx(r,t,`trailing`);let{additionCount:a,deletionCount:o}=r;Px(r,n),r={additionStart:r.additionStart+a+e,deletionStart:r.deletionStart+o+e,deletionCount:0,additionCount:0,contextLines:i,hunkLines:[]}}Nx(r,t,r.hunkLines.length===0?`leading`:`before-change`),r.hunkLines.push(i),i.startsWith(`+`)?r.additionCount+=1:i.startsWith(`-`)&&(r.deletionCount+=1)}}r!=null&&r.hunkLines.length>0&&(Nx(r,t,`trailing`),Px(r,n));let i=n.join(`
|
|
2794
|
+
`);return e.endsWith(`
|
|
2795
|
+
`)?`${i}\n`:i}function Nx(e,t,n){if(n===`leading`&&e.contextLines.length>t){let n=e.contextLines.length-t;e.contextLines.splice(0,n),e.additionStart+=n,e.deletionStart+=n}return n===`trailing`&&e.contextLines.length>t&&(e.contextLines.length=t),e.contextLines.length>0&&(e.hunkLines.push(...e.contextLines),e.additionCount+=e.contextLines.length,e.deletionCount+=e.contextLines.length,e.contextLines.length=0),e}function Px(e,t){t.push(`@@ -${Fx(e.deletionStart,e.deletionCount)} +${Fx(e.additionStart,e.additionCount)} @@`),t.push(...e.hunkLines)}function Fx(e,t){return t===1?`${e}`:`${e},${t}`}var Ix=`/assets/worker-D5gSN9Hw.js`;export{wx as a,Vb as c,My as d,B_ as f,bm as h,kx as i,nb as l,th as m,Mx as n,_x as o,N_ as p,jx as r,Yb as s,Ix as t,Py as u};
|