@moonshot-ai/kimi-code 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.mjs +28948 -24696
- package/dist-web/assets/{CodeBlockNode-BKKYmwvi.js → CodeBlockNode-C1W11AeO.js} +2 -2
- package/dist-web/assets/{Tooltip-CIPmRSvR.js → Tooltip-DGZLqZ7K.js} +1 -1
- package/dist-web/assets/{abnfDiagram-VRR7QNED-BMMI9BxQ.js → abnfDiagram-VRR7QNED-BjZkDU71.js} +1 -1
- package/dist-web/assets/{arc-CrYCtH7Y.js → arc-iJsCFL-l.js} +1 -1
- package/dist-web/assets/{architectureDiagram-ZJ3FMSHR-BnFVlZdh.js → architectureDiagram-ZJ3FMSHR-DgSeucQZ.js} +1 -1
- package/dist-web/assets/{blockDiagram-677ZJIJ3-CdD99ZPj.js → blockDiagram-677ZJIJ3-D-b-mXgF.js} +1 -1
- package/dist-web/assets/{c4Diagram-LMCZKHZV-00KJvcAb.js → c4Diagram-LMCZKHZV-BXuDG7QH.js} +1 -1
- package/dist-web/assets/channel-CPw-eGij.js +1 -0
- package/dist-web/assets/{chunk-2Q5K7J3B-BPnkU_Dg.js → chunk-2Q5K7J3B-9PYvtmha.js} +1 -1
- package/dist-web/assets/{chunk-32BRIVSS-Jyv5c8Oy.js → chunk-32BRIVSS-CLNEOpa3.js} +1 -1
- package/dist-web/assets/{chunk-5VM5RSS4-ELPNZt4V.js → chunk-5VM5RSS4-BnPBVsDt.js} +1 -1
- package/dist-web/assets/{chunk-EX3LRPZG-DlBdl9hh.js → chunk-EX3LRPZG-B5sNtRSy.js} +1 -1
- package/dist-web/assets/{chunk-JWPE2WC7-CCwoyuWi.js → chunk-JWPE2WC7-D-sxo7as.js} +1 -1
- package/dist-web/assets/{chunk-MOJQB5TN-DlZ2OL1h.js → chunk-MOJQB5TN-CPChu7zn.js} +1 -1
- package/dist-web/assets/{chunk-RYQCIY6F-hOcXr3tj.js → chunk-RYQCIY6F-CqdXJBtY.js} +1 -1
- package/dist-web/assets/{chunk-V7JOEXUC-DGXwP3rv.js → chunk-V7JOEXUC-Dq7hJ1E_.js} +1 -1
- package/dist-web/assets/{chunk-VR4S4FIN-FdPeJe6y.js → chunk-VR4S4FIN-DqbZLM7b.js} +1 -1
- package/dist-web/assets/{chunk-XXDRQBXY-CgSo79dI.js → chunk-XXDRQBXY-Ds7teyKk.js} +1 -1
- package/dist-web/assets/classDiagram-OUVF2IWQ-gjB3Jhxa.js +1 -0
- package/dist-web/assets/classDiagram-v2-EOCWNBFH-gjB3Jhxa.js +1 -0
- package/dist-web/assets/{cose-bilkent-JH36ORCC-Darjcrxi.js → cose-bilkent-JH36ORCC-DPZKSiow.js} +1 -1
- package/dist-web/assets/{cynefin-VYW2F7L2-5G3hA7cr.js → cynefin-VYW2F7L2-Cn0w3Ba_.js} +1 -1
- package/dist-web/assets/{cynefinDiagram-TSTJHNR4-Qyp0nUBB.js → cynefinDiagram-TSTJHNR4-QO_FhdFv.js} +1 -1
- package/dist-web/assets/{dagre-VKFMJZFB-CYSXGctv.js → dagre-VKFMJZFB-CxdDh_H-.js} +1 -1
- package/dist-web/assets/{diagram-FQU43EPY-ZrAxI-dk.js → diagram-FQU43EPY-BWSognsT.js} +1 -1
- package/dist-web/assets/{diagram-G47NLZAW-BcXugaAM.js → diagram-G47NLZAW-CZSO-0jd.js} +1 -1
- package/dist-web/assets/{diagram-NH7WQ7WH-DYlJF7uY.js → diagram-NH7WQ7WH-Cwtl6YSd.js} +1 -1
- package/dist-web/assets/{diagram-OA4YK3LP-DT_vdkMQ.js → diagram-OA4YK3LP-CfNlfr8r.js} +1 -1
- package/dist-web/assets/{diagram-WEI45ONY-C9NbHUum.js → diagram-WEI45ONY-Dnb8XHFb.js} +1 -1
- package/dist-web/assets/{ebnfDiagram-CCIWWBDH-BtYop6_W.js → ebnfDiagram-CCIWWBDH-jYwb0Iuu.js} +1 -1
- package/dist-web/assets/{erDiagram-Q63AITRT-hOQ0lT_K.js → erDiagram-Q63AITRT-BO-rbURM.js} +1 -1
- package/dist-web/assets/{flowDiagram-23GEKE2U-CNuvMMcz.js → flowDiagram-23GEKE2U-s7QSUi5I.js} +1 -1
- package/dist-web/assets/{ganttDiagram-NO4QXBWP-D-jxKbra.js → ganttDiagram-NO4QXBWP-Dmg9yeHR.js} +1 -1
- package/dist-web/assets/{gitGraphDiagram-IHSO6WYX-CfAxfZAI.js → gitGraphDiagram-IHSO6WYX-CkENa9tF.js} +1 -1
- package/dist-web/assets/{index-DmgTlO-b.js → index-1w7mqrDT.js} +1 -1
- package/dist-web/assets/index-Bka4JnyA.js +1134 -0
- package/dist-web/assets/index-CY1AHs2J.css +32 -0
- package/dist-web/assets/index-DFJHK8jJ.js +1428 -0
- package/dist-web/assets/{index-C-jEQeCU.js → index-QvRKRZhc.js} +2 -2
- package/dist-web/assets/{index10-Ba5OIfKd.js → index10-XHMeQILg.js} +1 -1
- package/dist-web/assets/{index11-1rn8G5-L.js → index11-efQCe3Z8.js} +1 -1
- package/dist-web/assets/{index5-imM41z_l.js → index5-DeylqHIW.js} +1 -1
- package/dist-web/assets/{index6-DA3uJFWk.js → index6-Bjn2CoJ6.js} +1 -1
- package/dist-web/assets/{index7-QSn9lPwh.js → index7-BUAQIV8C.js} +1 -1
- package/dist-web/assets/{index8-DrKPJmGd.js → index8-BjdKteDo.js} +1 -1
- package/dist-web/assets/{infoDiagram-FWYZ7A6U-Bfob5tUX.js → infoDiagram-FWYZ7A6U-Cv8rxZZI.js} +1 -1
- package/dist-web/assets/{ishikawaDiagram-FXEZZL3T-DVWhDYOu.js → ishikawaDiagram-FXEZZL3T-CuA1ztjv.js} +1 -1
- package/dist-web/assets/{journeyDiagram-5HDEW3XC-BssF6You.js → journeyDiagram-5HDEW3XC-CVcfSie7.js} +1 -1
- package/dist-web/assets/{kanban-definition-HUTT4EX6-dzAmBIuH.js → kanban-definition-HUTT4EX6-CW1B_N8v.js} +1 -1
- package/dist-web/assets/{linear-DQD3t2Xn.js → linear-SXgBlKNU.js} +1 -1
- package/dist-web/assets/{mermaid.core-C9jyadm5.js → mermaid.core-07lp9GgB.js} +4 -4
- package/dist-web/assets/{mindmap-definition-LN4V7U3C-Cr2y1CVV.js → mindmap-definition-LN4V7U3C-DB5YaY0-.js} +1 -1
- package/dist-web/assets/{pegDiagram-2B236MQR-KgvyboWs.js → pegDiagram-2B236MQR-DPK1WhFw.js} +1 -1
- package/dist-web/assets/{pieDiagram-ENE6RG2P-Bwk5uJs3.js → pieDiagram-ENE6RG2P-Bf4-DpBr.js} +1 -1
- package/dist-web/assets/{quadrantDiagram-ABIIQ3AL-B9nqRXzL.js → quadrantDiagram-ABIIQ3AL-CDn1Eva8.js} +1 -1
- package/dist-web/assets/{railroadDiagram-RFXS5EU6-D8JNLWlO.js → railroadDiagram-RFXS5EU6-q0FBCwSb.js} +1 -1
- package/dist-web/assets/{requirementDiagram-TGXJPOKE-e-2aWNck.js → requirementDiagram-TGXJPOKE-BCC0I0NM.js} +1 -1
- package/dist-web/assets/{sankeyDiagram-HTMAVEWB-Dy4-rUyp.js → sankeyDiagram-HTMAVEWB-CrXP25QE.js} +1 -1
- package/dist-web/assets/{sequenceDiagram-DBY2YBRQ-Cpmd7yl8.js → sequenceDiagram-DBY2YBRQ-BybZOFTL.js} +1 -1
- package/dist-web/assets/{sizeCapture-X5ZJPWSS-BEZnpCcJ.js → sizeCapture-X5ZJPWSS-Wzxe-vov.js} +1 -1
- package/dist-web/assets/{stateDiagram-2N3HPSRC-BlPnr6FV.js → stateDiagram-2N3HPSRC-B-6wH_c6.js} +1 -1
- package/dist-web/assets/stateDiagram-v2-6OUMAXLB-B0aN8Hfn.js +1 -0
- package/dist-web/assets/{swimlanes-5IMT3BWC-NdRerzVX.js → swimlanes-5IMT3BWC-D2TiuF7A.js} +2 -2
- package/dist-web/assets/swimlanesDiagram-G3AALYLV-B1JZNV9r.js +8 -0
- package/dist-web/assets/{timeline-definition-FHXFAJF6-a2gsEX7B.js → timeline-definition-FHXFAJF6-fKtSi0CT.js} +1 -1
- package/dist-web/assets/turnDiff.worker-BzeNtFko.js +5 -0
- package/dist-web/assets/{vennDiagram-L72KCM5P-DmbZn6B3.js → vennDiagram-L72KCM5P-BDc6eB4F.js} +1 -1
- package/dist-web/assets/{vue.runtime.esm-bundler-rUWK3qjQ.js → vue.runtime.esm-bundler-X5RdzQbe.js} +1 -1
- package/dist-web/assets/{wardleyDiagram-EHGQE667-CPNoDv5i.js → wardleyDiagram-EHGQE667-DeA9MR_N.js} +1 -1
- package/dist-web/assets/{xychartDiagram-FW5EYKEG-DlWidJnk.js → xychartDiagram-FW5EYKEG-gxnf-2A7.js} +1 -1
- package/dist-web/index.html +2 -2
- package/package.json +10 -10
- package/dist-web/assets/channel-CVJjJLW-.js +0 -1
- package/dist-web/assets/classDiagram-OUVF2IWQ-C7YnXWqb.js +0 -1
- package/dist-web/assets/classDiagram-v2-EOCWNBFH-C7YnXWqb.js +0 -1
- package/dist-web/assets/index-CiJ6FDOC.js +0 -1126
- package/dist-web/assets/index-JrJ6_GOd.js +0 -1428
- package/dist-web/assets/index-zbwnJKhO.css +0 -32
- package/dist-web/assets/stateDiagram-v2-6OUMAXLB-Dh0BUURk.js +0 -1
- package/dist-web/assets/swimlanesDiagram-G3AALYLV-DLGtYanS.js +0 -8
|
@@ -0,0 +1,1428 @@
|
|
|
1
|
+
import{t as fe,b as Sn,c as wr,a as Tr,d as Er,s as Ir,g as Rr,e as Ar}from"./index-1w7mqrDT.js";import{f as Kl}from"./index-1w7mqrDT.js";import{cT as nn,cU as Y,cV as Hr,bR as Mr,cW as Dr,cX as Pr}from"./index-Bka4JnyA.js";class Or extends nn{}const Nr=new Or;function Fr(e,t,n){return Nr.diff(e,t,n)}const yn="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class zr extends nn{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${yn}]+|[^\\S\\n\\r]+|[^${yn}]`,"ug");return t.match(n)||[]}}const Ur=new zr;function Br(e,t,n){return Ur.diff(e,t,n)}class _r extends nn{constructor(){super(...arguments),this.tokenize=Vr}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
2
|
+
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
3
|
+
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
4
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
5
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const $r=new _r;function xn(e,t,n){return $r.diff(e,t,n)}function Vr(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
6
|
+
`));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let r=0;r<i.length;r++){const o=i[r];r%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function Wr(e){for(let t=0;t<e.length;t++)if(e[t]<" "||e[t]>"~"||e[t]==='"'||e[t]==="\\")return!0;return!1}function ve(e){if(!Wr(e))return e;let t='"';const n=new TextEncoder().encode(e);let i=0;for(;i<n.length;){const r=n[i];r===7?t+="\\a":r===8?t+="\\b":r===9?t+="\\t":r===10?t+="\\n":r===11?t+="\\v":r===12?t+="\\f":r===13?t+="\\r":r===34?t+='\\"':r===92?t+="\\\\":r>=32&&r<=126?t+=String.fromCharCode(r):t+="\\"+r.toString(8).padStart(3,"0"),i++}return t+='"',t}const Ln={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function kn(e,t,n,i,r,o,s){let l;s?typeof s=="function"?l={callback:s}:l=s:l={},typeof l.context>"u"&&(l.context=4);const a=l.context;if(l.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(l.callback){const{callback:h}=l;xn(n,i,Object.assign(Object.assign({},l),{callback:c=>{const u=d(c);h(u)}}))}else return d(xn(n,i,l));function d(h){if(!h)return;h.push({value:"",lines:[]});function c(g){return g.map(function(C){return" "+C})}const u=[];let f=0,p=0,m=[],y=1,v=1;for(let g=0;g<h.length;g++){const C=h[g],b=C.lines||jr(C.value);if(C.lines=b,C.added||C.removed){if(!f){const x=h[g-1];f=y,p=v,x&&(m=a>0?c(x.lines.slice(-a)):[],f-=m.length,p-=m.length)}for(const x of b)m.push((C.added?"+":"-")+x);C.added?v+=b.length:y+=b.length}else{if(f)if(b.length<=a*2&&g<h.length-2)for(const x of c(b))m.push(x);else{const x=Math.min(b.length,a);for(const k of c(b.slice(0,x)))m.push(k);const S={oldStart:f,oldLines:y-f+x,newStart:p,newLines:v-p+x,lines:m};u.push(S),f=0,p=0,m=[]}y+=b.length,v+=b.length}}for(const g of u)for(let C=0;C<g.lines.length;C++)g.lines[C].endsWith(`
|
|
7
|
+
`)?g.lines[C]=g.lines[C].slice(0,-1):(g.lines.splice(C+1,0,"\"),C++);return{oldFileName:e,newFileName:t,oldHeader:r,newHeader:o,hunks:u}}}function $t(e,t){var n,i,r,o,s,l;if(t||(t=Ln),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(h=>h.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(h=>$t(h,t)).join(`
|
|
8
|
+
`)}const a=[];if(e.isGit){if(t=Ln,!e.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!e.newFileName)throw new Error("newFileName must be specified for Git patches");let h=e.oldFileName,c=e.newFileName;e.isCreate&&h==="/dev/null"?h=c.replace(/^b\//,"a/"):e.isDelete&&c==="/dev/null"&&(c=h.replace(/^a\//,"b/")),a.push("diff --git "+ve(h)+" "+ve(c)),e.isDelete&&a.push("deleted file mode "+((n=e.oldMode)!==null&&n!==void 0?n:"100644")),e.isCreate&&a.push("new file mode "+((i=e.newMode)!==null&&i!==void 0?i:"100644")),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(a.push("old mode "+e.oldMode),a.push("new mode "+e.newMode)),e.isRename&&(a.push("rename from "+ve(((r=e.oldFileName)!==null&&r!==void 0?r:"").replace(/^a\//,""))),a.push("rename to "+ve(((o=e.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,"")))),e.isCopy&&(a.push("copy from "+ve(((s=e.oldFileName)!==null&&s!==void 0?s:"").replace(/^a\//,""))),a.push("copy to "+ve(((l=e.newFileName)!==null&&l!==void 0?l:"").replace(/^b\//,""))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&a.push("Index: "+e.oldFileName),t.includeUnderline&&a.push("===================================================================");const d=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||d)&&(a.push("--- "+ve(e.oldFileName)+(e.oldHeader?" "+e.oldHeader:"")),a.push("+++ "+ve(e.newFileName)+(e.newHeader?" "+e.newHeader:"")));for(let h=0;h<e.hunks.length;h++){const c=e.hunks[h],u=c.oldLines===0?c.oldStart-1:c.oldStart,f=c.newLines===0?c.newStart-1:c.newStart;a.push("@@ -"+u+","+c.oldLines+" +"+f+","+c.newLines+" @@");for(const p of c.lines)a.push(p)}return a.join(`
|
|
9
|
+
`)+`
|
|
10
|
+
`}function Gr(e,t,n,i,r,o,s){if(typeof s=="function"&&(s={callback:s}),s?.callback){const{callback:l}=s;kn(e,t,n,i,r,o,Object.assign(Object.assign({},s),{callback:a=>{l(a?$t(a,s.headerOptions):void 0)}}))}else{const l=kn(e,t,n,i,r,o,s);return l?$t(l,s?.headerOptions):void 0}}function jr(e){const t=e.endsWith(`
|
|
11
|
+
`),n=e.split(`
|
|
12
|
+
`).map(i=>i+`
|
|
13
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}const xi="diffs-container",qr=(()=>{try{return!1}catch{return!1}})(),Kr=/(?=^From [a-f0-9]+ .+$)/m,Li=/(?=^diff --git)/gm,cl=/(?=^---\s+\S)/gm,ul=/(?=^@@ )/gm,Yr=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,Xr=/(?<=\n)/,Qr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Jr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Zr=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,eo=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,fl=/^<{7,}(?:\s.*)?$/,pl=/^\|{7,}(?:\s.*)?$/,gl=/^={7,}$/,ml=/^>{7,}(?:\s.*)?$/,rn="header-prefix",on="header-metadata",sn="header-custom",P={dark:"pierre-dark",light:"pierre-light"},ki="data-theme-css",wi="data-unsafe-css",to="data-core-css",no="data-diffs-scrollbar-measure",Ti="--diffs-scrollbar-gutter-measured",bl=1,io=1e5,an={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Pe={...an,hunkLineCount:1},ro={paddingTop:8,paddingBottom:8,gap:8},oo={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},so=Object.freeze({fromStart:0,fromEnd:0}),Re={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Ei={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ee=new Set;let Ie=null;function K(e){Ee.add(e),Ie??=requestAnimationFrame(Ii)}function ao(e){Ee.delete(e),Ee.size===0&&Ie!=null&&(cancelAnimationFrame(Ie),Ie=null)}function Ii(e){const t=new Set(Ee);Ee.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Ee.size>0?Ie=requestAnimationFrame(Ii):Ie=null}function Ae(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function Me(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ln(e,t){const n=e?.theme??P,i=t?.theme??P,r=wn(e),o=wn(t);return Me(n,i)&&Ae(e,t,["theme","parseDiffOptions"])&&Ae(r,o)}function wn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function Vt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Wt({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const h=Math.max(e-r,0),c=Math.min(e+l,t);return{top:h,bottom:Math.max(c,h)}}let a=e+n/2-s/2,d=a+s;return a<0&&(a=0),d>t&&(d=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(d,t),a))}}function lo(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function V(e){return{type:"text",value:e}}function R({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function ut({name:e,width:t=16,height:n=16,properties:i}){return R({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[R({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function ho(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function we(e){return R({tagName:"div",properties:{"data-gutter":""},children:e})}function Ri(e,t,n,i={}){return R({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[R({tagName:"span",properties:{"data-line-number-content":""},children:[V(`${t}`)]})]:void 0})}function G(e,t,n){return R({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 co(){return R({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[ut({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function uo(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var Ai=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;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();const{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}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){const n=!(e===this.selectedRange||Vt(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const 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=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&Je(e.composedPath())||(de(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(de(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(de(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){de(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}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();de(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);de(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:d,onTokenEnter:h,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const p=wt(r)&&this.hoveredLine?.lineElement===r.lineElement;ht(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ht(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),h?.(this.hoveredToken,t))),p||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),wt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(go(r)&&f!=null){f(r);break}if(po(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!wt(r))break;ht(r)&&d!=null&&d(this.toTokenEventBaseProps(r),t);const p=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...p,event:t}):o?.({...p,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:f=!1,onGutterUtilityClick:p}=this.options,m=p!=null,y=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||d!=null||h!=null||c!=null||u||f||m;y&&!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,de(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const C=[];return(t==="both"||t==="click")&&(i!=null&&C.push("onLineClick"),r!=null&&C.push("onLineNumberClick"),h!=null&&C.push("expandable hunk separators"),c!=null&&C.push("merge conflict actions")),C})()),de(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),de(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!y&&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);const v=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",g=this.pointerSession.mode==="gutterSelecting";(!f&&v||!m&&g)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&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;const t=e.composedPath();Je(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;const i=this.currentSelectionEnds(),r=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),o=i?.top??r;r==null||o==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:o,current:r},t&&(this.selectionAnchor={lineNumber:o.lineNumber,side:o.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const 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();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;const i={lineNumber:n.lineNumber,side:n.eventSide};if(uo(this.pointerSession.pending,i))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{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();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.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){const{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==null&&(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==null&&(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){const t=document.createElement("div");t.innerHTML=fe(co());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);Be(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const 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(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(Qe(r));if(Be(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(Be(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){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Be(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Je(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=Qe(e);if(t&&Je(n))return;const i=bo(e);return i!=null?Qe(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=Co(vo(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?Qe(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=En(t)?t:En(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}Vt(i??void 0,r??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const l of e)l.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,n);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const r=i.start===i.end,o=Math.min(i.start,i.end),s=Math.max(i.start,i.end);for(const l of t){const[a,d]=l.children,h=d.children.length;if(h!==a.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let c=0;c<h;c++){const u=d.children[c],f=a.children[c];if(!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;const p=this.parseLineIndex(u,n);if((p??0)>s)break;if(p==null||p<o)continue;let m=r?"single":p===o?"first":p===s?"last":"";u.setAttribute("data-selected-line",m),f.setAttribute("data-selected-line",m),f.nextSibling instanceof HTMLElement&&u.nextSibling instanceof HTMLElement&&(u.nextSibling.hasAttribute("data-line-annotation")||u.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(r?(m="last",u.setAttribute("data-selected-line","first")):p===o?m="":p===s&&u.setAttribute("data-selected-line",""),u.nextSibling.setAttribute("data-selected-line",m),f.nextSibling.setAttribute("data-selected-line",m))}}};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:i,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...n!=null?{side:n}:{},...n!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let t=!1,n,i,r,o,s,l,a,d,h,c;for(const f of e){if(!(f instanceof HTMLElement))continue;if(c==null&&f.hasAttribute("data-merge-conflict-action")){const v=f.getAttribute("data-merge-conflict-action")??void 0,g=f.getAttribute("data-merge-conflict-conflict-index")??void 0,C=g!=null?Number.parseInt(g,10):NaN;mo(v)&&Number.isFinite(C)&&(c={kind:"merge-conflict-action",resolution:v,conflictIndex:C})}if(l==null&&f.hasAttribute("data-char")){l=f;const v=f.getAttribute("data-char");if(v!=null){const g=Number.parseInt(v,10);if(!Number.isNaN(g)){const C=f.textContent??"",b=g+C.length;(C.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:g,lineCharEnd:b,tokenText:C});continue}}}const p=s==null?f.getAttribute("data-column-number")??void 0:void 0;if(p!=null){s=f,h=Number.parseInt(p,10),t=!0,n=Rn(f),o=f.getAttribute("data-line-index")??void 0;continue}const m=r==null?f.getAttribute("data-line")??void 0:void 0;if(m!=null){r=f,h=Number.parseInt(m,10),n=Rn(f),o=f.getAttribute("data-line-index")??void 0;continue}if(d==null&&(f.hasAttribute("data-expand-button")||f.hasAttribute("data-unmodified-lines"))){d={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}const y=d!=null?f.getAttribute("data-expand-index")??void 0:void 0;if(d!=null&&y!=null){const v=Number.parseInt(y,10);Number.isNaN(v)||(d.hunkIndex=v);continue}if(i==null&&f.hasAttribute("data-code")){i=f;break}}if(c!=null)return c;if(d?.hunkIndex!=null)return{type:"line-info",hunkIndex:d.hunkIndex,direction:d.direction,all:d.all};if(r??=o!=null?Tn(i,`[data-line][data-line-index="${o}"]`):void 0,s??=o!=null?Tn(i,`[data-column-number][data-line-index="${o}"]`):void 0,i==null||r==null||s==null||n==null||h==null||Number.isNaN(h))return;const u=this.parseLineIndex(r,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u,...a}:{kind:"token",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:In(n,i),splitLineIndex:u,...a}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:u}:{kind:"line",lineType:n,lineElement:r,lineNumber:h,numberColumn:t,numberElement:s,side:In(n,i),splitLineIndex:u}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const n=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function qe({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:p,onLineSelected:m,onLineSelectionStart:y,onLineSelectionChange:v,onLineSelectionEnd:g},C,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:fo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:C,onMergeConflictActionClick:x,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:p,onLineSelected:m,onLineSelectionStart:y,onLineSelectionChange:v,onLineSelectionEnd:g,getLineIndex:b}}function fo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function Be(e){return e!=null&&"kind"in e&&e.kind==="line"}function ht(e){return e!=null&&"kind"in e&&e.kind==="token"}function wt(e){return Be(e)||ht(e)}function po(e){return"type"in e&&e.type==="line-info"}function go(e){return"kind"in e&&e.kind==="merge-conflict-action"}function mo(e){return e==="current"||e==="incoming"||e==="both"}function Tn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Qe(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function bo(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function vo(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function Co(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function En(e){return e!=null&&typeof e.elementFromPoint=="function"}function In(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function Rn(e){const 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 Je(e){for(const 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 de(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;break}console.log(...n)}var Hi=class ce{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ce.resizeObserver??new ResizeObserver(ce.handleSharedResizeEntries);return ce.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ce.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,n){const i=new Set;let r=0;const o=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(r===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;r++;let a=o.get(l);if(a!=null&&a.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),a!=null?(this.observedNodes.set(l,a),o.delete(l),a.numberElement!==d?(a.numberElement!=null&&(this.unobserve(a.numberElement),o.delete(a.numberElement)),d!=null&&(this.observe(d),o.delete(d),this.observedNodes.set(d,a)),a.numberElement=d,a.numberWidth=0):a.numberElement!=null?(o.delete(a.numberElement),this.observedNodes.set(a.numberElement,a)):a.numberWidth=0):(a={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,a),this.observe(l),d!=null&&(this.observedNodes.set(d,a),this.observe(d)))}if(r>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const a of s){if(!(a instanceof HTMLElement))continue;const d=a.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:a});continue}let h=l.get(d);h==null&&(h=[],l.set(d,h)),h.push(a)}for(const[a,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",a,d);continue}const[h,c]=d,u=h.firstElementChild,f=c.firstElementChild;if(!(h instanceof HTMLElement)||!(c instanceof HTMLElement)||!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let p=o.get(u);if(p!=null){this.observedNodes.set(u,p),this.observedNodes.set(f,p),o.delete(u),o.delete(f);continue}const m=u.getBoundingClientRect().height,y=f.getBoundingClientRect().height;p={type:"annotations",column1:{container:h,child:u,childHeight:m},column2:{container:c,child:f,childHeight:y},currentHeight:"auto"},i.add({child1:u,child2:f,item:p,newHeight:Math.max(m,y)})}for(const a of i)this.applyNewHeight(a.item,a.newHeight),this.observedNodes.set(a.child1,a.item),this.observedNodes.set(a.child2,a.item),this.observe(a.child1),this.observe(a.child2);i.clear()}for(const[s,l]of o)this.unobserve(s),l.type==="code"?xo(l):Lo(l);o.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ce,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ce.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ce,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ce.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const d=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}d.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const d=n.get(a)??{},h=l[0].inlineSize;o===a.codeElement?d.codeInlineSize=h:o===a.numberElement&&(d.numberInlineSize=h),n.set(a,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?So(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?yo(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;if(!(!s&&!l)&&(n.codeWidth=r,n.numberWidth=o,s&&n.codeElement.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),l&&n.codeElement.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),s||l&&r!=="auto")){const a=typeof r=="number"?Math.max(r-o,0):0;n.codeElement.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function So(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function yo(e){return Math.max(Math.ceil(e),0)}function xo(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 Lo(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")}const Ce=new Map,Tt=new Map,Gt=new Map,ft=new Set;function pt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!ft.has(t))return!1;return!0}function An(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(ft.has(n.name))continue;let i=Ce.get(n.name);i==null&&(i=n,Ce.set(n.name,i)),ft.add(i.name),t.loadLanguageSync(i.data)}}function ko(){Ce.clear(),ft.clear()}function Mi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function Di(e){if(Mi())throw new 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.`);const t=Tt.get(e);if(t!=null)return t;try{let n=Gt.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(Sn,e)&&(n=Sn[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return Ce.has(e)||Ce.set(e,o),o});return Tt.set(e,i),await i}finally{Tt.delete(e)}}function Pi(e){return Ce.get(e)??Di(e)}const gt=new Set;function Hn(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=Y.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,Y.getResolvedTheme(n)==null&&Y.seedResolvedTheme(n,i);gt.has(n)||(gt.add(n),t.loadThemeSync(i))}}function wo(){Y.clearResolvedThemes(),gt.clear()}function Oi(e){if(Mi())throw new 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(Y.hasRegisteredTheme(e))return;const t=Hr.getTheme(e);if(t!=null){Y.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function Ni(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function To(e){Oi(e);const t=await Y.resolveTheme(e);return Ni(e,t),t}function Eo(e){return Y.getResolvedTheme(e)??To(e)}let $;async function St({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){$??=wr({themes:[],langs:["text"],engine:n==="shiki-wasm"?Tr(Mr(()=>import("./wasm-CG6Dc4jp.js"),[])):Er()});const i=Io($)?await $:$;$=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=Pi(s);"then"in l?r.push(l):An(l,i)}const o=[];for(const s of e){const l=Eo(s);"then"in l?o.push(l):Hn(l,$)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{An(s,i)}),Promise.all(o).then(s=>{Hn(s,i)})]),i}function vl(e=$){return e!=null&&!("then"in e)}function Fi(){if($!=null&&!("then"in $))return $}function Io(e=$){return e!=null&&"then"in e}function Cl(e=$){return e==null}async function Sl(e){await St(e)}async function yl(){$!=null&&((await $).dispose(),ko(),wo(),$=void 0)}for(const e of Dr.getThemes())Y.registerThemeIfAbsent(e.name,e.load);function dn(e=P){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function We(e){for(const t of dn(e))if(!gt.has(t))return!1;return!0}function Ro(e){return Y.hasResolvedThemes(e)}function Oe(e,t){return Me(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function se(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function yt(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 jt(e){return R({tagName:"div",children:[R({tagName:"div",children:e.annotations?.map(t=>R({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ao(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 zi({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return R({tagName:"div",children:[t==="custom"?R({tagName:"slot",properties:{name:sn}}):Ho({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Mo(i)]],properties:r})}function Ho({name:e,prevName:t,iconType:n}){const i=[R({tagName:"slot",properties:{name:rn}}),ut({name:Ao(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(R({tagName:"div",children:[R({tagName:"bdi",children:[V(t)]})],properties:{"data-prev-name":""}})),i.push(ut({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(R({tagName:"div",children:[R({tagName:"bdi",children:[V(e)]})],properties:{"data-title":""}})),R({tagName:"div",children:i,properties:{"data-header-content":""}})}function Mo(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(R({tagName:"span",children:[V(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(R({tagName:"span",children:[V(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(R({tagName:"slot",properties:{name:on}})),R({tagName:"div",children:t,properties:{"data-metadata":""}})}function Ui(e){return R({tagName:"pre",properties:Do(e)})}function Do({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"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:${`${o}`.length}ch;`}}const J=new Map;let mt=0;const Ne={"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 X(e){if(J.has(e))return J.get(e)??"text";if(Ne[e]!=null)return Ne[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(J.has(t[1]))return J.get(t[1])??"text";if(Ne[t[1]]!=null)return Ne[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return J.has(n)?J.get(n)??"text":Ne[n]??"text"}function xl(e,t){if(e<=mt)return!1;J.clear();for(const n in t){const i=t[n];i!=null&&J.set(n,i)}return mt=e,!0}function Ll(){return mt}function Po(e,t){const n=J.get(e);return n===t?!1:(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),J.set(e,t),mt++,!0)}function kl(){return Object.fromEntries(J)}function hn(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:dn(t),preferredHighlighter:n}}function pe(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function ye(e){return e.replace(/\n$|\r\n$/,"")}function Oo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(V(`
|
|
14
|
+
`)),e}const Ze=Symbol("no-token"),Et=Symbol("multiple-tokens");function Bi(e){const t=No(e);if(t!=null)return t;let n=Ze;const i=[];let r=[],o;const s=()=>{if(r.length===0||o==null){r=[],o=void 0;return}if(r.length===1){const a=r[0];if(a?.type==="element"){Fo(a,o);for(const d of a.children)ct(d)}else ct(a);i.push(a),r=[],o=void 0;return}for(const a of r)ct(a);i.push(R({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=a=>{if(a!==Ze){if(a===Et){n=Et;return}if(n===Ze){n=a;return}n!==a&&(n=Et)}};for(const a of e.children){const d=a.type==="element"?Bi(a):Ze;if(l(d),typeof d!="number"){s(),i.push(a);continue}o!=null&&o!==d&&s(),o??=d,r.push(a)}return s(),e.children=i,n}function No(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function ct(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)ct(t)}}function Fo(e,t){e.properties["data-char"]=t}function zo(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=l=>l}=e,r=new Map;function o(l){return Object.entries(l).map(([a,d])=>`${a}:${d}`).join(";")}function s(l){let a=t+Uo(typeof l=="string"?l:o(l))+n;return a=i(a),r.has(a)||r.set(a,typeof l=="string"?l:{...l}),a}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=s(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const d of a){if(!d.htmlStyle)continue;const h=s(d.htmlStyle);d.htmlStyle={},d.htmlAttrs||={},d.htmlAttrs.class?d.htmlAttrs.class+=` ${h}`:d.htmlAttrs.class=h}},getClassRegistry(){return r},getCSS(){let l="";for(const[a,d]of r.entries())l+=`.${a}{${typeof d=="string"?d:o(d)}}`;return l},clearRegistry(){r.clear()}}}function Uo(e,t=0){let n=3735928559^t,i=1103547991^t;for(let r=0,o;r<e.length;r++)o=e.charCodeAt(r),n=Math.imul(n^o,2654435761),i=Math.imul(i^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}function _i(e=!1,t=!1){const n={lineInfo:[]},i=[{line(r){return delete r.properties.class,r},pre(r){const o=ho(r),s=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&Bi(a),s.push(Oo(a,l,n)),l++);o.children=s}return r},...e?{tokens(r){for(const o of r){let s=0;for(const l of o){const a=l;a.__lineChar??=s,s+=l.content.length}}},preprocess(r,o){o.mergeWhitespaces="never"},span(r,o,s,l,a){if(a?.offset!=null&&a.content!=null){const d=a.__lineChar;return d!=null&&(r.properties["data-char"]=d),r}return r}}:null}];return t&&i.push(Bo,Mn),{state:n,transformers:i,toClass:Mn}}const Mn=zo({classPrefix:"hl-"}),Bo={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const i={};n.color!=null&&(i.color=n.color),n.bgColor!=null&&(i["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(i["font-style"]="italic"),(n.fontStyle&2)!==0&&(i["font-weight"]="bold"),(n.fontStyle&4)!==0&&(i["text-decoration"]="underline")),Object.keys(i).length>0&&(n.htmlStyle=i)}}};function _(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const _o=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,$o=/^0(?:\.0+)?%?$/;function Vo(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function Wo(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function It(e){if(e==null)return null;const t=Wo(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function Dn(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||_o.test(t))return!0;const n=Vo(t);return n!=null&&$o.test(n)}function Go(e,t,n){if(t==null||n==null)return!1;const i=It(e),r=It(t),o=It(n);return i==null||r==null||o==null?!1:Math.abs(i-o)<Math.abs(i-r)}const Pn=new WeakMap;function Rt(e){const t=Pn.get(e);if(t!=null)return t;const n=e.colors??{},i={...n},r=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,s=n["sideBar.background"]??r,l=n["sideBar.foreground"]??o;ne(i,"editor.background",r),ne(i,"editor.foreground",o),ne(i,"sideBar.background",s),ne(i,"sideBar.foreground",l),ne(i,"input.background",n["input.background"]??s),ne(i,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),ne(i,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),ne(i,"gitDecoration.addedResourceForeground",At(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),ne(i,"gitDecoration.modifiedResourceForeground",At(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),ne(i,"gitDecoration.deletedResourceForeground",At(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(Dn(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(Dn(n.focusBorder)?void 0:n.focusBorder);a!=null?i["list.focusOutline"]=a:delete i["list.focusOutline"];const d=n["list.hoverBackground"];d!=null&&(jo(d,s)||Go(d,s,l))&&delete i["list.hoverBackground"];const h=Object.freeze({...e,colors:Object.freeze(i)});return Pn.set(e,h),h}function ne(e,t,n){n!=null&&n!==""&&(e[t]=n)}function At(...e){for(const t of e)if(t!=null&&t!=="")return t}function jo(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function cn({theme:e=P,highlighter:t,prefix:n}){let i="";if(typeof e=="string"){const r=t.getTheme(e),o=Rt(r);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${_("global")}fg:${o.fg};`,i+=`${_("global")}bg:${o.bg};`,i+=Ht(r,n)}else{let r=t.getTheme(e.dark),o=Rt(r);i+=`${_("global")}dark:${o.fg};`,i+=`${_("global")}dark-bg:${o.bg};`,i+=Ht(r,"dark"),r=t.getTheme(e.light),o=Rt(r),i+=`${_("global")}light:${o.fg};`,i+=`${_("global")}light-bg:${o.bg};`,i+=Ht(r,"light")}return i}function Ht(e,t){t=t!=null?`${t}-`:"";let n="";const i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];i!=null&&(n+=`${_("global")}${t}addition-color:${i};`);const r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];r!=null&&(n+=`${_("global")}${t}deletion-color:${r};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${_("global")}${t}modified-color:${o};`),n}function qt(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function bt({lines:e,startingLine:t=0,totalLines:n=1/0,callback:i}){const r=Math.min(t+n,e.length),o=(()=>{const s=e.at(-1);return s===""||s===`
|
|
15
|
+
`||s===`\r
|
|
16
|
+
`||s==="\r"?Math.max(0,e.length-2):e.length-1})();for(let s=t;s<r;s++){const l=s===o;if(i({lineIndex:s,lineNumber:s+1,content:e[s],isLastLine:l})===!0||l)break}}function vt(e){return e!==""?e.split(Xr):[]}const qo={forcePlainText:!1};function Ko(e,t,{theme:n=P,tokenizeMaxLineLength:i,useTokenTransformer:r},{forcePlainText:o,startingLine:s,totalLines:l,lines:a}=qo){o?(s??=0,l??=1/0):(s=0,l=1/0);const d=s>0||l<1/0,{state:h,transformers:c}=_i(r),u=o?"text":e.lang??X(e.name),f=typeof n=="string"?t.getTheme(n).type:void 0,p=cn({theme:n,highlighter:t});h.lineInfo=g=>({type:"context",lineIndex:g-1+s,lineNumber:g+s});const m=typeof n=="string"?{lang:u,theme:n,transformers:c,defaultColor:!1,cssVariablePrefix:_("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:u,themes:n,transformers:c,defaultColor:!1,cssVariablePrefix:_("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},y=qt(t.codeToHast(d?Yo(a??vt(e.contents),s,l):ye(e.contents),m)),v=d?new Array(s):y;return d&&v.push(...y),{code:v,themeStyles:p,baseThemeType:f}}function Yo(e,t,n){let i="";return bt({lines:e,startingLine:t,totalLines:n,callback({content:r}){i+=r}}),i}const $i="-1,-1";function Kt(e){return e?.some(t=>t.lineNumber===0)??!1}function Yt(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function xt(e){return e.startingLine===0&&e.totalLines>0}function Vi(e,t){return R({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function Xt(e){return(e.lang??X(e.name))==="text"}function Wi(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}let Xo=-1;var Qo=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++Xo}`;highlighter;renderCache;computedLang="text";lineAnnotations={};lineCache;constructor(e={theme:P},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=We(e.theme??P)?Fi():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(const t of e){const n=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=n,n.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(){this.renderCache=void 0}hydrate(e){const{options:t}=this.getRenderOptions(e),n=Mt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());let i=this.workerManager?.getFileResultCache(e);i!=null&&!Oe(t,i.options)&&(i=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Xt(e),result:n?void 0:i?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter==null&&(this.computedLang=e.lang??X(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();const{theme:i=P,tokenizeMaxLineLength:r=1e3}=this.options;return{theme:i,useTokenTransformer:Wi(this.options),tokenizeMaxLineLength:r}})(),{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!se(e,n.file)||!Oe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,vt(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:vt(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=Re){if(e==null)return;let{options:n,forceHighlight:i}=this.getRenderOptions(e);const r=this.getMatchingWorkerResultCache(e,n);r!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...r},i=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};const o=this.getOrCreateLineCache(e),s=e.contents.length>0,l=!s||Xt(e)||Mt(o.length,this.getTokenizeMaxLength()),a=!se(e,this.renderCache.file),d=!yt(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(l||this.renderCache.result==null||!this.renderCache.highlighted&&(a||d))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||a||d||i)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,o)),this.renderCache.renderRange=t),!l&&s&&(!this.renderCache.highlighted||i)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??X(e.name);const h=this.highlighter!=null&&We(n.theme),c=this.highlighter!=null&&pt(this.computedLang),u=!l&&c;if(this.highlighter!=null&&h&&(i||l||!this.renderCache.highlighted&&u||this.renderCache.result==null)){const{result:f,options:p}=this.renderFileWithHighlighter(e,this.highlighter,l||!c);this.renderCache={file:e,options:p,highlighted:u,result:f,renderRange:void 0}}(!h||!l&&!c)&&this.asyncHighlight(e).then(({result:f,options:p})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,f,p,!l)})}return this.renderCache.result!=null?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}async asyncRender(e,t=Re){const{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){const t=Mt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??X(e.name);const n=this.highlighter!=null&&Ro(dn(this.options.theme)),i=t||this.highlighter!=null&&pt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e);return{result:Ko(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const{disableFileHeader:o=!1}=this.options,s=[],l=we(),a=this.getOrCreateLineCache(e);let d=0;const h=xt(t)?Yt(this.lineAnnotations):void 0;return h!=null&&(l.children.push(G("context","annotation",1)),s.push(jt({hunkIndex:-1,lineIndex:-1,annotations:h.map(c=>pe(c))})),d++),bt({lines:a,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:c,lineNumber:u})=>{const f=n[c];if(f==null){const p="FileRenderer.processFileResult: Line doesnt exist";throw console.error(p,{name:e.name,lineIndex:c,lineNumber:u,lines:a}),new Error(p)}if(f!=null){l.children.push(Ri("context",u,`${c}`)),s.push(f),d++;const p=this.lineAnnotations[u];p!=null&&(l.children.push(G("context","annotation",1)),s.push(jt({hunkIndex:0,lineIndex:u,annotations:p.map(m=>pe(m))})),d++)}}}),l.properties.style=`grid-row: span ${d}`,{gutterAST:l.children??[],contentAST:s,preAST:this.createPreElement(a.length),headerAST:o?void 0:this.renderHeader(e),totalLines:a.length,rowCount:d,themeStyles:i,baseThemeType:r,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){const{headerRenderMode:t="default",stickyHeader:n=!1}=this.options;return zi({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return fe(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(R({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),{...e.preAST,children:t}}renderCodeAST(e){const t=we();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,Vi(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return t?fe(R({tagName:"code",children:e,properties:{"data-code":""}})):fe(e)}async initializeHighlighter(){return this.highlighter=await St(hn(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,i=!0){if(this.renderCache==null)return;const r=!se(e,this.renderCache.file)||!this.renderCache.highlighted||!Oe(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){const n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Oe(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&se(e,n.file)&&Oe(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){const{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return Ui({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Mt(e,t){return e>t}const Gi=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
17
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
18
|
+
<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"/>
|
|
19
|
+
</symbol>
|
|
20
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
21
|
+
<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"/>
|
|
22
|
+
</symbol>
|
|
23
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
24
|
+
<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"/>
|
|
25
|
+
</symbol>
|
|
26
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
27
|
+
<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"/>
|
|
28
|
+
</symbol>
|
|
29
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
30
|
+
<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"/>
|
|
31
|
+
</symbol>
|
|
32
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
33
|
+
<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"/>
|
|
34
|
+
</symbol>
|
|
35
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
36
|
+
<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"/>
|
|
37
|
+
</symbol>
|
|
38
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
39
|
+
<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"/>
|
|
40
|
+
</symbol>
|
|
41
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
42
|
+
<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"/>
|
|
43
|
+
</symbol>
|
|
44
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
45
|
+
<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"/>
|
|
46
|
+
</symbol>
|
|
47
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
48
|
+
<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"/>
|
|
49
|
+
</symbol>
|
|
50
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
51
|
+
<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"/>
|
|
52
|
+
</symbol>
|
|
53
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
54
|
+
<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"/>
|
|
55
|
+
</symbol>
|
|
56
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
57
|
+
<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"/>
|
|
58
|
+
</symbol>
|
|
59
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
60
|
+
<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"/>
|
|
61
|
+
</symbol>
|
|
62
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
63
|
+
<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"/>
|
|
64
|
+
</symbol>
|
|
65
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
66
|
+
<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"/>
|
|
67
|
+
</symbol>
|
|
68
|
+
</svg>`;function Jo(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function ji(e,t){return e==null||t==null?e===t:Zo(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}const On={};function Zo(e=On,t=On){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0}function un(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function qi(){const 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 Ki(){const e=document.createElement("style");return e.setAttribute(wi,""),e}var Yi=`@layer base {
|
|
69
|
+
:host {
|
|
70
|
+
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
71
|
+
"Courier New", monospace;
|
|
72
|
+
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
73
|
+
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
74
|
+
--diffs-mixer: light-dark(#000, #fff);
|
|
75
|
+
--diffs-gap-fallback: 8px;
|
|
76
|
+
--diffs-scrollbar-gutter-fallback: 6px;
|
|
77
|
+
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
78
|
+
--diffs-added-light: #0dbe4e;
|
|
79
|
+
--diffs-added-dark: #5ecc71;
|
|
80
|
+
--diffs-modified-light: #009fff;
|
|
81
|
+
--diffs-modified-dark: #69b1ff;
|
|
82
|
+
--diffs-deleted-light: #ff2e3f;
|
|
83
|
+
--diffs-deleted-dark: #ff6762;
|
|
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
|
+
*, :before, :after {
|
|
129
|
+
box-sizing: border-box;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
[data-icon-sprite] {
|
|
133
|
+
display: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
[data-diffs-header], [data-separator] {
|
|
137
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[data-diffs-header][data-sticky] {
|
|
141
|
+
z-index: 1;
|
|
142
|
+
background-color: var(--diffs-bg);
|
|
143
|
+
position: sticky;
|
|
144
|
+
top: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
[data-file-info] {
|
|
148
|
+
color: var(--fg);
|
|
149
|
+
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
150
|
+
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
151
|
+
padding: 10px;
|
|
152
|
+
font-weight: 700;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-diff], [data-file] {
|
|
156
|
+
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
157
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
158
|
+
|
|
159
|
+
&[data-dehydrated] {
|
|
160
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
164
|
+
background-color: var(--diffs-bg-context);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@supports (-webkit-touch-callout: none) {
|
|
169
|
+
:host {
|
|
170
|
+
--diffs-scrollbar-gutter-fallback: 0px;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
[data-line] span {
|
|
175
|
+
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
176
|
+
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
177
|
+
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
178
|
+
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
179
|
+
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions] {
|
|
183
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
184
|
+
--diffs-computed-diff-line-bg: var(--diffs-bg);
|
|
185
|
+
--diffs-computed-selected-line-bg: var(--diffs-bg);
|
|
186
|
+
color: var(--diffs-fg);
|
|
187
|
+
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
188
|
+
|
|
189
|
+
@media (pointer: fine) {
|
|
190
|
+
&:where([data-hovered]) {
|
|
191
|
+
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
192
|
+
var(--diffs-computed-selected-line-bg) 97%,
|
|
193
|
+
var(--diffs-bg-hover-override, var(--diffs-mixer))), color-mix(in lab,
|
|
194
|
+
var(--diffs-computed-selected-line-bg) 91%,
|
|
195
|
+
var(--diffs-bg-hover-override, var(--diffs-mixer))));
|
|
196
|
+
--diffs-line-bg: var(--diffs-computed-hovered-line-bg, inherit);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
[data-line], [data-no-newline] {
|
|
202
|
+
&[data-decoration-bg] {
|
|
203
|
+
--mix-deco-light: 92%;
|
|
204
|
+
--mix-deco-dark: 85%;
|
|
205
|
+
|
|
206
|
+
&[data-decoration-bg-depth="2"] {
|
|
207
|
+
--mix-deco-light: 88%;
|
|
208
|
+
--mix-deco-dark: 80%;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&[data-decoration-bg-depth="3"] {
|
|
212
|
+
--mix-deco-light: 85%;
|
|
213
|
+
--mix-deco-dark: 78%;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@media (pointer: fine) {
|
|
217
|
+
&[data-hovered]:not([data-selected-line]) {
|
|
218
|
+
--mix-deco-light: 85%;
|
|
219
|
+
--mix-deco-dark: 85%;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="2"] {
|
|
223
|
+
--mix-deco-light: 83%;
|
|
224
|
+
--mix-deco-dark: 83%;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="3"] {
|
|
228
|
+
--mix-deco-light: 81%;
|
|
229
|
+
--mix-deco-dark: 81%;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
234
|
+
var(--diffs-bg) var(--mix-deco-light),
|
|
235
|
+
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
236
|
+
var(--diffs-bg) var(--mix-deco-dark),
|
|
237
|
+
var(--diffs-decoration-bg)));
|
|
238
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
239
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
240
|
+
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
245
|
+
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
246
|
+
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
247
|
+
--diffs-computed-diff-line-bg: var(--diffs-annotation-bg);
|
|
248
|
+
--diffs-computed-selected-line-bg: var(--diffs-annotation-bg);
|
|
249
|
+
--diffs-line-bg: var(--diffs-annotation-bg);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
[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"] {
|
|
253
|
+
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
254
|
+
--diffs-computed-diff-line-bg: var(--diffs-bg-context);
|
|
255
|
+
--diffs-computed-selected-line-bg: var(--diffs-bg-context);
|
|
256
|
+
--diffs-line-bg: var(--diffs-bg-context);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
260
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
261
|
+
var(--diffs-bg) 78%,
|
|
262
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
263
|
+
var(--diffs-bg) 68%,
|
|
264
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
265
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
266
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
267
|
+
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
271
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
272
|
+
var(--diffs-bg) 78%,
|
|
273
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
274
|
+
var(--diffs-bg) 68%,
|
|
275
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
276
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
277
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);
|
|
278
|
+
--diffs-line-bg: var(--diffs-computed-decoration-bg);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
282
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
283
|
+
--diffs-computed-diff-line-bg: var(--diffs-bg);
|
|
284
|
+
--diffs-computed-selected-line-bg: var(--diffs-bg);
|
|
285
|
+
--diffs-line-bg: var(--diffs-bg);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
:where([data-background]) {
|
|
289
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
290
|
+
--mix-light: 91%;
|
|
291
|
+
--mix-dark: 85%;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
& [data-line], & [data-no-newline] {
|
|
295
|
+
--mix-light: 88%;
|
|
296
|
+
--mix-dark: 80%;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
300
|
+
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
301
|
+
|
|
302
|
+
&[data-line-type="change-deletion"] {
|
|
303
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
304
|
+
|
|
305
|
+
@media (pointer: fine) {
|
|
306
|
+
&[data-hovered] {
|
|
307
|
+
--mix-light: 80%;
|
|
308
|
+
--mix-dark: 75%;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
313
|
+
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
314
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
318
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
319
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
320
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
321
|
+
var(--diffs-diff-line-mix-target)));
|
|
322
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
323
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&[data-line-type="change-addition"] {
|
|
327
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
328
|
+
|
|
329
|
+
@media (pointer: fine) {
|
|
330
|
+
&[data-hovered] {
|
|
331
|
+
--mix-light: 80%;
|
|
332
|
+
--mix-dark: 70%;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
337
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
338
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
342
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
343
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
344
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
345
|
+
var(--diffs-diff-line-mix-target)));
|
|
346
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
347
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
&[data-merge-conflict="current"] {
|
|
351
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
352
|
+
|
|
353
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
354
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
355
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@media (pointer: fine) {
|
|
359
|
+
&[data-hovered] {
|
|
360
|
+
--mix-light: 80%;
|
|
361
|
+
--mix-dark: 70%;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
366
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
367
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
368
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
369
|
+
var(--diffs-diff-line-mix-target)));
|
|
370
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
371
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
&[data-merge-conflict="incoming"] {
|
|
375
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
376
|
+
|
|
377
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
378
|
+
color: var(--diffs-modified-base);
|
|
379
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@media (pointer: fine) {
|
|
383
|
+
&[data-hovered] {
|
|
384
|
+
--mix-light: 80%;
|
|
385
|
+
--mix-dark: 70%;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
390
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
391
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
392
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
393
|
+
var(--diffs-diff-line-mix-target)));
|
|
394
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
395
|
+
--diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline] {
|
|
401
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
402
|
+
|
|
403
|
+
&:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
404
|
+
--mix-selection-light: 82%;
|
|
405
|
+
--mix-selection-dark: 75%;
|
|
406
|
+
|
|
407
|
+
@media (pointer: fine) {
|
|
408
|
+
&[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
409
|
+
--mix-selection-light: 75%;
|
|
410
|
+
--mix-selection-dark: 70%;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
&:where([data-gutter-buffer], [data-column-number])[data-selected-line] {
|
|
416
|
+
--mix-selection-light: 75%;
|
|
417
|
+
--mix-selection-dark: 60%;
|
|
418
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
419
|
+
|
|
420
|
+
@media (pointer: fine) {
|
|
421
|
+
&[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
422
|
+
--mix-selection-light: 70%;
|
|
423
|
+
--mix-selection-dark: 55%;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
&[data-selected-line] {
|
|
429
|
+
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
430
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
431
|
+
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
432
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
433
|
+
var(--diffs-selection-mix-target)));
|
|
434
|
+
--diffs-line-bg: var(--diffs-computed-selected-line-bg, inherit);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
[data-gutter-buffer], [data-column-number] {
|
|
439
|
+
&[data-selected-line] {
|
|
440
|
+
color: var(--diffs-selection-number-fg);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
[data-no-newline] {
|
|
445
|
+
user-select: none;
|
|
446
|
+
|
|
447
|
+
& span {
|
|
448
|
+
opacity: .6;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
[data-diff-type="split"][data-overflow="scroll"] {
|
|
453
|
+
grid-template-columns: 1fr 1fr;
|
|
454
|
+
display: grid;
|
|
455
|
+
|
|
456
|
+
& [data-additions] {
|
|
457
|
+
border-left: 1px solid var(--diffs-bg);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
& [data-deletions] {
|
|
461
|
+
border-right: 1px solid var(--diffs-bg);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
[data-code] {
|
|
466
|
+
grid-auto-flow: dense;
|
|
467
|
+
grid-template-columns: var(--diffs-code-grid);
|
|
468
|
+
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
469
|
+
overscroll-behavior-x: none;
|
|
470
|
+
tab-size: var(--diffs-tab-size, 2);
|
|
471
|
+
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
472
|
+
padding-bottom: max(0px,
|
|
473
|
+
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
474
|
+
var(--diffs-scrollbar-gutter)));
|
|
475
|
+
scrollbar-gutter: stable;
|
|
476
|
+
align-self: flex-start;
|
|
477
|
+
display: grid;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
[data-diffs-scrollbar-measure] {
|
|
481
|
+
opacity: 0;
|
|
482
|
+
pointer-events: none;
|
|
483
|
+
scrollbar-gutter: auto;
|
|
484
|
+
grid-template-columns: none;
|
|
485
|
+
width: 100px;
|
|
486
|
+
height: 100px;
|
|
487
|
+
padding: 0;
|
|
488
|
+
position: absolute;
|
|
489
|
+
top: -200px;
|
|
490
|
+
left: -200px;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
[data-container-size] {
|
|
494
|
+
container-type: inline-size;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
[data-code]::-webkit-scrollbar {
|
|
498
|
+
width: 0;
|
|
499
|
+
height: var(--diffs-scrollbar-gutter);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
[data-code]::-webkit-scrollbar-track {
|
|
503
|
+
background: none;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
[data-code]::-webkit-scrollbar-thumb {
|
|
507
|
+
background-color: #0000;
|
|
508
|
+
background-clip: content-box;
|
|
509
|
+
border: 1px solid #0000;
|
|
510
|
+
border-radius: 3px;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
[data-code]::-webkit-scrollbar-corner {
|
|
514
|
+
background-color: #0000;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
@supports ((-moz-appearance: none)) {
|
|
518
|
+
[data-code] {
|
|
519
|
+
scrollbar-width: thin;
|
|
520
|
+
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
521
|
+
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
526
|
+
& [data-code], &[data-overflow="wrap"] {
|
|
527
|
+
padding-top: 0;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
[data-gutter] {
|
|
532
|
+
grid-template-rows: subgrid;
|
|
533
|
+
grid-template-columns: subgrid;
|
|
534
|
+
z-index: 3;
|
|
535
|
+
background-color: var(--diffs-bg);
|
|
536
|
+
grid-column: 1;
|
|
537
|
+
display: grid;
|
|
538
|
+
position: relative;
|
|
539
|
+
|
|
540
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
541
|
+
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
[data-content] {
|
|
546
|
+
grid-template-rows: subgrid;
|
|
547
|
+
grid-template-columns: subgrid;
|
|
548
|
+
background-color: var(--diffs-bg);
|
|
549
|
+
grid-column: 2;
|
|
550
|
+
min-width: 0;
|
|
551
|
+
display: grid;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
[data-diff-type="split"][data-overflow="wrap"] {
|
|
555
|
+
grid-auto-flow: dense;
|
|
556
|
+
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
557
|
+
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
558
|
+
display: grid;
|
|
559
|
+
|
|
560
|
+
& [data-deletions] {
|
|
561
|
+
display: contents;
|
|
562
|
+
|
|
563
|
+
& [data-gutter] {
|
|
564
|
+
grid-column: 1;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
& [data-content] {
|
|
568
|
+
border-right: 1px solid var(--diffs-bg);
|
|
569
|
+
grid-column: 2;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
& [data-additions] {
|
|
574
|
+
display: contents;
|
|
575
|
+
|
|
576
|
+
& [data-gutter] {
|
|
577
|
+
border-left: 1px solid var(--diffs-bg);
|
|
578
|
+
grid-column: 3;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
& [data-content] {
|
|
582
|
+
grid-column: 4;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
[data-overflow="scroll"] [data-gutter] {
|
|
588
|
+
position: sticky;
|
|
589
|
+
left: 0;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
[data-interactive-lines] [data-line] {
|
|
593
|
+
cursor: pointer;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
[data-interactive-line-numbers] [data-column-number] {
|
|
597
|
+
cursor: pointer;
|
|
598
|
+
touch-action: none;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
[data-content-buffer], [data-gutter-buffer] {
|
|
602
|
+
user-select: none;
|
|
603
|
+
min-height: 1lh;
|
|
604
|
+
position: relative;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
[data-gutter-buffer] {
|
|
608
|
+
padding-left: 2ch;
|
|
609
|
+
padding-right: 1ch;
|
|
610
|
+
|
|
611
|
+
&:before {
|
|
612
|
+
content: "";
|
|
613
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
614
|
+
display: block;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
[data-gutter-buffer="annotation"] {
|
|
619
|
+
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
620
|
+
min-height: 0;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
[data-gutter-buffer="buffer"] {
|
|
624
|
+
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
[data-content-buffer] {
|
|
628
|
+
background-position: 5px 0;
|
|
629
|
+
background-size: 8px 8px;
|
|
630
|
+
background-origin: border-box;
|
|
631
|
+
background-image: repeating-linear-gradient(-45deg,
|
|
632
|
+
transparent,
|
|
633
|
+
transparent calc(3px * 1.414),
|
|
634
|
+
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
635
|
+
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
636
|
+
grid-column: 1;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
[data-separator] {
|
|
640
|
+
box-sizing: content-box;
|
|
641
|
+
background-color: var(--diffs-bg);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
[data-separator="simple"] {
|
|
645
|
+
min-height: 4px;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
649
|
+
background-color: var(--diffs-bg-separator);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
653
|
+
height: 32px;
|
|
654
|
+
position: relative;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
[data-separator-wrapper] {
|
|
658
|
+
user-select: none;
|
|
659
|
+
fill: currentColor;
|
|
660
|
+
background-color: var(--diffs-bg);
|
|
661
|
+
align-items: center;
|
|
662
|
+
height: 100%;
|
|
663
|
+
display: flex;
|
|
664
|
+
position: absolute;
|
|
665
|
+
inset-inline: 0;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
[data-content] [data-separator-wrapper] {
|
|
669
|
+
display: none;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
[data-separator="metadata"] [data-separator-wrapper] {
|
|
673
|
+
background-color: var(--diffs-bg-separator);
|
|
674
|
+
height: 100%;
|
|
675
|
+
color: var(--diffs-fg-number);
|
|
676
|
+
white-space: nowrap;
|
|
677
|
+
text-overflow: ellipsis;
|
|
678
|
+
min-width: min-content;
|
|
679
|
+
padding-inline: 1ch;
|
|
680
|
+
inset-inline: 100% auto;
|
|
681
|
+
overflow: hidden;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
[data-separator="line-info"] {
|
|
685
|
+
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
686
|
+
|
|
687
|
+
& [data-separator-wrapper] {
|
|
688
|
+
min-width: 16px;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
693
|
+
margin-block: 0;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
[data-separator="line-info"][data-separator-first] {
|
|
697
|
+
margin-top: 0;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
[data-separator="line-info"][data-separator-last] {
|
|
701
|
+
margin-bottom: 0;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
[data-expand-index] [data-separator-wrapper] {
|
|
705
|
+
grid-template-columns: 32px auto;
|
|
706
|
+
display: grid;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
710
|
+
grid-template-columns: 32px 32px auto;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
[data-expand-button], [data-separator-content] {
|
|
714
|
+
background-color: var(--diffs-bg-separator);
|
|
715
|
+
flex: none;
|
|
716
|
+
align-items: center;
|
|
717
|
+
display: flex;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
[data-expand-index] [data-separator-content]:hover {
|
|
721
|
+
cursor: pointer;
|
|
722
|
+
text-decoration: underline;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
[data-expand-button] {
|
|
726
|
+
cursor: pointer;
|
|
727
|
+
min-width: 32px;
|
|
728
|
+
color: var(--diffs-fg-number);
|
|
729
|
+
border-right: 2px solid var(--diffs-bg);
|
|
730
|
+
flex-shrink: 0;
|
|
731
|
+
justify-content: center;
|
|
732
|
+
align-self: stretch;
|
|
733
|
+
|
|
734
|
+
&:hover {
|
|
735
|
+
color: var(--diffs-fg);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
&[data-expand-all-button] {
|
|
739
|
+
display: none;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
[data-expand-down] [data-icon] {
|
|
744
|
+
transform: scaleY(-1);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
[data-separator-content] {
|
|
748
|
+
height: 100%;
|
|
749
|
+
color: var(--diffs-fg-number);
|
|
750
|
+
flex: auto;
|
|
751
|
+
justify-content: flex-start;
|
|
752
|
+
padding: 0 1ch;
|
|
753
|
+
overflow: hidden;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
757
|
+
& [data-separator-content] {
|
|
758
|
+
user-select: none;
|
|
759
|
+
height: 100%;
|
|
760
|
+
overflow: clip;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
[data-unmodified-lines] {
|
|
765
|
+
text-overflow: ellipsis;
|
|
766
|
+
white-space: nowrap;
|
|
767
|
+
flex: 0 auto;
|
|
768
|
+
min-width: 0;
|
|
769
|
+
display: block;
|
|
770
|
+
overflow: hidden;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
@supports (width: 1cqi) {
|
|
774
|
+
[data-unified] {
|
|
775
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
776
|
+
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
777
|
+
width: 100cqi;
|
|
778
|
+
|
|
779
|
+
& [data-separator-content] {
|
|
780
|
+
border-radius: 6px;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
785
|
+
border-top-left-radius: unset;
|
|
786
|
+
border-bottom-left-radius: unset;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
[data-gutter] {
|
|
791
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
792
|
+
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
& [data-separator="line-info"] [data-separator-content] {
|
|
796
|
+
border-top-left-radius: 6px;
|
|
797
|
+
border-bottom-left-radius: 6px;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
801
|
+
border-top-left-radius: unset;
|
|
802
|
+
border-bottom-left-radius: unset;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
[data-additions] {
|
|
807
|
+
& [data-content] [data-separator="line-info"] {
|
|
808
|
+
background-color: var(--diffs-bg);
|
|
809
|
+
|
|
810
|
+
& [data-separator-wrapper] {
|
|
811
|
+
display: none;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
816
|
+
background-color: var(--diffs-bg-separator);
|
|
817
|
+
border-top-right-radius: 6px;
|
|
818
|
+
border-bottom-right-radius: 6px;
|
|
819
|
+
height: 100%;
|
|
820
|
+
display: block;
|
|
821
|
+
|
|
822
|
+
& [data-separator-content], & [data-expand-button] {
|
|
823
|
+
display: none;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
829
|
+
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
833
|
+
background-color: var(--diffs-bg-separator);
|
|
834
|
+
height: 100%;
|
|
835
|
+
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
836
|
+
border-top-right-radius: 6px;
|
|
837
|
+
border-bottom-right-radius: 6px;
|
|
838
|
+
display: block;
|
|
839
|
+
|
|
840
|
+
& [data-separator-content], & [data-expand-button] {
|
|
841
|
+
display: none;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
846
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
847
|
+
border-top-left-radius: 6px;
|
|
848
|
+
border-bottom-left-radius: 6px;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
@media (pointer: fine) {
|
|
853
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
854
|
+
&[data-separator-multi-button] {
|
|
855
|
+
& [data-expand-up] {
|
|
856
|
+
border-top-left-radius: 6px;
|
|
857
|
+
border-bottom-left-radius: unset;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
& [data-expand-down] {
|
|
861
|
+
border-bottom-left-radius: 6px;
|
|
862
|
+
border-top-left-radius: unset;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
@media (pointer: coarse) {
|
|
870
|
+
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
871
|
+
grid-template-columns: 34px 34px auto;
|
|
872
|
+
|
|
873
|
+
& [data-separator-content] {
|
|
874
|
+
grid-column: unset;
|
|
875
|
+
grid-row: unset;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
@supports (width: 1cqi) {
|
|
880
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
881
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
882
|
+
border-top-left-radius: 6px;
|
|
883
|
+
border-bottom-left-radius: 6px;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
&[data-separator-multi-button] {
|
|
887
|
+
& [data-expand-up] {
|
|
888
|
+
border-top-left-radius: 6px;
|
|
889
|
+
border-bottom-left-radius: 6px;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
& [data-expand-down] {
|
|
893
|
+
border-bottom-left-radius: unset;
|
|
894
|
+
border-top-left-radius: unset;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
@media (pointer: fine) {
|
|
902
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
903
|
+
grid-template-rows: 50% 50%;
|
|
904
|
+
display: grid;
|
|
905
|
+
|
|
906
|
+
& [data-separator-content] {
|
|
907
|
+
grid-area: 1 / 2 / -1;
|
|
908
|
+
min-width: min-content;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
& [data-expand-button] {
|
|
912
|
+
grid-column: 1;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
917
|
+
grid-template-columns: 34px auto;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
921
|
+
grid-template-columns: 100% auto;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
925
|
+
& [data-separator-multi-button] {
|
|
926
|
+
& [data-expand-up] {
|
|
927
|
+
border-bottom: 1px solid var(--diffs-bg);
|
|
928
|
+
border-right: 2px solid var(--diffs-bg);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
& [data-expand-down] {
|
|
932
|
+
border-top: 1px solid var(--diffs-bg);
|
|
933
|
+
border-right: 2px solid var(--diffs-bg);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
940
|
+
display: none;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
[data-line-annotation] {
|
|
944
|
+
min-height: var(--diffs-annotation-min-height, 0);
|
|
945
|
+
z-index: 2;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
[data-merge-conflict-actions] {
|
|
949
|
+
z-index: 2;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
[data-separator="custom"] {
|
|
953
|
+
grid-template-columns: subgrid;
|
|
954
|
+
display: grid;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
[data-line], [data-column-number], [data-no-newline] {
|
|
958
|
+
padding-inline: 1ch;
|
|
959
|
+
position: relative;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
[data-indicators="classic"] [data-line] {
|
|
963
|
+
padding-inline-start: 2ch;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
[data-indicators="classic"] {
|
|
967
|
+
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
968
|
+
&[data-no-newline], &[data-line] {
|
|
969
|
+
&:before {
|
|
970
|
+
user-select: none;
|
|
971
|
+
width: 1ch;
|
|
972
|
+
height: 1lh;
|
|
973
|
+
display: inline-block;
|
|
974
|
+
position: absolute;
|
|
975
|
+
top: 0;
|
|
976
|
+
left: 0;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
& [data-line-type="change-addition"] {
|
|
982
|
+
&[data-line], &[data-no-newline] {
|
|
983
|
+
&:before {
|
|
984
|
+
content: "+";
|
|
985
|
+
color: var(--diffs-addition-base);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
& [data-line-type="change-deletion"] {
|
|
991
|
+
&[data-line], &[data-no-newline] {
|
|
992
|
+
&:before {
|
|
993
|
+
content: "-";
|
|
994
|
+
color: var(--diffs-deletion-base);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
[data-indicators="bars"] {
|
|
1001
|
+
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
1002
|
+
&[data-column-number] {
|
|
1003
|
+
&:before {
|
|
1004
|
+
content: "";
|
|
1005
|
+
user-select: none;
|
|
1006
|
+
contain: strict;
|
|
1007
|
+
width: 4px;
|
|
1008
|
+
height: 100%;
|
|
1009
|
+
display: block;
|
|
1010
|
+
position: absolute;
|
|
1011
|
+
top: 0;
|
|
1012
|
+
left: 0;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
& [data-line-type="change-deletion"] {
|
|
1018
|
+
&[data-column-number] {
|
|
1019
|
+
&:before {
|
|
1020
|
+
background-image: linear-gradient(0deg,
|
|
1021
|
+
var(--diffs-bg-deletion) 50%,
|
|
1022
|
+
var(--diffs-deletion-base) 50%);
|
|
1023
|
+
background-repeat: repeat;
|
|
1024
|
+
background-size: 2px 2px;
|
|
1025
|
+
background-size: calc(1lh / round(1lh / 2px))
|
|
1026
|
+
calc(1lh / round(1lh / 2px));
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
& [data-line-type="change-addition"] {
|
|
1032
|
+
&[data-column-number] {
|
|
1033
|
+
&:before {
|
|
1034
|
+
background-color: var(--diffs-addition-base);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
[data-overflow="wrap"] {
|
|
1041
|
+
& [data-line], & [data-annotation-content] {
|
|
1042
|
+
white-space: pre-wrap;
|
|
1043
|
+
word-break: break-word;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
[data-overflow="scroll"] [data-line] {
|
|
1048
|
+
white-space: pre;
|
|
1049
|
+
min-height: 1lh;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
[data-column-number] {
|
|
1053
|
+
box-sizing: content-box;
|
|
1054
|
+
text-align: right;
|
|
1055
|
+
user-select: none;
|
|
1056
|
+
color: var(--diffs-fg-number);
|
|
1057
|
+
padding-left: 2ch;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
[data-line-number-content] {
|
|
1061
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1062
|
+
z-index: 1;
|
|
1063
|
+
display: inline-block;
|
|
1064
|
+
position: relative;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
[data-disable-line-numbers] {
|
|
1068
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1069
|
+
min-width: 4px;
|
|
1070
|
+
padding: 0;
|
|
1071
|
+
|
|
1072
|
+
&:before {
|
|
1073
|
+
min-width: 0;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
& [data-line-number-content] {
|
|
1078
|
+
display: none;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
& [data-gutter-utility-slot] {
|
|
1082
|
+
right: unset;
|
|
1083
|
+
justify-content: flex-start;
|
|
1084
|
+
left: 0;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1088
|
+
left: 6px;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
[data-file][data-disable-line-numbers] {
|
|
1093
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1094
|
+
border-right: 0;
|
|
1095
|
+
min-width: 0;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
[data-diff-span] {
|
|
1100
|
+
box-decoration-break: clone;
|
|
1101
|
+
border-radius: 3px;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
[data-line-type="change-addition"] [data-diff-span] {
|
|
1105
|
+
background-color: var(--diffs-bg-addition-emphasis);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1109
|
+
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1113
|
+
color: var(--diffs-fg);
|
|
1114
|
+
padding-left: 1ch;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1118
|
+
align-items: center;
|
|
1119
|
+
display: flex;
|
|
1120
|
+
|
|
1121
|
+
&:after {
|
|
1122
|
+
color: var(--diffs-fg-conflict-marker);
|
|
1123
|
+
font-size: .75rem;
|
|
1124
|
+
font-style: normal;
|
|
1125
|
+
line-height: 1.25rem;
|
|
1126
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1127
|
+
padding-left: 1ch;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
[data-merge-conflict="marker-start"]:after {
|
|
1132
|
+
content: "(Current Change)";
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
[data-merge-conflict="marker-end"]:after {
|
|
1136
|
+
content: "(Incoming Change)";
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
[data-merge-conflict-actions-content] {
|
|
1140
|
+
min-height: 1.75rem;
|
|
1141
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1142
|
+
color: var(--diffs-fg);
|
|
1143
|
+
align-items: center;
|
|
1144
|
+
gap: .25rem;
|
|
1145
|
+
padding-inline: .5rem;
|
|
1146
|
+
font-size: .75rem;
|
|
1147
|
+
line-height: 1.2;
|
|
1148
|
+
display: flex;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
[data-merge-conflict-action] {
|
|
1152
|
+
appearance: none;
|
|
1153
|
+
color: var(--diffs-fg-number);
|
|
1154
|
+
font: inherit;
|
|
1155
|
+
cursor: pointer;
|
|
1156
|
+
background: none;
|
|
1157
|
+
border: 0;
|
|
1158
|
+
padding: 0;
|
|
1159
|
+
font-style: normal;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
[data-merge-conflict-action]:hover {
|
|
1163
|
+
color: var(--diffs-fg);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
[data-merge-conflict-action="current"]:hover {
|
|
1167
|
+
color: var(--diffs-addition-base);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
[data-merge-conflict-action="incoming"]:hover {
|
|
1171
|
+
color: var(--diffs-modified-base);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
[data-merge-conflict-action-separator] {
|
|
1175
|
+
color: var(--diffs-fg-number);
|
|
1176
|
+
opacity: .6;
|
|
1177
|
+
user-select: none;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
[data-diffs-header="default"] {
|
|
1181
|
+
background-color: var(--diffs-bg);
|
|
1182
|
+
justify-content: space-between;
|
|
1183
|
+
align-items: center;
|
|
1184
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1185
|
+
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1186
|
+
z-index: 2;
|
|
1187
|
+
flex-direction: row;
|
|
1188
|
+
padding-inline: 16px;
|
|
1189
|
+
display: flex;
|
|
1190
|
+
position: relative;
|
|
1191
|
+
top: 0;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
[data-header-content] {
|
|
1195
|
+
align-items: center;
|
|
1196
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1197
|
+
white-space: nowrap;
|
|
1198
|
+
flex-direction: row;
|
|
1199
|
+
min-width: 0;
|
|
1200
|
+
display: flex;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1204
|
+
text-overflow: ellipsis;
|
|
1205
|
+
white-space: nowrap;
|
|
1206
|
+
direction: rtl;
|
|
1207
|
+
min-width: 0;
|
|
1208
|
+
overflow: hidden;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
[data-prev-name] {
|
|
1212
|
+
opacity: .7;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
[data-rename-icon] {
|
|
1216
|
+
fill: currentColor;
|
|
1217
|
+
flex-grow: 0;
|
|
1218
|
+
flex-shrink: 0;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
[data-diffs-header="default"] [data-metadata] {
|
|
1222
|
+
white-space: nowrap;
|
|
1223
|
+
align-items: center;
|
|
1224
|
+
gap: 1ch;
|
|
1225
|
+
display: flex;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
[data-diffs-header="default"] [data-additions-count] {
|
|
1229
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1230
|
+
color: var(--diffs-addition-base);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
[data-diffs-header="default"] [data-deletions-count] {
|
|
1234
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1235
|
+
color: var(--diffs-deletion-base);
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
[data-change-icon] {
|
|
1239
|
+
fill: currentColor;
|
|
1240
|
+
flex-shrink: 0;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1244
|
+
color: var(--diffs-modified-base);
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
[data-change-icon="new"] {
|
|
1248
|
+
color: var(--diffs-addition-base);
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
[data-change-icon="deleted"] {
|
|
1252
|
+
color: var(--diffs-deletion-base);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
[data-change-icon="file"] {
|
|
1256
|
+
opacity: .6;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
[data-annotation-content] {
|
|
1260
|
+
z-index: 2;
|
|
1261
|
+
isolation: isolate;
|
|
1262
|
+
align-self: flex-start;
|
|
1263
|
+
min-width: 0;
|
|
1264
|
+
display: flow-root;
|
|
1265
|
+
position: relative;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1269
|
+
width: var(--diffs-column-content-width, auto);
|
|
1270
|
+
left: var(--diffs-column-number-width, 0);
|
|
1271
|
+
position: sticky;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
[data-annotation-slot] {
|
|
1275
|
+
text-wrap-mode: wrap;
|
|
1276
|
+
word-break: normal;
|
|
1277
|
+
white-space-collapse: collapse;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
[data-gutter-utility-slot] {
|
|
1281
|
+
touch-action: none;
|
|
1282
|
+
justify-content: flex-end;
|
|
1283
|
+
display: flex;
|
|
1284
|
+
position: absolute;
|
|
1285
|
+
top: 0;
|
|
1286
|
+
bottom: 0;
|
|
1287
|
+
right: 0;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
[data-utility-button] {
|
|
1291
|
+
appearance: none;
|
|
1292
|
+
cursor: pointer;
|
|
1293
|
+
width: 1lh;
|
|
1294
|
+
height: 1lh;
|
|
1295
|
+
font-size: var(--diffs-font-size, 13px);
|
|
1296
|
+
line-height: var(--diffs-line-height, 20px);
|
|
1297
|
+
background-color: var(--diffs-modified-base);
|
|
1298
|
+
color: var(--diffs-bg);
|
|
1299
|
+
fill: currentColor;
|
|
1300
|
+
z-index: 4;
|
|
1301
|
+
touch-action: none;
|
|
1302
|
+
border: none;
|
|
1303
|
+
border-radius: 4px;
|
|
1304
|
+
justify-content: center;
|
|
1305
|
+
align-items: center;
|
|
1306
|
+
margin-right: calc(-1lh + 1ch);
|
|
1307
|
+
padding: 0;
|
|
1308
|
+
display: flex;
|
|
1309
|
+
position: relative;
|
|
1310
|
+
|
|
1311
|
+
&:before {
|
|
1312
|
+
content: "";
|
|
1313
|
+
display: block;
|
|
1314
|
+
position: absolute;
|
|
1315
|
+
inset: 0 0 0 -4px;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
[data-decoration-bar-stack] {
|
|
1320
|
+
pointer-events: none;
|
|
1321
|
+
isolation: isolate;
|
|
1322
|
+
z-index: 1;
|
|
1323
|
+
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1324
|
+
box-sizing: content-box;
|
|
1325
|
+
border-left: 2px solid var(--diffs-bg);
|
|
1326
|
+
border-right: 2px solid var(--diffs-bg);
|
|
1327
|
+
width: 6px;
|
|
1328
|
+
position: absolute;
|
|
1329
|
+
top: 0;
|
|
1330
|
+
bottom: 0;
|
|
1331
|
+
right: -2px;
|
|
1332
|
+
|
|
1333
|
+
[data-decoration-bar-depth="1"] & {
|
|
1334
|
+
background-color: color-mix(in lab,
|
|
1335
|
+
var(--diffs-bg) 20%,
|
|
1336
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
[data-decoration-bar-depth="2"] & {
|
|
1340
|
+
background-color: color-mix(in lab,
|
|
1341
|
+
var(--diffs-bg) 45%,
|
|
1342
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
[data-decoration-bar-depth="3"] & {
|
|
1346
|
+
background-color: color-mix(in lab,
|
|
1347
|
+
var(--diffs-bg) 65%,
|
|
1348
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
[data-decoration-bar-start] & {
|
|
1352
|
+
border-top-left-radius: 5px;
|
|
1353
|
+
border-top-right-radius: 5px;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
[data-decoration-bar-end] & {
|
|
1357
|
+
z-index: 3;
|
|
1358
|
+
border-bottom-right-radius: 5px;
|
|
1359
|
+
border-bottom-left-radius: 5px;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
[data-placeholder] {
|
|
1364
|
+
contain: strict;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
[data-error-wrapper] {
|
|
1368
|
+
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1369
|
+
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1370
|
+
scrollbar-width: none;
|
|
1371
|
+
max-height: 400px;
|
|
1372
|
+
overflow: auto;
|
|
1373
|
+
|
|
1374
|
+
& [data-error-message] {
|
|
1375
|
+
color: var(--diffs-deletion-base);
|
|
1376
|
+
font-size: 18px;
|
|
1377
|
+
font-weight: bold;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
& [data-error-stack] {
|
|
1381
|
+
color: var(--diffs-fg-number);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
@layer theme, rendered, unsafe;
|
|
1387
|
+
`;let et;function He(e){if(et!=null)return et;const t=e.host;if(typeof HTMLElement<"u"&&t instanceof HTMLElement&&!t.isConnected)return;const n=document.createElement("div");n.setAttribute("data-code",""),n.setAttribute(no,"true");const i=document.createElement("div");return i.style.position="relative",i.style.width="200%",i.style.height="200%",n.appendChild(i),e.appendChild(n),et=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),et}function Xi(e){return`${Ti}: ${e==null?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`};`}const fn="@layer base, theme, rendered, unsafe;",es=new RegExp(`${ns(Ti)}\\s*:\\s*[^;]+;`);function ts(e){return`${fn}
|
|
1388
|
+
${Yi}
|
|
1389
|
+
@layer theme {
|
|
1390
|
+
${e}
|
|
1391
|
+
}`}function pn(e){return`${fn}
|
|
1392
|
+
@layer unsafe {
|
|
1393
|
+
${e}
|
|
1394
|
+
}`}function gn(e,t="system",n){return`${fn}
|
|
1395
|
+
@layer rendered {
|
|
1396
|
+
:host {${t==="system"?"":`
|
|
1397
|
+
color-scheme: ${t};`}
|
|
1398
|
+
${Xi(n)}
|
|
1399
|
+
${e}
|
|
1400
|
+
}
|
|
1401
|
+
}`}function Qi(e,t){const n=Xi(t);return e.replace(es,n)}function ns(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ge({code:e,pre:t,columnType:n,rowSpan:i,containerSize:r=!1}={}){return e==null&&(e=document.createElement("code"),e.setAttribute("data-code",""),n!=null&&e.setAttribute(`data-${n}`,""),t?.appendChild(e)),i!=null?e.style.setProperty("grid-row",`span ${i}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function Ji(e,t){if(t==null)return;const n=e.shadowRoot??e.attachShadow({mode:"open"});n.innerHTML===""&&(n.innerHTML=t)}function mn(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:r,overflow:o,split:s,totalLines:l,customProperties:a}){if(a!=null)for(const d in a){const h=a[d];h!=null&&e.setAttribute(d,`${h}`)}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");break}return r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),i?e.removeAttribute("data-background"):e.setAttribute("data-background",""),t==="diff"?e.setAttribute("data-diff-type",s?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.style.setProperty("--diffs-min-number-column-width-default",`${`${l}`.length}ch`),e}function Ke(e){if(typeof HTMLStyleElement<"u"&&e instanceof HTMLStyleElement)return!0;const t=e.tagName??e.nodeName;return typeof t=="string"&&t.toLowerCase()==="style"}function Nn(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?"custom":"default"}}function bn({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===""){t?.remove();return}return t??=is(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function is(){const e=document.createElement("style");return e.setAttribute(ki,""),e}if(typeof HTMLElement<"u"&&customElements.get("diffs-container")==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;const i=this.attachShadow({mode:"open"});e==null&&(e=new CSSStyleSheet,e.replaceSync(Yi)),i.adoptedStyleSheets=[e]}connectedCallback(){He(this.shadowRoot??this.attachShadow({mode:"open"}))}}customElements.define(xi,t)}const rs=[];let os=-1;var ss=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++os}`;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;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;constructor(e={theme:P},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Qo(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new Hi,this.interactionManager=new Ai("file",qe(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(qe(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;const t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Me(this.appliedThemeCSS.theme,this.options.theme??P)}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}const{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=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=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}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,file:r,lineAnnotations:o}=e;this.hydrateElements(t,n),as(this.pre,r,this.options.collapsed)||ls(this.headerElement,r,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:r,lineAnnotations:o}),i||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ji(e,t);for(const n of Array.from(e.shadowRoot?.children??[])){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n,this.appliedPreAttributes=void 0;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-theme-css")){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}if("diffsHeader"in n.dataset){this.headerElement=n,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(Nn(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?this.fileRenderer.getOrCreateLineCache(e):rs}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:i=!1,containerWrapper:r,deferManagers:o=!1,lineAnnotations:s,renderRange:l}){const{collapsed:a=!1,themeType:d="system"}=this.options;if(!this.enabled)throw new Error("File.render: attempting to call render after cleaned up");const h=a?void 0:l,c=this.renderRange,u=this.hasThemeChanged(),f=s!=null&&(s.length>0||this.lineAnnotations.length>0)?s!==this.lineAnnotations:!1,p=!se(this.file,e);if(!a&&!n&&yt(h,this.renderRange)&&!p&&!f&&!u)return this.applyCachedThemeState(d);this.renderRange=h,p&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Nn(this.options)),this.syncInteractionOptions(),s!=null&&this.setLineAnnotations(s),this.fileRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:m=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,r),this.applyCachedThemeState(d),a){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const v=this.fileRenderer.renderFile(e,Ei);v!=null&&this.applyThemeState(t,v.themeStyles,d,v.baseThemeType),v?.headerAST!=null&&this.applyHeaderToDOM(v.headerAST,t),this.injectUnsafeCSS()}catch(v){if(m)throw v;console.error(v),v instanceof Error&&this.applyErrorToDOM(v,t)}return i||this.emitPostRender(),!0}try{const v=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,f,p||u)||!this.applyPartialRender(c,h)){const g=this.fileRenderer.renderFile(e,h);if(g==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,g.themeStyles,d,g.baseThemeType),g.headerAST!=null&&this.applyHeaderToDOM(g.headerAST,t),this.applyFullRender(g,v)}this.applyBuffers(v,h),this.injectUnsafeCSS(),this.managersDirty=!0,o||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility()}catch(v){if(m)throw v;console.error(v),v instanceof Error&&this.applyErrorToDOM(v,t)}return i||this.emitPostRender(),!0}emitPostRender(e=!1){const{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;const i=this.mounted?"update":"mount";this.mounted=!0,n?.(t,this,i)}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(const{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){const t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){const{file:e,workerManager:t}=this;e==null||e.cacheKey==null||t==null||Xt(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.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.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(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const r=`${n}-${pe(i)}`;let o=this.annotationCache.get(r);if(o==null||!Jo(i,o.annotation)){o?.element.remove();const s=t(i);if(s==null)continue;o={element:un(pe(i)),annotation:i},o.element.appendChild(s),this.fileContainer.appendChild(o.element),this.annotationCache.set(r,o)}e.delete(r)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){const{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const n=qi();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){const{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??=Ki(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=pn(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,i){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,s=this.options.theme??P,l=typeof s=="string"?s:{...s},a=He(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a};return}this.themeCSSStyle=bn({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:gn(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){const e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=Qi(this.themeCSSStyle.textContent??"",He(e)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=Ge({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;const{file:n,code:i}=this,r=i!=null?this.getColumns(i):void 0;if(n==null||i==null||r==null)return!1;const o=e.startingLine,s=t.startingLine,l=e.totalLines===1/0?Number.POSITIVE_INFINITY:o+e.totalLines,a=t.totalLines===1/0?Number.POSITIVE_INFINITY:s+t.totalLines,d=Math.max(o,s),h=Math.min(l,a);if(h<=d||!this.trimDOMToOverlap(r.gutter,d,h)||!this.trimDOMToOverlap(r.content,d,h))return!1;let{length:c}=r.content.children;const u=(y,v)=>{if(!(v<=0))return this.fileRenderer.renderFile(n,{startingLine:y,totalLines:v,bufferBefore:0,bufferAfter:0})},f=s<d?u(s,d-s):void 0;if(f===void 0&&s<d)return!1;const p=a===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(0,a-h),m=a>h?u(h,p):void 0;return m===void 0&&a>h?!1:(this.cleanupErrorWrapper(),f!=null&&(r.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.gutterAST)),r.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.contentAST)),c+=f.rowCount),m!=null&&(r.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(m.gutterAST)),r.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(m.contentAST)),c+=m.rowCount),this.lastRowCount!==c&&(r.gutter.style.setProperty("grid-row",`span ${c}`),r.content.style.setProperty("grid-row",`span ${c}`),this.lastRowCount=c),!0)}getColumns(e){const 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){const i=this.getDOMBoundaryIndices(e,[t,n]),r=i.get(t)??e.children.length,o=i.get(n)??e.children.length;if(r>o)return!1;for(let s=e.children.length-1;s>=o;s-=1)e.children[s]?.remove();for(let s=r-1;s>=0;s-=1)e.children[s]?.remove();return!0}getDOMBoundaryIndices(e,t){const n=[...new Set(t)].sort((l,a)=>l-a),i=new Map;if(n.length===0)return i;let r=0,o=n[r];const{children:s}=e;o===0&&(i.set(0,0),r+=1,o=n[r]);for(let l=0;l<s.length;l+=1){const a=s[l];if(!(a instanceof HTMLElement))continue;const d=this.getLineIndexFromDOMNode(a);if(d!=null){for(;o!=null&&d>=o;)i.set(o,l),r+=1,o=n[r];if(r>=n.length)break}}for(const l of n)i.has(l)||i.set(l,s.length);return i}getLineIndexFromDOMNode(e){const t=e.dataset.lineIndex;if(t==null)return;const 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==null&&(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==null&&(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){const{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const i=this.cachedHeaderHTML??fe(e);if(this.cachedHeaderHTML=i,i!==this.lastRenderedHeaderHTML){const l=document.createElement("div");l.innerHTML=i;const a=l.firstElementChild;if(!(a instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(a,this.headerElement):t.shadowRoot?.prepend(a),this.headerElement=a,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged)return;const{renderHeaderPrefix:r,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){const l=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,sn,l),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{const l=r?.(n)??void 0,a=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,rn,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,on,a),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(i==null){t?.remove();return}const r=t??this.createHeaderSlotElement(n);return t==null&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}getOrCreateFileContainerNode(e,t){const{fileContainer:n}=this,i=e??n??document.createElement("diffs-container"),r=n!==i;return r&&this.emitPostRender(!0),this.fileContainer=i,n!=null&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){const{shadowRoot:t}=e;if(t!=null)for(const n of t.children)n instanceof SVGElement?this.spriteSVG??=n:Ke(n)&&n.hasAttribute("data-theme-css")?(this.themeCSSStyle??=n,this.hasAdoptedThemeCSS=!0):Ke(n)&&n.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=n,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){const n=document.createElement("div");n.innerHTML=Gi;const i=n.firstChild;i instanceof SVGElement&&(this.spriteSVG=i)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){const 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(const t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute("data-code")){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){const{overflow:n="scroll",disableLineNumbers:i=!1}=this.options,r={type:"file",split:!1,overflow:n,disableLineNumbers:i,diffIndicators:"none",disableBackground:!0,totalLines:t};ji(r,this.appliedPreAttributes)||(mn(e,r),this.appliedPreAttributes=r)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const n=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);const i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);const r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function as(e,t,n=!1){return!n&&e==null&&t!=null}function ls(e,t,n=!1){return e==null&&t!=null&&!n}function Dt(e){return{...an,...e}}function oe(e,t){const n=ds(e,t);return t?n:e.diffHeaderHeight+n}function ds(e,t){return e.paddingTop??(t?e.spacing:0)}function Ct(e){return e.paddingBottom??e.spacing}function hs(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}const cs=5e3;let us=-1;function fs(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 ps=class extends ss{virtualizer;metrics;__id=`virtualized-file:${++us}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=an,i,r=!1){super(e,i,r),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&Ae(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){const n=this.cache.heights.get(e);if(n!=null)return n;const i=t?2:1;return this.metrics.lineHeight*i}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(e==null)return;const{options:t}=this,n=!ln(t,e),i=fs(t,e);super.setOptions(e),i&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new 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;const{overflow:t="scroll"}=this.options;if(this.top=this.getVirtualizedTop(),t==="scroll"&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;const n=this.code.children[1];if(!(n instanceof HTMLElement))return e;const i=Kt(this.lineAnnotations);if(this.renderRange!=null&&i&&xt(this.renderRange)){const r=gs(n)??0;r!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=r,e=!0)}else!i&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(const r of n.children){if(!(r instanceof HTMLElement))continue;const o=r.dataset.lineIndex;if(o==null)continue;const s=Number(o);let l=r.getBoundingClientRect().height,a=!1;r.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in r.nextElementSibling.dataset||"noNewline"in r.nextElementSibling.dataset)&&("noNewline"in r.nextElementSibling.dataset&&(a=!0),l+=r.nextElementSibling.getBoundingClientRect().height);const d=this.getLineHeight(s,a);l!==d&&(e=!0,l===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(s):this.cache.heights.set(s,l))}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,i){const r=this.syncLineAnnotations(i);let o=n?.resetFileLayoutCache===!0||r;n?.metrics!=null&&(this.metrics=n.metrics,o=!0);const{collapsed:s=!1}=this.options;return this.currentCollapsed!==s&&(this.currentCollapsed=s,o=!0),o&&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;const{disableFileHeader:t=!1,collapsed:n=!1}=this.options,i=Fn(this.getOrCreateLineCache(this.file));let r=oe(this.metrics,t);if(n||i<0)return{top:r,height:0};const o=Math.min(Math.max(e-1,0),i),{overflow:s="scroll"}=this.options,{lineHeight:l}=this.metrics;if(r+=this.cache.fileAnnotationHeight,s==="scroll"&&!this.hasLineAnnotations())return{top:r+o*l,height:l};const a=this.getLayoutCheckpointBeforeLineIndex(o);r=a?.top??r;for(let d=a?.lineIndex??0;d<o;d++)r+=this.getLineHeight(d,!1);return{top:r,height:this.getLineHeight(o,!1)}}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;const{disableFileHeader:t=!1,collapsed:n=!1,overflow:i="scroll"}=this.options;if(n||this.renderRange.totalLines<=0)return;const r=Fn(this.getOrCreateLineCache(this.file));if(r<0)return;const o=oe(this.metrics,t),s=Math.min(this.renderRange.startingLine,r),l=Math.min(s+this.renderRange.totalLines-1,r);if(l<s)return;const{fileAnnotationHeight:a}=this.cache;if(i==="scroll"&&!this.hasLineAnnotations()){const{lineHeight:h}=this.metrics,c=o+(s===0?a:this.renderRange.bufferBefore),u=s+Math.max(Math.ceil((e-c)/h),0);return u>l?void 0:{lineNumber:u+1,top:o+a+u*h}}let d=o+(s===0?a:this.renderRange.bufferBefore);for(let h=s;h<=l;h++){if(d>=e)return{lineNumber:h+1,top:d};d+=this.getLineHeight(h)}}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};const t=e!=null?this.computeRenderRangeFromWindow(this.file,this.top,e):this.renderRange;if(t==null)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(r===0){const s=e??this.virtualizer.getWindowSpecs();this.top<s.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}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){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.file==null){this.layoutDirty=!1;return}const{disableFileHeader:i=!1,collapsed:r=!1,overflow:o="scroll"}=this.options,{lineHeight:s}=this.metrics,l=this.getOrCreateLineCache(this.file),a=oe(this.metrics,i),d=Ct(this.metrics);if(this.height+=a,r){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,o==="scroll"&&!this.hasLineAnnotations()?this.height+=this.getOrCreateLineCache(this.file).length*s:bt({lines:l,callback:({lineIndex:h})=>{this.addLayoutCheckpoint(h,this.height),this.height+=this.getLineHeight(h,!1)}}),l.length>0&&(this.height+=d),this.fileContainer!=null&&t&&!n){const h=this.fileContainer.getBoundingClientRect();h.height!==this.height?console.log("VirtualizedFile.computeApproximateSize: computed height doesnt match",{name:this.file.name,elementHeight:h.height,computedHeight:this.height}):console.log("VirtualizedFile.computeApproximateSize: computed height IS CORRECT")}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))}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:i,...r}){const{forceRenderOverride:o,isSetup:s}=this;this.forceRenderOverride=void 0;const l=this.syncLineAnnotations(i);if(l&&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();else{this.computeApproximateSize();const c=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(c==null)throw new Error("VirtualizedFile.render: simple virtualizer is not available");c.connect(e,this),this.isVisible=c.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);const a=this.virtualizer.getWindowSpecs(),d=this.top??0,h=this.computeRenderRangeFromWindow(this.file,d,a);return super.render({file:this.file,fileContainer:e,renderRange:h,lineAnnotations:i,forceRender:(o??n)||l,...r})}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%cs===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,i;for(;t<=n;){const r=t+n>>1,o=this.cache.checkpoints[r];if(o==null)throw new Error("VirtualizedFile: invalid checkpoint index");o.lineIndex<=e?(i=o,t=r+1):n=r-1}return i}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFile: invalid checkpoint index");s.top<=e?(r=o,n=o+1):i=o-1}if(t==null)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFile: invalid checkpoint index");if(s.lineIndex%t===0)return s}}getVirtualizedTop(){return this.virtualizer.type==="advanced"?this.virtualizer.getLocalTopForInstance(this):this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){const{disableFileHeader:r=!1,overflow:o="scroll"}=this.options,{hunkLineCount:s,lineHeight:l}=this.metrics,a=this.getOrCreateLineCache(e),d=a.length,h=this.height,c=oe(this.metrics,r),u=d>0?Ct(this.metrics):0,{fileAnnotationHeight:f}=this.cache,p=c+f,m=Math.max(0,h-c-f-u),y=Kt(this.lineAnnotations),v=t+c,g=f>0&&y&&v<i&&v+f>n;if(t<n-h||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-c-u};if(d<=s)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};const C=Math.ceil(Math.max(i-n,0)/l),b=Math.ceil(C/s)*s+s*2,x=b/s,S=(n+i)/2;if(o==="scroll"&&!this.hasLineAnnotations()){const Z=t+p,be=Z+m;if(!g&&!(Z<i&&be>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-c-u};const ae=Math.floor(g&&S<t+p?0:(S-(t+p))/l),j=Math.floor(ae/s)-Math.floor(x/2),Se=Math.ceil(d/s),D=Math.max(0,Math.min(j,Se))*s,B=j<0?b+j*s:b,z=D===0?0:f+D*l,le=Math.min(B,d-D);return{startingLine:D,totalLines:B,bufferBefore:z,bufferAfter:Math.max(0,(d-D-le)*l)}}const k=x,w=[],L=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-b*l*2),s);let I=t+(L?.top??p),A=L?.lineIndex??0,E,T,H;if(bt({lines:a,startingLine:L?.lineIndex??0,callback:({lineIndex:Z})=>{const be=A%s===0,ae=Math.floor(A/s);if(be&&(w[ae]=I-(t+p),H!=null)){if(H<=0)return!0;H--}const j=this.getLineHeight(Z,!1);return I>n-j&&I<i&&(E??=ae),I+j>S&&(T??=ae),H==null&&I>=i&&be&&(H=k),A++,I+=j,!1}}),E==null)if(g)E=0,T=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:h-c-u};T??=E;const N=Math.round(T-x/2),W=Math.max(0,Math.ceil(d/s)-x),M=Math.max(0,Math.min(N,W)),F=M*s,O=N<0?b+N*s:b,Q=w[M]??0,ge=F===0?0:f+Q,me=M+O/s,xe=me<w.length?m-w[me]:m-(I-t-p);return{startingLine:F,totalLines:O,bufferBefore:ge,bufferAfter:Math.max(0,xe)}}};function gs(e){let t;for(const n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===$i&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Fn(e){const t=e.at(-1);return t==null||t===""||t===`
|
|
1402
|
+
`||t===`\r
|
|
1403
|
+
`||t==="\r"?e.length-2:e.length-1}function _e(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}const ms=new TextEncoder,bs=new TextDecoder("utf-8",{ignoreBOM:!0}),vs=/[\uD800-\uDFFF]/,Qt=1024;let Te=new Uint8Array(Qt);function Zi(){Te.length!==Qt&&(Te=new Uint8Array(Qt))}function U(e){if(e.length===0)return e;if(vs.test(e))return JSON.parse(JSON.stringify(e));const t=e.length*3;Te.length<t&&(Te=new Uint8Array(t));const{written:n}=ms.encodeInto(e,Te);return bs.decode(Te.subarray(0,n))}function Cs(e,t,n){try{return Ss(e,t,n)}finally{Zi()}}function Ss(e,t,n=!1){const i=As(e),r=i?ks(e):ws(e);let o;const s=[];for(const l of r){if(i&&!Li.test(l)){if(o==null)o=U(l);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",l)}continue}else if(!i&&!Ts(l)){if(o==null)o=U(l);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",l)}continue}const a=er(l,{cacheKey:t!=null?`${t}-${s.length}`:void 0,isGitDiff:i,throwOnError:n});a!=null&&s.push(a)}return{patchMetadata:o,files:s}}function ys(e,t){try{return er(e,t)}finally{Zi()}}function er(e,{cacheKey:t,isGitDiff:n=Li.test(e),oldFile:i,newFile:r,throwOnError:o=!1}={}){let s=0;const l=rr(e,"@@ ");let a;const d=i==null||r==null;let h=0,c=0;for(const u of l){const f=tr(u),p=f[0];if(p==null){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",u);continue}const m=ir(p);let y=0,v=0;if(m==null||a==null){if(a!=null){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",u);continue}a={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&i!=null&&r!=null?zn(r.contents):[],deletionLines:!d&&i!=null&&r!=null?zn(i.contents):[],cacheKey:_n(t)},a.additionLines.length===1&&r?.contents===""&&(a.additionLines.length=0),a.deletionLines.length===1&&i?.contents===""&&(a.deletionLines.length=0);for(const L of f){if(L.startsWith("diff --git")){const A=L.trim().match(Zr),E=A?.[1]??A?.[2],T=A?.[3]??A?.[4];if(E==null||T==null){if(o)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",L);continue}a.name=U(T.trim()),E!==T&&(a.prevName=U(E.trim()));continue}const I=L.startsWith("---")||L.startsWith("+++")?L.match(n?Jr:Qr):null;if(I!=null){const[,A,E]=I;if(A==="---"&&E!=="/dev/null"){const T=U(E.trim());a.prevName=T,a.name=T}else A==="+++"&&E!=="/dev/null"&&(a.name=U(E.trim()))}else if(n){if(L.startsWith("new mode ")&&(a.mode=U(L.slice(8).trim())),L.startsWith("old mode ")&&(a.prevMode=U(L.slice(8).trim())),L.startsWith("new file mode")&&(a.type="new",a.mode=U(L.slice(13).trim())),L.startsWith("deleted file mode")&&(a.type="deleted",a.mode=U(L.slice(17).trim())),L.startsWith("similarity index")&&(L.startsWith("similarity index 100%")?a.type="rename-pure":a.type="rename-changed"),L.startsWith("index ")){const[,A,E,T]=L.trim().match(eo)??[];A!=null&&(a.prevObjectId=U(A)),E!=null&&(a.newObjectId=U(E)),T!=null&&(a.mode=U(T))}L.startsWith("rename from ")&&(a.prevName=U(L.slice(12).trim())),L.startsWith("rename to ")&&(a.name=U(L.slice(10).trim()))}}continue}let g,C;for(;f.length>0&&(f[f.length-1]===`
|
|
1404
|
+
`||f[f.length-1]==="\r"||f[f.length-1]===`\r
|
|
1405
|
+
`||f[f.length-1]==="");)f.pop();const{additionStart:b,deletionStart:x}=m;h=d?h:x-1,c=d?c:b-1;const S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:m.additionCount,additionStart:b,additionLines:y,deletionCount:m.deletionCount,deletionStart:x,deletionLines:v,deletionLineIndex:h,additionLineIndex:c,hunkContent:[],hunkContext:_n(m.hunkContext),hunkSpecs:U(p),noEOFCRAdditions:!1,noEOFCRDeletions:!1};let k=0,w=0;for(let L=1;L<f.length;L++){const I=f[L];if(k>=S.additionCount&&w>=S.deletionCount&&!I.startsWith("\\")){if(o&&Es(I)&&!Is(I))throw Error("parsePatchContent: hunk has more lines than expected");break}const A=I[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(o)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${I}"`),console.error("processFile: invalid rawLine:",I);continue}const E=Hs(A);if(E==="addition"){if(o&&k>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");const T=Pt(I);(g==null||g.type!=="change")&&(g=Ot("change",h,c),S.hunkContent.push(g)),c++,k++,d&&a.additionLines.push(T),g.additions++,y++,C="addition"}else if(E==="deletion"){if(o&&w>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");const T=Pt(I);(g==null||g.type!=="change")&&(g=Ot("change",h,c),S.hunkContent.push(g)),h++,w++,d&&a.deletionLines.push(T),g.deletions++,v++,C="deletion"}else if(E==="context"){if(o&&(w>=S.deletionCount||k>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");const T=Pt(I);(g==null||g.type!=="context")&&(g=Ot("context",h,c),S.hunkContent.push(g)),c++,h++,k++,w++,d&&(a.deletionLines.push(T),a.additionLines.push(T)),g.lines++,C="context"}else if(E==="metadata"&&g!=null){if(g.type==="context"?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):C==="deletion"?S.noEOFCRDeletions=!0:C==="addition"&&(S.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){const T=a.additionLines.length-1;T>=0&&(a.additionLines[T]=ye(a.additionLines[T]))}if(d&&(C==="deletion"||C==="context")){const T=a.deletionLines.length-1;T>=0&&(a.deletionLines[T]=ye(a.deletionLines[T]))}}}if(o&&(k!==S.additionCount||w!==S.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");S.additionLines=y,S.deletionLines=v,S.collapsedBefore=Math.max(S.additionStart-1-s,0),a.hunks.push(S),s=S.additionStart+S.additionCount-1;for(const L of S.hunkContent)L.type==="context"?(S.splitLineCount+=L.lines,S.unifiedLineCount+=L.lines):(S.splitLineCount+=Math.max(L.additions,L.deletions),S.unifiedLineCount+=L.deletions+L.additions);S.splitLineStart=a.splitLineCount+S.collapsedBefore,S.unifiedLineStart=a.unifiedLineCount+S.collapsedBefore,a.splitLineCount+=S.collapsedBefore+S.splitLineCount,a.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(a!=null){if(o&&d&&!n&&a.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(a.hunks.length>0&&!d&&a.additionLines.length>0&&a.deletionLines.length>0){const u=a.hunks[a.hunks.length-1],f=u.additionStart+u.additionCount-1,p=a.additionLines.length,m=Math.max(p-f,0);a.splitLineCount+=m,a.unifiedLineCount+=m}return n||(a.prevName!=null&&a.name!==a.prevName?a.hunks.length>0?a.type="rename-changed":a.type="rename-pure":(i==null||i.contents==="")&&r!=null&&r.contents!==""?a.type="new":i!=null&&i.contents!==""&&(r==null||r.contents==="")&&(a.type="deleted")),a.type!=="rename-pure"&&a.type!=="rename-changed"&&(a.prevName=void 0),a}}function xs(e,t,n=!1){const i=[],r=Ls(e)?e.split(Kr):[e];for(const o of r)try{i.push(Cs(o,t!=null?`${t}-${i.length}`:void 0,n))}catch(s){if(n)throw s;console.error(s)}return i}function Ls(e){return e.startsWith("From ")||e.includes(`
|
|
1406
|
+
From `)}function zn(e){const t=tr(e);for(let n=0;n<t.length;n++)t[n]=U(t[n]);return t}function tr(e){if(e.length===0)return[""];const t=[];let n=0;for(;;){const i=e.indexOf(`
|
|
1407
|
+
`,n);if(i===-1)break;t.push(e.slice(n,i+1)),n=i+1}return n<e.length&&t.push(e.slice(n)),t}function ks(e){return rr(e,"diff --git")}function ws(e){if(e.length===0)return[""];const t=[];let n=0,i=0,r=0,o=0,s=!1;for(;i<e.length;){const l=Jt(e,i);if(r<=0&&o<=0){if(nr(e,i)){i>n&&t.push(e.slice(n,i)),n=i,s=!0,i=Jt(e,l);continue}if(s&&e.startsWith("@@ -",i)){const d=ir(e.slice(i,l));d!=null&&(r=d.deletionCount,o=d.additionCount)}i=l;continue}const a=e[i];if(a==="\\"){i=l;continue}a===" "?(r=Math.max(r-1,0),o=Math.max(o-1,0)):a==="-"?r=Math.max(r-1,0):a==="+"&&(o=Math.max(o-1,0)),i=l}return t.push(e.slice(n)),t}function Ts(e){return nr(e,0)}function nr(e,t){const n=Jt(e,t);return Un(e,t,"---")&&Un(e,n,"+++")}function Un(e,t,n){if(!e.startsWith(n,t))return!1;const i=e[t+n.length];if(i!==" "&&i!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){const o=e[r];if(o===`
|
|
1408
|
+
`||o==="\r")break;if(o!==" "&&o!==" ")return!0}return!1}function Jt(e,t){const n=e.indexOf(`
|
|
1409
|
+
`,t);return n===-1?e.length:n+1}function Es(e){const t=e[0];return t==="+"||t==="-"||t===" "}function Is(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){const n=e[t];if(n!==" "&&n!==" "&&n!==`
|
|
1410
|
+
`&&n!=="\r")return!1}return!0}function ir(e){if(!e.startsWith("@@ -"))return;let t=4;const n=tt(e,t);if(n==null)return;const i=n.value;t=n.endIndex;let r=1;if(e[t]===","){const h=tt(e,t+1);if(h==null)return;r=h.value,t=h.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;const o=tt(e,t);if(o==null)return;const s=o.value;t=o.endIndex;let l=1;if(e[t]===","){const h=tt(e,t+1);if(h==null)return;l=h.value,t=h.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let a;const d=t+3;return e[d]===" "&&(a=Rs(e.slice(d+1))),{additionCount:l,additionStart:s,deletionCount:r,deletionStart:i,hunkContext:a}}function tt(e,t){let n=t,i=0;for(;n<e.length;n++){const r=e.charCodeAt(n)-48;if(r<0||r>9)break;i=i*10+r}if(n!==t)return{value:i,endIndex:n}}function Rs(e){return e.endsWith(`\r
|
|
1411
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
1412
|
+
`)?e.slice(0,-1):e}function As(e){return e.startsWith("diff --git")||e.includes(`
|
|
1413
|
+
diff --git`)}function rr(e,t){if(e.length===0)return[""];const n=`
|
|
1414
|
+
${t}`,i=e.startsWith(t)?0:Bn(e,n,0);if(i===-1)return[e];const r=[];i>0&&r.push(e.slice(0,i));let o=i;for(;;){const s=Bn(e,n,o+1);if(s===-1)break;r.push(e.slice(o,s)),o=s}return r.push(e.slice(o)),r}function Bn(e,t,n){const i=e.indexOf(t,n);return i===-1?-1:i+1}function _n(e){return e==null?e:U(e)}function Hs(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function Pt(e){const t=e.slice(1);return U(t===""?`
|
|
1415
|
+
`:t)}function Ot(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 Zt(e,t,n,i=!1){const r=ys(Gr(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:i});if(r==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return t.lang!=null&&(r.lang=t.lang),r}var Ms=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,this.enabled=!1)}setup(e,t,n){if(t==null||n==null)for(const i of e.children??[])i instanceof HTMLElement&&("deletions"in i.dataset?t=i:"additions"in i.dataset&&(n=i));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 Fe(e,t){return Me(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function nt(e){return R({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function it(e){return R({tagName:"div",children:[R({tagName:"span",children:[V("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function Nt(e){return R({tagName:"div",children:[ut({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 Le({type:e,content:t,expandIndex:n,chunked:i=!1,slotName:r,isFirstHunk:o,isLastHunk:s}){let l=0;const a=[];if(e==="metadata"&&t!=null&&a.push(R({tagName:"div",children:[V(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){const d=[];n!=null&&(i?(o||(d.push(Nt("up")),l++),s||(d.push(Nt("down")),l++)):(d.push(Nt(!o&&!s?"both":o?"down":"up")),l++)),d.push(R({tagName:"div",children:[R({tagName:"span",children:[V(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&n!=null&&d.push(R({tagName:"div",children:[V("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),a.push(R({tagName:"div",children:d,properties:{"data-separator-wrapper":"","data-separator-multi-button":l>1?"":void 0}}))}return e==="custom"&&r!=null&&a.push(R({tagName:"slot",properties:{name:r}})),R({tagName:"div",children:a,properties:{"data-separator":a.length===0?"simple":e,"data-expand-index":n,"data-separator-first":o?"":void 0,"data-separator-last":s?"":void 0}})}function Ds(e,t){return`hunk-separator-${e}-${t}`}function Ps(e){const t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Os(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function $n({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 rt({item:e,arr:t,enableJoin:n,isNeutral:i=!1,isLastItem:r=!1}){const o=t[t.length-1];if(o==null||r||!n){t.push([i?0:1,e.value]);return}const s=o[0]===0;if(i===s||i&&e.value.length===1&&!s){o[1]+=e.value;return}t.push([i?0:1,e.value])}function Ye({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}){const o=Math.max(t,0);if(o===0||e)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(n===!0||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const s=n?.get(i),l=Math.min(Math.max(s?.fromStart??0,0),o),a=Math.min(Math.max(s?.fromEnd??0,0),o),d=l+a,h=d>=o;return{fromStart:h?o:l,fromEnd:h?0:a,rangeSize:o,collapsedLines:Math.max(o-d,0),renderAll:h}}function or({fileDiff:e,errorPrefix:t}){const n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;const i=e.additionLines.length-(n.additionLineIndex+n.additionCount),r=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(i<=0&&r<=0)return 0;if(i!==r)throw new Error(`${t}: trailing context mismatch (additions=${i}, deletions=${r}) for ${e.name}`);return Math.min(i,r)}function Xe({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:r}){if(t!==e.hunks.length-1)return;const o=or({fileDiff:e,errorPrefix:r});if(o<=0)return;if(n===!0||o<=i)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const s=n?.get(e.hunks.length),l=Math.min(Math.max(s?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function sr({type:e,metrics:t}){return t.hunkSeparatorHeight??hs(e)}function ar({type:e,metrics:t}){return e==="simple"||e==="metadata"||e==="line-info-basic"?0:t.spacing}function Ns({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 Fs(e){return e!=="simple"&&e!=="metadata"}function $e({type:e,metrics:t,hunkIndex:n,hunkSpecs:i}){if(!Ns({type:e,hunkIndex:n,hunkSpecs:i}))return;const r=sr({type:e,metrics:t}),o=ar({type:e,metrics:t}),s=n>0?o:0,l=o;return{height:r,gapBefore:s,gapAfter:l,totalHeight:s+r+l}}function Ve({type:e,metrics:t}){if(!Fs(e))return;const n=sr({type:e,metrics:t}),i=ar({type:e,metrics:t});return{height:n,gapBefore:i,gapAfter:0,totalHeight:i+n}}function je({diff:e,diffStyle:t,startingLine:n=0,totalLines:i=1/0,expandedHunks:r,collapsedContextThreshold:o=1,callback:s}){const l=zs({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:o}),a={viewportStart:n,viewportEnd:n+i,isWindowedHighlight:n>0||i<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;const d=a.unifiedCount>=n+i,h=a.splitCount>=n+i;return t==="unified"?d:(t==="split"||d)&&h},shouldSkip(d,h){if(!a.isWindowedHighlight)return!1;const c=a.unifiedCount+d<n,u=a.splitCount+h<n;return t==="unified"?c:(t==="split"||c)&&u},incrementCounts(d,h){(t==="unified"||t==="both")&&(a.unifiedCount+=d),(t==="split"||t==="both")&&(a.splitCount+=h)},isInWindow(d,h){if(!a.isWindowedHighlight)return!0;const c=a.isInUnifiedWindow(d),u=a.isInSplitWindow(h);return t==="unified"?c:t==="split"?u:c||u},isInUnifiedWindow(d){return!a.isWindowedHighlight||a.unifiedCount>=n-d&&a.unifiedCount<n+i},isInSplitWindow(d){return!a.isWindowedHighlight||a.splitCount>=n-d&&a.splitCount<n+i},emit(d,h=!1){return h||(t==="unified"?a.incrementCounts(1,0):t==="split"?a.incrementCounts(0,1):a.incrementCounts(1,1)),s(d)??!1}};e:for(let d=l.hunkIndex;d<e.hunks.length;d++){let p=function(w,L){return u==null||u.collapsedLines<=0||u.fromStart+u.fromEnd>0?0:t==="unified"?w===h.unifiedLineStart+h.unifiedLineCount-1?u.collapsedLines:0:L===h.splitLineStart+h.splitLineCount-1?u.collapsedLines:0},y=function(){return m?0:(m=!0,c.collapsedLines)};const h=e.hunks[d];if(h==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const c=Ye({isPartial:e.isPartial,rangeSize:h.collapsedBefore,expandedHunks:r,hunkIndex:d,collapsedContextThreshold:o}),u=d===a.finalHunkIndex?Xe({fileDiff:e,hunkIndex:d,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,f=c.fromStart+c.fromEnd;let m=c.collapsedLines===0;if(a.shouldSkip(f,f))a.incrementCounts(f,f),y();else{let w=h.unifiedLineStart-c.rangeSize,L=h.splitLineStart-c.rangeSize,I=h.deletionLineIndex-c.rangeSize,A=h.additionLineIndex-c.rangeSize,E=h.deletionStart-c.rangeSize,T=h.additionStart-c.rangeSize;if(ot(a,c.fromStart,t,H=>a.emit({hunkIndex:d,hunk:h,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:E+H,lineIndex:I+H,noEOFCR:!1,unifiedLineIndex:w+H,splitLineIndex:L+H},additionLine:{unifiedLineIndex:w+H,splitLineIndex:L+H,lineIndex:A+H,lineNumber:T+H,noEOFCR:!1}}))||(w=h.unifiedLineStart-c.fromEnd,L=h.splitLineStart-c.fromEnd,I=h.deletionLineIndex-c.fromEnd,A=h.additionLineIndex-c.fromEnd,E=h.deletionStart-c.fromEnd,T=h.additionStart-c.fromEnd,ot(a,c.fromEnd,t,H=>a.emit({hunkIndex:d,hunk:h,collapsedBefore:y(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:E+H,lineIndex:I+H,noEOFCR:!1,unifiedLineIndex:w+H,splitLineIndex:L+H},additionLine:{unifiedLineIndex:w+H,splitLineIndex:L+H,lineIndex:A+H,lineNumber:T+H,noEOFCR:!1}}),()=>{y()})))break e}let v=h.unifiedLineStart,g=h.splitLineStart,C=h.deletionLineIndex,b=h.additionLineIndex,x=h.deletionStart,S=h.additionStart;const k=h.hunkContent.at(-1);for(const w of h.hunkContent){if(a.shouldBreak())break e;const L=w===k;if(w.type==="context"){if(a.shouldSkip(w.lines,w.lines))a.incrementCounts(w.lines,w.lines),y();else if(ot(a,w.lines,t,I=>{const A=L&&I===w.lines-1,E=v+I,T=g+I;return a.emit({hunkIndex:d,hunk:h,collapsedBefore:y(),collapsedAfter:p(E,T),type:"context",deletionLine:{lineNumber:x+I,lineIndex:C+I,noEOFCR:A&&h.noEOFCRDeletions,unifiedLineIndex:E,splitLineIndex:T},additionLine:{unifiedLineIndex:E,splitLineIndex:T,lineIndex:b+I,lineNumber:S+I,noEOFCR:A&&h.noEOFCRAdditions}})},()=>{y()}))break e;v+=w.lines,g+=w.lines,C+=w.lines,b+=w.lines,x+=w.lines,S+=w.lines}else{const I=Math.max(w.deletions,w.additions),A=w.deletions+w.additions;if(!a.shouldSkip(A,I)){const E=_s(a,w,t);(E[0]?.[0]??0)>0&&y();for(const[T,H]of E)for(let N=T;N<H;N++){const W=p(v+N,t==="unified"?g+(N<w.deletions?N:N-w.deletions):g+N);if(a.emit($s({hunkIndex:d,hunk:h,collapsedBefore:y(),collapsedAfter:W,diffStyle:t,index:N,unifiedLineIndex:v,splitLineIndex:g,additionLineIndex:b,deletionLineIndex:C,additionLineNumber:S,deletionLineNumber:x,content:w,isLastContent:L,unifiedCount:A,splitCount:I}),!0))break e}}y(),a.incrementCounts(A,I),v+=A,g+=I,C+=w.deletions,b+=w.additions,x+=w.deletions,S+=w.additions}}if(u!=null){const{collapsedLines:w,fromStart:L,fromEnd:I}=u,A=L+I;if(ot(a,A,t,E=>{const T=E===A-1;return a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:T?w:0,type:"context-expanded",deletionLine:{lineNumber:x+E,lineIndex:C+E,noEOFCR:!1,unifiedLineIndex:v+E,splitLineIndex:g+E},additionLine:{unifiedLineIndex:v+E,splitLineIndex:g+E,lineIndex:b+E,lineNumber:S+E,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function zs({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}){if(n<=0||t==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const o=Us({diff:e,expandedHunks:i,collapsedContextThreshold:r});let s=0,l=e.hunks.length-1,a=e.hunks.length;for(;s<=l;){const h=s+l>>1,c=o[h+1];if(c==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(t==="unified"?c.unifiedCount:c.splitCount)>n?(a=h,l=h-1):s=h+1}if(a>=e.hunks.length){const h=o[e.hunks.length];if(h==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:h.splitCount,unifiedCount:h.unifiedCount}}const d=o[a];if(d==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:a,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}function Us({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let i=0,r=0;const o=e.hunks.length-1,s=[{splitCount:0,unifiedCount:0}];for(let l=0;l<e.hunks.length;l++){const a=e.hunks[l];if(a==null)throw new Error("iterateOverDiff: invalid hunk summary index");const d=Ye({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:l,collapsedContextThreshold:n}),h=d.fromStart+d.fromEnd;i+=h+a.splitLineCount,r+=h+a.unifiedLineCount;const c=l===o?Xe({fileDiff:e,hunkIndex:l,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"iterateOverDiff"}):void 0;if(c!=null){const u=c.fromStart+c.fromEnd;i+=u,r+=u}s.push({splitCount:i,unifiedCount:r})}return s}function Bs(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const i=[];function r(l){const a=Math.max(0,e.viewportStart-l),d=Math.min(t,e.viewportEnd-l);d>a&&i.push([a,d])}if(n!=="split"&&r(e.unifiedCount),n!=="unified"&&r(e.splitCount),i.length===0)return[0,0];let o=i[0][0],s=i[0][1];for(let l=1;l<i.length;l++){const a=i[l];o=Math.min(o,a[0]),s=Math.max(s,a[1])}return[o,s]}function ot(e,t,n,i,r,o){const[s,l]=Bs(e,t,n);s>0&&(e.incrementCounts(s,s),r?.());let a=s;for(;a<t;){if(o?.()===!0)return!0;if(a>=l){e.incrementCounts(t-a,t-a);break}if(e.isInWindow(0,0)){if(i(a)===!0)return!0}else e.incrementCounts(1,1);a++}return!1}function _s(e,t,n){if(!e.isWindowedHighlight)return[[0,n==="unified"?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];const i=n!=="split",r=n!=="unified",o=n==="unified"?"unified":"split",s=[];function l(c,u){if(c+u<=e.viewportStart||c>=e.viewportEnd)return;const f=Math.max(0,e.viewportStart-c),p=Math.min(u,e.viewportEnd-c);return p>f?[f,p]:void 0}function a(c,u){return o==="split"?c:u==="additions"?[c[0]+t.deletions,c[1]+t.deletions]:c}function d(c,u){if(c==null)return;const[f,p]=a(c,u);p>f&&s.push([f,p])}if(i&&(d(l(e.unifiedCount,t.deletions),"deletions"),d(l(e.unifiedCount+t.deletions,t.additions),"additions")),r&&(d(l(e.splitCount,t.deletions),"deletions"),d(l(e.splitCount,t.additions),"additions")),s.length===0)return s;s.sort((c,u)=>c[0]-u[0]);const h=[s[0]];for(const[c,u]of s.slice(1)){const f=h[h.length-1];c<=f[1]?f[1]=Math.max(f[1],u):h.push([c,u])}return h}function $s({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,diffStyle:r,index:o,unifiedLineIndex:s,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:d,additionLineNumber:h,deletionLineNumber:c,content:u,isLastContent:f,unifiedCount:p,splitCount:m}){const y=o<u.deletions?s+o:void 0,v=r==="unified"?o>=u.deletions?s+o:void 0:o<u.additions?s+u.deletions+o:void 0,g=r==="unified"?l+(o<u.deletions?o:o-u.deletions):l+o,C=o<u.deletions?d+o:void 0,b=o<u.deletions?c+o:void 0,x=r==="unified"?o>=u.deletions?a+(o-u.deletions):void 0:o<u.additions?a+o:void 0,S=r==="unified"?o>=u.deletions?h+(o-u.deletions):void 0:o<u.additions?h+o:void 0,k=r==="unified"?f&&o===u.deletions-1&&t.noEOFCRDeletions:f&&o===m-1&&t.noEOFCRDeletions,w=r==="unified"?f&&o===p-1&&t.noEOFCRAdditions:f&&o===m-1&&t.noEOFCRAdditions,L=C!=null&&b!=null&&y!=null?{lineNumber:b,lineIndex:C,noEOFCR:k,unifiedLineIndex:y,splitLineIndex:g}:void 0,I=x!=null&&S!=null&&v!=null?{unifiedLineIndex:v,splitLineIndex:g,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(L==null&&I!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:void 0,additionLine:I};if(L!=null&&I==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:void 0};if(L==null||I==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:L,additionLine:I}}const Vs={forcePlainText:!1};function Ws(e,t,n,{forcePlainText:i,startingLine:r,totalLines:o,expandedHunks:s,collapsedContextThreshold:l=1}=Vs){i?(r??=0,o??=1/0):(r=0,o=1/0);const a=r>0||o<1/0,d=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,h=cn({theme:n.theme,highlighter:t}),c=i&&!a&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,u={deletionLines:[],additionLines:[]},{maxLineDiffLength:f}=n,p=!i&&!e.isPartial,m=i?s:void 0,y=new Map;function v(C){const b=p?0:C,x=y.get(b)??js();return y.set(b,x),x}function g(C,b,x,S){if(a){let k=x.at(-1);(k==null||k.targetIndex+k.count!==b)&&(k={targetIndex:b,originalOffset:S.length,count:0},x.push(k)),k.count++}S.push(C)}je({diff:e,diffStyle:"both",startingLine:r,totalLines:o,expandedHunks:a?m:!0,collapsedContextThreshold:l,callback:({hunkIndex:C,additionLine:b,deletionLine:x,type:S})=>{const k=v(C),w=b!=null?b.splitLineIndex:x.splitLineIndex;S==="change"&&b!=null&&x!=null&&Gs({additionLine:e.additionLines[b.lineIndex],deletionLine:e.deletionLines[x.lineIndex],deletionLineIndex:k.deletionContent.length,additionLineIndex:k.additionContent.length,deletionDecorations:k.deletionDecorations,additionDecorations:k.additionDecorations,lineDiffType:c,maxLineDiffLength:f}),x!=null&&(g(e.deletionLines[x.lineIndex],x.lineIndex,k.deletionSegments,k.deletionContent),k.deletionInfo.push({type:S==="change"?"change-deletion":S,lineNumber:x.lineNumber,altLineNumber:S==="change"?void 0:b.lineNumber??void 0,lineIndex:`${x.unifiedLineIndex},${w}`})),b!=null&&(g(e.additionLines[b.lineIndex],b.lineIndex,k.additionSegments,k.additionContent),k.additionInfo.push({type:S==="change"?"change-addition":S,lineNumber:b.lineNumber,altLineNumber:S==="change"?void 0:x.lineNumber??void 0,lineIndex:`${b.unifiedLineIndex},${w}`}))}});for(const C of y.values()){if(C.deletionContent.length===0&&C.additionContent.length===0)continue;const b={name:e.prevName??e.name,contents:C.deletionContent.value},x={name:e.name,contents:C.additionContent.value},{deletionLines:S,additionLines:k}=qs({deletionFile:b,deletionInfo:C.deletionInfo,deletionDecorations:C.deletionDecorations,additionFile:x,additionInfo:C.additionInfo,additionDecorations:C.additionDecorations,highlighter:t,options:n,languageOverride:i?"text":e.lang});if(p){u.deletionLines=S,u.additionLines=k;continue}if(C.deletionSegments.length>0)for(const w of C.deletionSegments)for(let L=0;L<w.count;L++)u.deletionLines[w.targetIndex+L]=S[w.originalOffset+L];else u.deletionLines.push(...S);if(C.additionSegments.length>0)for(const w of C.additionSegments)for(let L=0;L<w.count;L++)u.additionLines[w.targetIndex+L]=k[w.originalOffset+L];else u.additionLines.push(...k)}return{code:u,themeStyles:h,baseThemeType:d}}function Gs({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:i,deletionDecorations:r,additionDecorations:o,lineDiffType:s,maxLineDiffLength:l}){if(e==null||t==null||s==="none"||(e=ye(e),t=ye(t),e.length>l||t.length>l))return;const a=s==="char"?Fr(e,t):Br(e,t),d=[],h=[],c=s==="word-alt",u=a.at(-1);for(const p of a){const m=p===u;!p.added&&!p.removed?(rt({item:p,arr:d,enableJoin:c,isNeutral:!0,isLastItem:m}),rt({item:p,arr:h,enableJoin:c,isNeutral:!0,isLastItem:m})):p.removed?rt({item:p,arr:d,enableJoin:c,isLastItem:m}):rt({item:p,arr:h,enableJoin:c,isLastItem:m})}let f=0;for(const p of d)p[0]===1&&r.push($n({line:n,spanStart:f,spanLength:p[1].length})),f+=p[1].length;f=0;for(const p of h)p[0]===1&&o.push($n({line:i,spanStart:f,spanLength:p[1].length})),f+=p[1].length}function js(){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 qs({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:i,highlighter:r,deletionDecorations:o,additionDecorations:s,languageOverride:l,options:{theme:a=P,...d}}){const h=l??X(e.name),c=l??X(t.name),{state:u,transformers:f}=_i(d.useTokenTransformer),p=typeof a=="string"?{...d,lang:"text",theme:a,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:_("token"),tokenizeTimeLimit:0}:{...d,lang:"text",themes:a,transformers:f,decorations:void 0,defaultColor:!1,cssVariablePrefix:_("token"),tokenizeTimeLimit:0};return{deletionLines:e.contents===""?[]:(p.lang=h,u.lineInfo=n,p.decorations=o,qt(r.codeToHast(ye(e.contents),p))),additionLines:t.contents===""?[]:(p.lang=c,p.decorations=s,u.lineInfo=i,qt(r.codeToHast(ye(t.contents),p)))}}function en(e){const t=e.lang??X(e.name),n=e.lang??(e.prevName!=null?X(e.prevName):"text");return t==="text"&&n==="text"}let Ks=-1;var lr=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Ks}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang="text";renderCache;constructor(e={theme:P},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=We(e.theme??P)?Fi():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)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){const i={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(i.fromStart+=n),(t==="down"||t==="both")&&(i.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,i)}getExpandedHunk(e){return this.expandedHunks.get(e)??so}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(const t of e){const n=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),i=n[t.lineNumber]??[];n[t.lineNumber]=i,i.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t!=="change"?{gutterLineType:t}:{gutterLineType:e==="deletions"?"change-deletion":"change-addition"}}createAnnotationElement=e=>jt(e);getOptionsWithDefaults(){const{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:i=!1,disableLineNumbers:r=!1,disableVirtualizationBuffers:o=!1,collapsed:s=!1,expandUnchanged:l=!1,collapsedContextThreshold:a=1,expansionLineCount:d=100,hunkSeparators:h="line-info",lineDiffType:c="word-alt",maxLineDiffLength:u=1e3,overflow:f="scroll",stickyHeader:p=!1,theme:m=P,headerRenderMode:y="default",tokenizeMaxLineLength:v=1e3,tokenizeMaxLength:g=io,useTokenTransformer:C=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:i,disableLineNumbers:r,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:l,collapsedContextThreshold:a,expansionLineCount:d,hunkSeparators:h,lineDiffType:c,maxLineDiffLength:u,overflow:f,stickyHeader:p,theme:this.workerManager?.getDiffRenderOptions().theme??m,headerRenderMode:y,tokenizeMaxLineLength:v,tokenizeMaxLength:g,useTokenTransformer:C,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await St(hn(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;const{options:t}=this.getRenderOptions(e),n=zt(e,this.getTokenizeMaxLength());let i=this.workerManager?.getDiffResultCache(e);i!=null&&!Fe(t,i.options)&&(i=void 0),this.renderCache??={diff:e,highlighted:!n&&!en(e),options:t,result:n?void 0:i?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter==null&&(this.computedLang=e.lang??X(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();const{theme:i,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}=this.getOptionsWithDefaults();return{theme:i,useTokenTransformer:Wi(this.options),tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}})();this.getOptionsWithDefaults();const{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!_e(e,n.diff)||!Fe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Re){if(e==null)return;const{expandUnchanged:n=!1,collapsedContextThreshold:i}=this.getOptionsWithDefaults();let{options:r,forceHighlight:o}=this.getRenderOptions(e);const s=this.getMatchingWorkerResultCache(e,r);s!=null&&!this.hasHighlightedRenderCache(e,r)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...s},o=!1),this.renderCache??={diff:e,highlighted:!1,options:r,result:void 0,renderRange:void 0};const l=e.additionLines.length>0||e.deletionLines.length>0,a=!l||en(e)||zt(e,this.getTokenizeMaxLength()),d=!_e(e,this.renderCache.diff),h=!yt(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(a||this.renderCache.result==null||!this.renderCache.highlighted&&(d||h))&&(this.renderCache.diff=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(this.renderCache.result==null||d||h||o)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Os(t)||n?!0:this.expandedHunks,i)),this.renderCache.renderRange=t),!a&&l&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??X(e.name);const c=this.highlighter!=null&&We(r.theme),u=this.highlighter!=null&&pt(this.computedLang),f=!a&&u;if(this.highlighter!=null&&c&&(o||a||!this.renderCache.highlighted&&f||this.renderCache.result==null)){const{result:p,options:m}=this.renderDiffWithHighlighter(e,this.highlighter,a||!u);this.renderCache={diff:e,options:m,highlighted:f,result:p,renderRange:void 0}}(!c||!a&&!u)&&this.asyncHighlight(e).then(({result:p,options:m})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,p,m,!a)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=Re){const{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){const{diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s}=this.getOptionsWithDefaults();return Ui({type:"diff",diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:s,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){const t=zt(e,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??X(e.name);const n=this.highlighter!=null&&We(this.options.theme??P),i=t||this.highlighter!=null&&pt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults();return{result:Ws(e,t,i,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:r}),options:i}}onHighlightSuccess(e,t,n,i=!0){if(this.renderCache==null)return;const r=!this.renderCache.highlighted||!Fe(this.renderCache.options,n)||!_e(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){const n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!Fe(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&_e(e,n.diff)&&Fe(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const{diffStyle:o,disableFileHeader:s,expandUnchanged:l,expansionLineCount:a,collapsedContextThreshold:d,hunkSeparators:h}=this.getOptionsWithDefaults();this.diff=e;const c=o==="unified";let u=[],f=[],p=[];const m=[],{additionLines:y,deletionLines:v}=n,g={rowCount:0,hunkSeparators:h,additionsContentAST:u,deletionsContentAST:f,unifiedContentAST:p,unifiedGutterAST:we(),deletionsGutterAST:we(),additionsGutterAST:we(),expansionLineCount:a,hunkData:m,incrementRowCount(T=1){g.rowCount+=T},pushToGutter(T,H){switch(T){case"unified":g.unifiedGutterAST.children.push(H);break;case"deletions":g.deletionsGutterAST.children.push(H);break;case"additions":g.additionsGutterAST.children.push(H);break}}},C=or({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),b={size:0,side:void 0,increment(){this.size+=1},flush(){if(o!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(g.pushToGutter("additions",G(void 0,"buffer",this.size)),u?.push(nt(this.size))):(g.pushToGutter("deletions",G(void 0,"buffer",this.size)),f?.push(nt(this.size))),this.size=0,this.side=void 0}}},x=(T,H,N,W,M)=>{g.pushToGutter(T,Ri(H,N,W,M))};function S(T){b.flush(),o==="unified"?Ft("unified",T,g):(Ft("deletions",T,g),Ft("additions",T,g))}this.pushFileLevelAnnotations(e,o,t,g),je({diff:e,diffStyle:o,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:l?!0:this.expandedHunks,collapsedContextThreshold:d,callback:({hunkIndex:T,hunk:H,collapsedBefore:N,collapsedAfter:W,additionLine:M,deletionLine:F,type:O})=>{const Q=F!=null?F.splitLineIndex:M.splitLineIndex,ge=M!=null?M.unifiedLineIndex:F.unifiedLineIndex;o==="split"&&O!=="change"&&b.flush(),N>0&&S({hunkIndex:T,collapsedLines:N,rangeSize:Math.max(H?.collapsedBefore??0,0),hunkSpecs:H?.hunkSpecs,isFirstHunk:T===0,isLastHunk:!1,isExpandable:!e.isPartial});const me=o==="unified"?ge:Q,xe={type:O,hunkIndex:T,lineIndex:me,unifiedLineIndex:ge,splitLineIndex:Q,deletionLine:F,additionLine:M};if(o==="unified"){const D=this.getUnifiedInjectedRowsForLine?.(xe);D?.before!=null&&Gn(D.before,g);let B=F!=null?v[F.lineIndex]:void 0,z=M!=null?y[M.lineIndex]:void 0;if(B==null&&z==null){const te="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(te,{file:e.name}),new Error(te)}const le=O==="change"?M!=null?"change-addition":"change-deletion":O,ee=this.getUnifiedLineDecoration({type:O,lineType:le,additionLineIndex:M?.lineIndex,deletionLineIndex:F?.lineIndex});x("unified",ee.gutterLineType,M!=null?M.lineNumber:F.lineNumber,`${ge},${Q}`,ee.gutterProperties),z!=null?z=at(z,ee.contentProperties):B!=null&&(B=at(B,ee.contentProperties)),st({diffStyle:"unified",type:O,deletionLine:B,additionLine:z,unifiedSpan:this.getAnnotations("unified",F?.lineNumber,M?.lineNumber,T,me),createAnnotationElement:te=>this.createAnnotationElement(te),context:g}),D?.after!=null&&Gn(D.after,g)}else{const D=this.getSplitInjectedRowsForLine?.(xe);D?.before!=null&&jn(D.before,g,b);let B=F!=null?v[F.lineIndex]:void 0,z=M!=null?y[M.lineIndex]:void 0;const le=this.getSplitLineDecoration({side:"deletions",type:O,lineIndex:F?.lineIndex}),ee=this.getSplitLineDecoration({side:"additions",type:O,lineIndex:M?.lineIndex});if(B==null&&z==null){const q="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(q,{file:e.name}),new Error(q)}const te=(()=>{if(O==="change"){if(z==null)return"additions";if(B==null)return"deletions"}})();if(te!=null){if(b.side!=null&&b.side!==te)throw new Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");b.side=te,b.increment()}const De=this.getAnnotations("split",F?.lineNumber,M?.lineNumber,T,me);if(De!=null&&b.size>0&&b.flush(),F!=null){const q=at(B,le.contentProperties);x("deletions",le.gutterLineType,F.lineNumber,`${F.unifiedLineIndex},${Q}`,le.gutterProperties),q!=null&&(B=q)}if(M!=null){const q=at(z,ee.contentProperties);x("additions",ee.gutterLineType,M.lineNumber,`${M.unifiedLineIndex},${Q}`,ee.gutterProperties),q!=null&&(z=q)}st({diffStyle:"split",type:O,additionLine:z,deletionLine:B,...De,createAnnotationElement:q=>this.createAnnotationElement(q),context:g}),D?.after!=null&&jn(D.after,g,b)}const Z=o==="split"&&H!=null&&Q===H.splitLineStart+H.splitLineCount-1,be=Z?H.noEOFCRDeletions:!1,ae=Z?H.noEOFCRAdditions:!1,j=(F?.noEOFCR??!1)||be,Se=(M?.noEOFCR??!1)||ae;if(Se||j){if(o==="split"&&b.flush(),j){const D=O==="context"||O==="context-expanded"?O:"change-deletion";o==="unified"?(g.unifiedContentAST.push(it(D)),g.pushToGutter("unified",G(D,"metadata",1))):(g.deletionsContentAST.push(it(D)),g.pushToGutter("deletions",G(D,"metadata",1)),Se||(g.pushToGutter("additions",G(void 0,"buffer",1)),g.additionsContentAST.push(nt(1))))}if(Se){const D=O==="context"||O==="context-expanded"?O:"change-addition";o==="unified"?(g.unifiedContentAST.push(it(D)),g.pushToGutter("unified",G(D,"metadata",1))):(g.additionsContentAST.push(it(D)),g.pushToGutter("additions",G(D,"metadata",1)),j||(g.pushToGutter("deletions",G(void 0,"buffer",1)),g.deletionsContentAST.push(nt(1))))}g.incrementRowCount(1)}W>0&&h!=="simple"&&S({hunkIndex:O==="context-expanded"?T:T+1,collapsedLines:W,rangeSize:C,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),g.incrementRowCount(1)}}),o==="split"&&b.flush();const k=Math.max(Ps(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,L=!c&&e.type!=="deleted",I=!c&&e.type!=="new",A=g.rowCount>0||w;u=L&&A?u:void 0,f=I&&A?f:void 0,p=c&&A?p:void 0;const E=this.createPreElement(f!=null&&u!=null,k);return{unifiedGutterAST:c&&A?g.unifiedGutterAST.children:void 0,unifiedContentAST:p,deletionsGutterAST:I&&A?g.deletionsGutterAST.children:void 0,deletionsContentAST:f,additionsGutterAST:L&&A?g.additionsGutterAST.children:void 0,additionsContentAST:u,hunkData:m,preNode:E,themeStyles:i,baseThemeType:r,headerElement:s?void 0:this.renderHeader(this.diff),totalLines:k,rowCount:g.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){const n=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,i=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(n==null||i==null)return;const r=we(n);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,Vi(i,t.rowCount)]}renderFullAST(e,t=[]){const n=this.getOptionsWithDefaults().hunkSeparators==="line-info",i=this.renderCodeAST("unified",e);if(i!=null)return t.push(R({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),{...e.preNode,children:t};const r=this.renderCodeAST("deletions",e);r!=null&&t.push(R({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));const o=this.renderCodeAST("additions",e);return o!=null&&t.push(R({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return fe(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?fe(e):fe(R({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,n,i){if(!xt(n))return;const r=e.type!=="new"?Vn(Yt(this.deletionAnnotations)):[],o=e.type!=="deleted"?Vn(Yt(this.additionAnnotations)):[];if(r.length===0&&o.length===0)return;const s=-1,l=-1,{createAnnotationElement:a}=this;if(t==="unified"){st({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r.concat(o)},createAnnotationElement:a,context:i});return}st({diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r},additionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:o},createAnnotationElement:a,context:i})}getAnnotations(e,t,n,i,r){const o={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(t!=null)for(const l of this.deletionAnnotations[t]??[])o.annotations.push(pe(l));const s={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(n!=null)for(const l of this.additionAnnotations[n]??[])(e==="unified"?o:s).annotations.push(pe(l));if(e==="unified")return o.annotations.length>0?o:void 0;if(!(s.annotations.length===0&&o.annotations.length===0))return{deletionSpan:o,additionSpan:s}}renderHeader(e){const{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return zi({fileOrDiff:e,mode:t,stickyHeader:n})}};function Vn(e){return e?.map(t=>pe(t))??[]}const Ys=new Intl.PluralRules("en-US");function Wn(e){return`${e} unmodified line${Ys.select(e)==="one"?"":"s"}`}function Gn(e,t){for(const n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function jn(e,t,n){for(const{deletion:i,addition:r}of e){if(i==null&&r==null)continue;const o=i!=null&&r!=null?void 0:i==null?"deletions":"additions";(o==null||n.side!==o)&&n.flush(),i!=null&&(t.deletionsContentAST.push(i.content),t.pushToGutter("deletions",i.gutter)),r!=null&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),o!=null&&(n.side=o,n.increment()),t.incrementRowCount(1)}}function st({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:r,deletionSpan:o,additionSpan:s,createAnnotationElement:l,context:a}){let d=!1;if(e==="unified"){if(i!=null?a.unifiedContentAST.push(i):n!=null&&a.unifiedContentAST.push(n),r!=null){const h=t==="change"?n!=null?"change-deletion":"change-addition":t;a.unifiedContentAST.push(l(r)),a.pushToGutter("unified",G(h,"annotation",1)),d=!0}}else if(e==="split"){if(n!=null&&a.deletionsContentAST.push(n),i!=null&&a.additionsContentAST.push(i),o!=null){const h=t==="change"?n!=null?"change-deletion":"context":t;a.deletionsContentAST.push(l(o)),a.pushToGutter("deletions",G(h,"annotation",1)),d=!0}if(s!=null){const h=t==="change"?i!=null?"change-addition":"context":t;a.additionsContentAST.push(l(s)),a.pushToGutter("additions",G(h,"annotation",1)),d=!0}}d&&a.incrementRowCount(1)}function Ft(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:r,isFirstHunk:o,isLastHunk:s,isExpandable:l},a){if(n<=0)return;const d=e==="unified"?a.unifiedContentAST:e==="deletions"?a.deletionsContentAST:a.additionsContentAST;if(a.hunkSeparators==="metadata"){r!=null&&(a.pushToGutter(e,Le({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),d.push(Le({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1));return}if(a.hunkSeparators==="simple"){t>0&&(a.pushToGutter(e,Le({type:"simple",isFirstHunk:o,isLastHunk:!1})),d.push(Le({type:"simple",isFirstHunk:o,isLastHunk:!1})),e!=="additions"&&a.incrementRowCount(1));return}const h=Ds(e,t),c=i>a.expansionLineCount,u=l?t:void 0;a.pushToGutter(e,Le({type:a.hunkSeparators,content:Wn(n),expandIndex:u,chunked:c,slotName:h,isFirstHunk:o,isLastHunk:s})),d.push(Le({type:a.hunkSeparators,content:Wn(n),expandIndex:u,chunked:c,slotName:h,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1),a.hunkData.push({slotName:h,hunkIndex:t,lines:n,type:e,expandable:l?{up:!o,down:!s,chunked:c}:void 0})}function at(e,t){return e==null||e.type!=="element"||t==null?e:{...e,properties:{...e.properties,...t}}}function zt(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Xs(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Qs(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 Js(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?"custom":"default"}}let Zs=-1;var dr=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Zs}`;type="file-diff";fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;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;constructor(e={theme:P},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Hi,this.scrollSyncManager=new Ms,this.interactionManager=new Ai("diff",qe(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 Js(e)}createHunksRenderer(e){return new lr(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t="additions")=>{if(this.fileDiff==null)return;const n=this.fileDiff.hunks.at(-1);let i,r;e:for(const o of this.fileDiff.hunks){let s=t==="deletions"?o.deletionStart:o.additionStart;const l=t==="deletions"?o.deletionCount:o.additionCount;let a=o.splitLineStart,d=o.unifiedLineStart;if(e<s){const h=s-e;i=Math.max(d-h,0),r=Math.max(a-h,0);break e}if(e>=s+l){if(o===n){const h=e-(s+l);i=d+o.unifiedLineCount+h,r=a+o.splitLineCount+h;break e}continue}for(const h of o.hunkContent)if(h.type==="context")if(e<s+h.lines){const c=e-s;r=a+c,i=d+c;break e}else s+=h.lines,a+=h.lines,d+=h.lines;else{const c=t==="deletions"?h.deletions:h.additions;if(e<s+c){const u=e-s;i=d+(t==="additions"?h.deletions:0)+u,r=a+u;break e}else s+=c,a+=Math.max(h.deletions,h.additions),d+=h.deletions+h.additions}break e}if(!(i==null||r==null))return[i,r]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(qe(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;const t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Me(this.appliedThemeCSS.theme,this.options.theme??P)}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}const{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=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=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}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,lineAnnotations:r,oldFile:o,newFile:s,fileDiff:l}=e;this.hydrateElements(t,n),na(this.pre,ea({fileDiff:l,oldFile:o,newFile:s}),this.options.collapsed)||ia(this.headerElement,ta({fileDiff:l,oldFile:o,newFile:s}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:l,oldFile:o,newFile:s,lineAnnotations:r}),i||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ji(e,t);for(const n of e.shadowRoot?.children??[]){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n;for(const i of n.children)!(i instanceof HTMLElement)||i.tagName.toLowerCase()!=="code"||("deletions"in i.dataset&&(this.codeDeletions=i),"additions"in i.dataset&&(this.codeAdditions=i),"unified"in i.dataset&&(this.codeUnified=i));continue}if("diffsHeader"in n.dataset){this.headerElement=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-theme-css")){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.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:i}){this.lineAnnotations=i??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?Zt(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:i=!1,forceRender:r=!1,preventEmit:o=!1,lineAnnotations:s,fileContainer:l,containerWrapper:a,renderRange:d}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");const{collapsed:h=!1,themeType:c="system"}=this.options,u=h?void 0:d,f=this.hasThemeChanged(),p=e!=null&&t!=null&&(!se(e,this.deletionFile)||!se(t,this.additionFile));let m=n!=null&&n!==this.fileDiff;const y=s!=null&&(s.length>0||this.lineAnnotations.length>0)?s!==this.lineAnnotations:!1;if(!h&&yt(u,this.renderRange)&&!r&&!y&&!f&&(n!=null&&n===this.fileDiff||n==null&&!p))return this.applyCachedThemeState(c);const{renderRange:v}=this;if(this.renderRange=u,this.deletionFile=e,this.additionFile=t,n!=null?this.fileDiff=n:e!=null&&t!=null&&p&&(m=!0,this.fileDiff=Zt(e,t,this.options.parseDiffOptions)),m&&(this.cachedHeaderHTML=void 0),s!=null&&this.setLineAnnotations(s),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:g=!1,disableFileHeader:C=!1}=this.options;if(C&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),l=this.getOrCreateFileContainer(l,a),this.applyCachedThemeState(c),h){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const b=this.hunksRenderer.renderDiff(this.fileDiff,Ei);b!=null&&this.applyThemeState(l,b.themeStyles,c,b.baseThemeType),b?.headerElement!=null&&this.applyHeaderToDOM(b.headerElement,l),this.renderSeparators([]),this.injectUnsafeCSS()}catch(b){if(g)throw b;console.error(b),b instanceof Error&&this.applyErrorToDOM(b,l)}return o||this.emitPostRender(),!0}try{const b=this.getOrCreatePreNode(l);if(!(this.canPartiallyRender(r,y,p||m||f)&&this.applyPartialRender({previousRenderRange:v,renderRange:u}))){const x=this.hunksRenderer.renderDiff(this.fileDiff,u);if(x==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(l,x.themeStyles,c,x.baseThemeType),x.headerElement!=null&&this.applyHeaderToDOM(x.headerElement,l),x.additionsContentAST!=null||x.deletionsContentAST!=null||x.unifiedContentAST!=null?this.applyHunksToDOM(b,x):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(x.hunkData)}this.applyBuffers(b,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,i||this.flushManagers()}catch(b){if(g)throw b;console.error(b),b instanceof Error&&this.applyErrorToDOM(b,l)}return o||this.emitPostRender(),!0}emitPostRender(e=!1){const{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;const i=this.mounted?"update":"mount";this.mounted=!0,n?.(t,this,i)}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(const{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(const{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){const t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){const{fileDiff:e,workerManager:t}=this;if(e==null||t==null||en(e))return;const 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.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.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){const{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!="function"){for(const{element:i}of this.separatorCache.values())i.remove();this.separatorCache.clear();return}const n=new Map(this.separatorCache);for(const i of e){const r=i.slotName;let o=this.separatorCache.get(r);if(o==null||!Qs(i,o.hunkData)){o?.element.remove();const s=document.createElement("div");s.style.display="contents",s.slot=i.slotName;const l=t(i,this);l!=null&&s.appendChild(l),this.fileContainer.appendChild(s),o={element:s,hunkData:i},this.separatorCache.set(r,o)}n.delete(r)}for(const[i,{element:r}]of n.entries())this.separatorCache.delete(i),r.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const r=`${n}-${pe(i)}`;let o=this.annotationCache.get(r);if(o==null||!Xs(i,o.annotation)){o?.element.remove();const s=t(i);if(s==null)continue;o={element:un(pe(i)),annotation:i},o.element.appendChild(s),this.fileContainer.appendChild(o.element),this.annotationCache.set(r,o)}e.delete(r)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){const{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const n=qi();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){const{fileContainer:n}=this,i=e??n??document.createElement("diffs-container"),r=n!==i;return r&&this.emitPostRender(!0),this.fileContainer=i,n!=null&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){const{shadowRoot:t}=e;if(t!=null)for(const n of t.children)n instanceof SVGElement?this.spriteSVG??=n:Ke(n)&&n.hasAttribute("data-theme-css")?(this.themeCSSStyle??=n,this.hasAdoptedThemeCSS=!0):Ke(n)&&n.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=n,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){const n=document.createElement("div");n.innerHTML=Gi;const i=n.firstChild;i instanceof SVGElement&&(this.spriteSVG=i)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){const 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(const 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;const{fileDiff:n}=this,i=this.cachedHeaderHTML??fe(e);if(this.cachedHeaderHTML=i,i!==this.lastRenderedHeaderHTML){const d=document.createElement("div");d.innerHTML=i;const h=d.firstElementChild;if(!(h instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(h,this.headerElement):t.shadowRoot?.prepend(h),this.headerElement=h,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged||n==null)return;const{renderCustomHeader:r,renderHeaderPrefix:o,renderHeaderMetadata:s}=this.options;if(r!=null){const d=r(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,sn,d),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}const l=o?.(n)??void 0,a=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,rn,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,on,a),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(i==null){t?.remove();return}const r=t??this.createHeaderSlotElement(n);return t==null&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){const{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??=Ki(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=pn(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,i){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,s=this.options.theme??P,l=typeof s=="string"?s:{...s},a=He(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a};return}this.themeCSSStyle=bn({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:gn(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){const e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=Qi(this.themeCSSStyle.textContent??"",He(e)))}applyHunksToDOM(e,t){const{overflow:n="scroll"}=this.options,i=(this.options.hunkSeparators??"line-info")==="line-info",r=n==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1;const s=[],l=this.hunksRenderer.renderCodeAST("unified",t),a=this.hunksRenderer.renderCodeAST("deletions",t),d=this.hunksRenderer.renderCodeAST("additions",t);l!=null?(o=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=Ge({code:this.codeUnified,columnType:"unified",rowSpan:r,containerSize:i}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(l),s.push(this.codeUnified)):a!=null||d!=null?(a!=null?(o=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ge({code:this.codeDeletions,columnType:"deletions",rowSpan:r,containerSize:i}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(a),s.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),d!=null?(o=o||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ge({code:this.codeAdditions,columnType:"additions",rowSpan:r,containerSize:i}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(d),s.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),s.length===0?e.textContent="":o&&e.replaceChildren(...s),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){const{pre:n,codeUnified:i,codeAdditions:r,codeDeletions:o,options:{diffStyle:s="split"}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;const l=this.getCodeColumns(s,i,o,r);if(l==null)return!1;const a=e.startingLine,d=t.startingLine,h=a+e.totalLines,c=d+t.totalLines,u=Math.max(a,d),f=Math.min(h,c);if(f<=u)return!1;const p=Math.max(0,u-a),m=Math.max(0,h-f),y=this.trimColumns({columns:l,trimStart:p,trimEnd:m,previousStart:a,overlapStart:u,overlapEnd:f,diffStyle:s});if(y<0)throw new Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<y)throw new Error("applyPartialRender: trimmed beyond DOM row count");let v=this.lastRowCount-y;const g=(S,k)=>{if(!(k<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:S,totalLines:k,bufferBefore:0,bufferAfter:0})},C=g(d,Math.max(u-d,0));if(C==null&&d<u)return!1;const b=g(f,Math.max(c-f,0));if(b==null&&c>f)return!1;const x=(S,k)=>{if(S!=null){if(s==="unified"&&!Array.isArray(l))this.insertPartialHTML(s,l,S,k);else if(s==="split"&&Array.isArray(l))this.insertPartialHTML(s,l,S,k);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");v+=S.rowCount}};return this.cleanupErrorWrapper(),x(C,"afterbegin"),x(b,"beforeend"),this.lastRowCount!==v&&(this.applyRowSpan(s,l,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,i){if(e==="unified"&&!Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,r,i)}else if(e==="split"&&Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("deletions",n),o=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],r,i),this.renderPartialColumn(t[1],o,i)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}renderPartialColumn(e,t,n){if(e==null||t==null)return;const i=qn(t[0]),r=qn(t[1]);if(i==null||r==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const o=r.at(0);n==="beforeend"&&o?.type==="element"&&typeof o.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],i,r,!0);const s=r.at(-1);n==="afterbegin"&&s?.type==="element"&&typeof s.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],i,r,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,n,i,r,o){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;const s=this.getBufferSize(t.dataset);s!=null&&(o?(i.shift(),r.shift()):(i.pop(),r.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(n,s+e))}applyRowSpan(e,t,n){const i=r=>{r!=null&&(r.gutter.style.setProperty("grid-row",`span ${n}`),r.content.style.setProperty("grid-row",`span ${n}`))};if(e==="unified"&&!Array.isArray(t))i(t);else if(e==="split"&&Array.isArray(t))i(t[0]),i(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,n){let i=0,r=0,o=0,s=!1;const l=n>=0;if(e==null)return 0;const a=Array.from(e.content.children),d=Array.from(e.gutter.children);if(a.length!==d.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;o<a.length&&!(t<=0&&!l&&!s);){const h=d[o],c=a[o];if(o++,!(h instanceof HTMLElement)||!(c instanceof HTMLElement))throw console.error({gutterElement:h,contentElement:c}),new Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,h.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset||h.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset)){h.remove(),c.remove(),r++;continue}if("lineIndex"in h.dataset&&"lineIndex"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),t>0&&(t--,t===0&&(s=!0)),r++),i++;continue}if("separator"in h.dataset&&"separator"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),r++);continue}if(h.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),r++);continue}if(h.dataset.gutterBuffer==="metadata"&&"noNewline"in c.dataset){(t>0||l&&i>=n)&&(h.remove(),c.remove(),r++);continue}if(h.dataset.gutterBuffer==="buffer"&&"contentBuffer"in c.dataset){const u=this.getBufferSize(c.dataset);if(u==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){const f=Math.min(t,u),p=u-f;p>0?(this.updateBufferSize(h,p),this.updateBufferSize(c,p),r+=f):(h.remove(),c.remove(),r+=u),t-=f,t===0&&p===0&&(s=!0)}else if(l){const f=i,p=i+u-1;if(n<=f)h.remove(),c.remove(),r+=u;else if(n<=p){const m=p-n+1,y=u-m;this.updateBufferSize(h,y),this.updateBufferSize(c,y),r+=m}}i+=u;continue}throw console.error({gutterElement:h,contentElement:c}),new Error("FileDiff.trimColumnRows: unknown row elements")}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:i,previousStart:r,trimEnd:o,trimStart:s}){const l=Math.max(0,i-r),a=n-r;if(a<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const d=s>0,h=o>0;if(!d&&!h)return 0;const c=d?l:0,u=h?a:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,c,u);if(t==="split"&&Array.isArray(e)){const f=this.trimColumnRows(e[0],c,u),p=this.trimColumnRows(e[1],c,u);if(e[0]!=null&&e[1]!=null&&f!==p)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?f:p}else throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){const 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,i){function r(o){if(o==null)return;const s=o.children[0],l=o.children[1];if(!(!(s instanceof HTMLElement)||!(l instanceof HTMLElement)||s.dataset.gutter==null||l.dataset.content==null))return{gutter:s,content:l}}if(e==="unified")return r(t);{const o=r(n),s=r(i);return o!=null||s!=null?[o,s]:void 0}}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==null&&(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==null&&(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:i},r){const{diffIndicators:o="bars",disableBackground:s=!1,disableLineNumbers:l=!1,overflow:a="scroll",diffStyle:d="split"}=this.options,h={type:"diff",diffIndicators:o,disableBackground:s,disableLineNumbers:l,overflow:a,split:d==="unified"?!1:t!=null&&n!=null,totalLines:i,customProperties:r};ji(h,this.appliedPreAttributes)||(mn(e,h),this.appliedPreAttributes=h)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const n=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);const i=document.createElement("div");i.dataset.errorMessage="",i.innerText=e.message,this.errorWrapper.appendChild(i);const r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function ea({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function ta({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function na(e,t,n=!1){return!n&&e==null&&t}function ia(e,t,n=!1){return e==null&&t&&!n}function qn(e){if(!(e==null||e.type!=="element"))return e.children??[]}function ra({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:i,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:s}){let l=oe(t,n),a=l;const d=r?!0:o,h=e.hunks.length-1;for(let c=0;c<e.hunks.length;c++){const u=e.hunks[c];if(u==null)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const f=Ye({isPartial:e.isPartial,rangeSize:u.collapsedBefore,expandedHunks:d,hunkIndex:c,collapsedContextThreshold:s}),p=(f.fromStart+f.fromEnd)*t.lineHeight;if(l+=p,a+=p,f.collapsedLines>0){const v=$e({type:i,metrics:t,hunkIndex:c,hunkSpecs:u.hunkSpecs})?.totalHeight??0;l+=v,a+=v}l+=u.splitLineCount*t.lineHeight,a+=u.unifiedLineCount*t.lineHeight;const m=oa(u);l+=m.split*t.lineHeight,a+=m.unified*t.lineHeight;const y=c===h?Xe({fileDiff:e,hunkIndex:c,expandedHunks:d,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(y!=null){const v=(y.fromStart+y.fromEnd)*t.lineHeight;if(l+=v,a+=v,y.collapsedLines>0){const g=Ve({type:i,metrics:t})?.totalHeight??0;l+=g,a+=g}}}if(e.hunks.length>0){const c=Ct(t);l+=c,a+=c}return{splitHeight:l,unifiedHeight:a}}function oa(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};const t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type==="context"){const n=t.lines>0?1:0;return{split:n,unified:n}}return sa(e,t)}function sa(e,t){const n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),i=t.deletions>0&&e.noEOFCRDeletions,r=t.additions>0&&e.noEOFCRAdditions;return{split:i||r?1:0,unified:n}}const tn=5e3;let aa=-1;var la=class extends dr{__id=`little-virtualized-file-diff:${++aa}`;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,i,r=!1){super(e,i,r),this.virtualizer=t,this.metrics=Dt(n)}setMetrics(e,t=!1){const n=Dt(e);!t&&Ae(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){const t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!Kt(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber!==0?!1:e.type==="new"?t.side==="additions":e.type==="deleted"?t.side==="deletions":!0)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){const t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(e==null)return;const{options:t}=this,n=!ln(t,e),i=n&&pa(t,e);super.setOptions(e),i&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:ga(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new 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;const{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;const n=this.getDiffStyle(),i=n==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],r=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&r&&xt(this.renderRange)){const o=da(i)??0;this.setFileAnnotationHeight(o)&&(e=!0)}else!r&&this.setFileAnnotationHeight(0)&&(e=!0);for(const o of i){if(o==null)continue;const s=o.children[1];if(s instanceof HTMLElement)for(const l of s.children){if(!(l instanceof HTMLElement))continue;const a=l.dataset.lineIndex;if(a==null)continue;const d=ba(a,n);let h=l.getBoundingClientRect().height,c=!1;l.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in l.nextElementSibling.dataset||"noNewline"in l.nextElementSibling.dataset)&&("noNewline"in l.nextElementSibling.dataset&&(c=!0),h+=l.nextElementSibling.getBoundingClientRect().height);const u=this.getEstimatedLineHeight(c),f=this.cache.heightDeltas.get(d)??0,p=h-u;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(d):this.cache.heightDeltas.set(d,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());prepareCodeViewItem(e,t,n,i){const r=!_e(this.fileDiff,e),o=this.syncLineAnnotations(i);let s=n?.resetDiffLayoutCache===!0||r||o,l=r||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=Dt(n.metrics),s=!0,l=!0);const{collapsed:a=!1}=this.options;return this.currentCollapsed!==a&&(this.currentCollapsed=a,s=!0),s&&this.resetLayoutCache({includeEstimatedHeights:l}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t="additions"){if(this.fileDiff==null||e<1)return;const n=this.getLineIndex(e,t);if(n==null)return;const{disableFileHeader:i=!1,expandUnchanged:r=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,l=this.getDiffStyle(),a=this.getHunkSeparatorType(),d=l==="split"?n[1]:n[0];this.approximateLayoutCheckpoints();const h=oe(this.metrics,i),c=this.getLayoutCheckpointBeforeLineIndex(d);let u=c?.top??h+this.cache.fileAnnotationHeight;if(o)return{top:h,height:0};let f;return je({diff:this.fileDiff,diffStyle:l,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:p,hunk:m,collapsedBefore:y,collapsedAfter:v,deletionLine:g,additionLine:C})=>{const b=l==="split"?C?.splitLineIndex??g?.splitLineIndex:C?.unifiedLineIndex??g?.unifiedLineIndex;if(b==null)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(y>0){const S=$e({type:a,metrics:this.metrics,hunkIndex:p,hunkSpecs:m?.hunkSpecs});if(S!=null){if(u+=S.gapBefore,d>=b-y&&d<b)return f={top:u,height:S.height},!0;u+=S.height+S.gapAfter}}const x=this.getLineHeight(b,(C?.noEOFCR??!1)||(g?.noEOFCR??!1));if(b===d)return f={top:u,height:x},!0;if(u+=x,v>0){const S=Ve({type:a,metrics:this.metrics});if(S!=null){if(d>b&&d<=b+v)return f={top:u+S.gapBefore,height:S.height},!0;u+=S.totalHeight}}return!1}}),f}getNumericScrollAnchor(e){if(this.fileDiff==null)return;const{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:i=!1,collapsedContextThreshold:r=1}=this.options;if(i)return;const o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();const l=this.getLayoutCheckpointBeforeTop(e);let a=l?.top??oe(this.metrics,t)+this.cache.fileAnnotationHeight,d;return je({diff:this.fileDiff,diffStyle:o,startingLine:l?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({hunkIndex:h,hunk:c,collapsedBefore:u,collapsedAfter:f,deletionLine:p,additionLine:m})=>{const y=o==="split"?m?.splitLineIndex??p?.splitLineIndex:m?.unifiedLineIndex??p?.unifiedLineIndex;if(y==null)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(u>0){const g=$e({type:s,metrics:this.metrics,hunkIndex:h,hunkSpecs:c?.hunkSpecs});g!=null&&(a+=g.totalHeight)}if(a>=e&&(p!=null?d={lineNumber:p.lineNumber,side:"deletions",top:a}:m!=null&&(d={lineNumber:m.lineNumber,side:"additions",top:a}),d!=null))return!0;const v=this.getLineHeight(y,(m?.noEOFCR??!1)||(p?.noEOFCR??!1));if(a+=v,f>0){const g=Ve({type:s,metrics:this.metrics});g!=null&&(a+=g.totalHeight)}return!1}}),d}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};const t=e!=null?this.computeRenderRangeFromWindow(this.fileDiff,this.top,e):this.renderRange;if(t==null)return;const{bufferBefore:n,bufferAfter:i,totalLines:r}=t;let o=0;if(r===0){const s=e??this.virtualizer.getWindowSpecs();this.top<s.top&&(o=i)}return{topOffset:this.top+n+o,height:this.height-(n+i)}}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))}computeApproximateSize(e=!1){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,this.fileDiff==null){this.layoutDirty=!1;return}const{disableFileHeader:i=!1,collapsed:r=!1}=this.options,o=oe(this.metrics,i);if(this.height+=o,r){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight(),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();const e=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(e==null)throw new 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;const{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:i,unifiedHeight:r}=ra({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=r}validateComputedHeight(){if(this.fileContainer==null||this.fileDiff==null)return;const e=this.fileContainer.getBoundingClientRect();e.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:i,forceRender:r=!1,lineAnnotations:o,...s}={}){const{forceRenderOverride:l,isSetup:a}=this;this.forceRenderOverride=void 0;const d=this.syncLineAnnotations(o);if(d&&this.resetLayoutCache({includeEstimatedHeights:!1}),this.fileDiff??=i??(t!=null&&n!=null?Zt(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(a)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();const f=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(f==null)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");f.connect(e,this),this.isVisible=f.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);const h=this.virtualizer.getWindowSpecs(),c=this.top??0,u=this.computeRenderRangeFromWindow(this.fileDiff,c,h);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:u,oldFile:t,newFile:n,lineAnnotations:o,forceRender:(l??r)||d,...s})}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?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}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 ma(this.options.hunkSeparators)}approximateLayoutCheckpoints(){if(this.cache.checkpoints.length>0||this.fileDiff==null||this.fileDiff.hunks.length===0||this.options.collapsed===!0)return;const{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,i=this.fileDiff.hunks.length-1,r=this.getDiffStyle(),o=this.getHunkSeparatorType(),s=t?!0:this.hunksRenderer.getExpandedHunksMap(),l=ha(this.cache.heightDeltas);let a=oe(this.metrics,e)+this.cache.fileAnnotationHeight,d=0;const h=({rowCount:c,startLineIndex:u,preSeparatorHeight:f=0,postSeparatorHeight:p=0,metadataOffsets:m=[]})=>{if(c<=0)return;const y=d,v=d+c;let g=ca(y);for(;g<v;){const C=g-y,b=a+(C>0?f:0)+C*this.metrics.lineHeight+ua(m,C)*this.metrics.lineHeight+Kn(l,u,u+C);this.cache.checkpoints.push({renderedLineIndex:g,lineIndex:u+C,top:b}),g+=tn}a+=f+c*this.metrics.lineHeight+m.length*this.metrics.lineHeight+Kn(l,u,u+c)+p,d=v};for(let c=0;c<this.fileDiff.hunks.length;c++){const u=this.fileDiff.hunks[c];if(u==null)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const f=Ye({isPartial:this.fileDiff.isPartial,rangeSize:u.collapsedBefore,expandedHunks:s,hunkIndex:c,collapsedContextThreshold:n}),p=f.collapsedLines>0?$e({type:o,metrics:this.metrics,hunkIndex:c,hunkSpecs:u.hunkSpecs})?.totalHeight??0:0;h({rowCount:f.fromStart,startLineIndex:(r==="split"?u.splitLineStart:u.unifiedLineStart)-f.rangeSize});let m=p;h({rowCount:f.fromEnd,startLineIndex:(r==="split"?u.splitLineStart:u.unifiedLineStart)-f.fromEnd,preSeparatorHeight:m}),f.fromEnd>0&&(m=0);const y=c===i?Xe({fileDiff:this.fileDiff,hunkIndex:c,expandedHunks:s,collapsedContextThreshold:n,errorPrefix:"VirtualizedFileDiff"}):void 0,v=y!=null&&y.collapsedLines>0?Ve({type:o,metrics:this.metrics})?.totalHeight??0:0,g=y!=null?y.fromStart+y.fromEnd:0,C=r==="split"?u.splitLineCount:u.unifiedLineCount,b=r==="split"?u.splitLineStart:u.unifiedLineStart;h({rowCount:C,startLineIndex:b,preSeparatorHeight:m,postSeparatorHeight:g===0?v:0,metadataOffsets:fa({diffStyle:r,hunk:u,rowCount:C})}),y!=null&&g>0&&h({rowCount:g,startLineIndex:b+C,postSeparatorHeight:v})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,i;for(;t<=n;){const r=t+n>>1,o=this.cache.checkpoints[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");o.lineIndex<=e?(i=o,t=r+1):n=r-1}return i}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");s.top<=e?(r=o,n=o+1):i=o-1}if(t==null)return r>=0?this.cache.checkpoints[r]:void 0;for(let o=r;o>=0;o--){const s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(s.renderedLineIndex%t===0)return s}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(const l of e.hunks)n+=t==="split"?l.splitLineCount:l.unifiedLineCount;return n}const{expandUnchanged:i=!1,collapsedContextThreshold:r=1}=this.options,o=i?!0:this.hunksRenderer.getExpandedHunksMap();for(const[l,a]of e.hunks.entries()){const d=t==="split"?a.splitLineCount:a.unifiedLineCount;n+=d;const h=Math.max(a.collapsedBefore,0),{fromStart:c,fromEnd:u,renderAll:f}=Ye({isPartial:e.isPartial,rangeSize:h,expandedHunks:o,hunkIndex:l,collapsedContextThreshold:r});h>0&&(n+=f?h:c+u)}const s=Xe({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:o,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"});return s!=null&&(n+=s.fromStart+s.fromEnd),n}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){const{disableFileHeader:r=!1,expandUnchanged:o=!1,collapsedContextThreshold:s=1}=this.options,{hunkLineCount:l,lineHeight:a}=this.metrics,d=this.getDiffStyle(),h=this.getHunkSeparatorType(),c=this.height;let u=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,d);const f=oe(this.metrics,r),p=e.hunks.length>0?Ct(this.metrics):0,{fileAnnotationHeight:m}=this.cache,y=f+m,v=Math.max(0,c-f-m-p),g=this.hasFileAnnotations(e),C=t+f,b=m>0&&g&&C<i&&C+m>n;if(t<n-c||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-f-p};if(u<=l||e.hunks.length===0)return{startingLine:0,totalLines:l,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),u=this.cache.totalLines>0?this.cache.totalLines:u;const x=Math.ceil(Math.max(i-n,0)/a),S=Math.ceil(x/l)*l+l,k=S/l,w=k,L=[],I=(n+i)/2,A=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*a*2),l);let E=t+(A?.top??y),T=A?.renderedLineIndex??0,H,N,W;if(je({diff:e,diffStyle:d,startingLine:A?.renderedLineIndex??0,expandedHunks:o?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:ae,hunk:j,collapsedBefore:Se,collapsedAfter:D,deletionLine:B,additionLine:z})=>{const le=z!=null?z.splitLineIndex:B.splitLineIndex,ee=z!=null?z.unifiedLineIndex:B.unifiedLineIndex,te=(z?.noEOFCR??!1)||(B?.noEOFCR??!1),De=(Se>0?$e({type:h,metrics:this.metrics,hunkIndex:ae,hunkSpecs:j?.hunkSpecs}):void 0)?.totalHeight??0;E+=De;const q=T%l===0,Lt=Math.floor(T/l);if(q&&(L[Lt]=E-(t+y+De),W!=null)){if(W<=0)return!0;W--}const kt=this.getLineHeight(d==="split"?le:ee,te);return E>n-kt&&E<i&&(H??=Lt),N==null&&E+kt>I&&(N=Lt),W==null&&E>=i&&q&&(W=w),T++,E+=kt,D>0&&(E+=Ve({type:h,metrics:this.metrics})?.totalHeight??0),!1}}),H==null)if(b)H=0,N=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-f-p};N??=H;const M=Math.round(N-k/2),F=Math.max(0,Math.ceil(u/l)-k),O=Math.max(0,Math.min(M,F)),Q=O*l,ge=M<0?S+M*l:S,me=L[O]??0,xe=Q===0?0:m+me,Z=O+ge/l,be=Z<L.length?v-L[Z]:v-(E-t-y);return{startingLine:Q,totalLines:ge,bufferBefore:xe,bufferAfter:Math.max(0,be)}}};function da(e){let t;for(const n of e){if(n==null)continue;const i=n.children[1];if(i instanceof HTMLElement)for(const r of i.children)r instanceof HTMLElement&&r.dataset.lineAnnotation===$i&&(t=Math.max(t??0,r.getBoundingClientRect().height))}return t}function ha(e){const t=Array.from(e).sort((o,s)=>o[0]-s[0]),n=[],i=[0];let r=0;for(const[o,s]of t)n.push(o),r+=s,i.push(r);return{lineIndexes:n,prefixTotals:i}}function Kn({lineIndexes:e,prefixTotals:t},n,i){if(n>=i||e.length===0)return 0;const r=Yn(e,n);return(t[Yn(e,i)]??0)-(t[r]??0)}function Yn(e,t){let n=0,i=e.length;for(;n<i;){const r=n+i>>1,o=e[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid prefix index");o<t?n=r+1:i=r}return n}function ca(e){return Math.ceil(e/tn)*tn}function ua(e,t){let n=0;for(const i of e)i<t&&n++;return n}function fa({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];const i=t.hunkContent.at(-1);if(i==null)return[];if(i.type==="context")return[n-1];const r=Math.max(i.deletions,i.additions),o=i.deletions+i.additions;if(e==="split")return r>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];const s=[],l=n-o;return i.deletions>0&&t.noEOFCRDeletions&&s.push(l+i.deletions-1),i.additions>0&&t.noEOFCRAdditions&&s.push(n-1),s}function pa(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 ga(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 ma(e){return typeof e=="function"?"custom":e??"line-info"}function ba(e,t){const[n,i]=e.split(",").map(Number);return t==="split"?i:n}function ie(e){const t=window.devicePixelRatio??1;return Math.round(e*t)/t}const va=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","diffStyle","diffIndicators","disableBackground","expandUnchanged","collapsedContextThreshold","lineDiffType","maxLineDiffLength","expansionLineCount","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],Ca=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],Xn=["renderCustomHeader","renderHeaderPrefix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","onPostRender","onGutterUtilityClick","onLineClick","onLineNumberClick","onLineEnter","onLineLeave","onTokenClick","onTokenEnter","onTokenLeave"],Qn=["onLineSelected","onLineSelectionStart","onLineSelectionChange","onLineSelectionEnd"],hr=Symbol("CodeView.itemOptionsState");function Jn(e,t){Object.defineProperty(e,hr,{configurable:!1,enumerable:!1,value:t})}function ze(e){return e[hr]}function he(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}const Sa=120,Zn="--diffs-overflow-override",vn=12e6,cr=1e6,ur=2e6,ya=vn-ur,ei=vn-cr,xa=(()=>{const{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),i=e.platform==="MacIntel"&&e.maxTouchPoints>1;return(n||i)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})();var wl=class ue{static __STOP=!1;static __lastScrollPosition=0;type="advanced";config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;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=Pe;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement("div");stickyContainer=document.createElement("div");stickyOffset=document.createElement("div");elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isContainerManaged;constructor(t={theme:P},n,i=!1){this.options=t,this.computeMetricsCache(t.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=n,this.isContainerManaged=i,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??ro}computeMetricsCache(t){return this.itemMetricsCache={hunkLineCount:t?.hunkLineCount??Pe.hunkLineCount,lineHeight:t?.lineHeight??Pe.lineHeight,diffHeaderHeight:t?.diffHeaderHeight??Pe.diffHeaderHeight,hunkSeparatorHeight:t?.hunkSeparatorHeight,spacing:t?.spacing??Pe.spacing,paddingTop:t?.paddingTop,paddingBottom:t?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??oo}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return qr&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(t){if(!this.shouldValidateItemHeights()||t.element==null)return;const n=t.instance.getAdvancedStickySpecs();if(n==null)return;const i=n.height,r=t.element.getBoundingClientRect().height;i!==r&&console.error("CodeView: reconciled item height does not match DOM height",{id:t.item.id,type:t.type,index:t.index,version:t.version,expectedHeight:i,actualHeight:r,delta:r-i,stickyTopOffset:n.topOffset,virtualizedHeight:t.instance.getVirtualizedHeight(),top:t.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:t.element,instance:t.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;const{firstIndex:t,lastIndex:n,stickyHeight:i,stickyTop:r,stickyBottom:o}=this.renderState;if(t===-1||n===-1)return;const s=this.stickyContainer.getBoundingClientRect().height;Math.abs(s-i)<1||console.error("CodeView: sticky container height does not match computed layout",{computedStickyHeight:i,actualStickyHeight:s,delta:s-i,stickyTop:r,stickyBottom:o,firstIndex:t,lastIndex:n,firstStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[n]?.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),xa&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Zn,"hidden"),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Sa)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&(this.stickyContainer.style.removeProperty("pointer-events"),this.pointerEventsDisabled=!1),this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Zn,"auto"),this.codeOverflowFix=!1)};syncLayout(){const{gap:t,paddingBottom:n,paddingTop:i}=this.getLayout();this.stickyContainer.style.gap=`${t}px`,this.container?.style.setProperty("margin-top",`${i}px`),this.container?.style.setProperty("margin-bottom",`${n}px`)}setup(t){if(this.root!=null)throw new 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=()=>{ue.__STOP?(ue.__STOP=!1,this.scrollTo({type:"position",position:ue.__lastScrollPosition,behavior:"instant"})):(ue.__lastScrollPosition=this.getScrollTop(),ue.__STOP=!0)}}reset(){this.restoreScrollInteractions(),this.cleanAllRenderedItems(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),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()}cleanUp(){this.reset(),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.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let t=this.renderState.firstIndex;t<=this.renderState.lastIndex;t++){const n=this.items[t];if(n==null)throw new Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${t}`);this.releaseRenderedItem(n)}}primeScrollTarget(t){if(t.type==="position")return;const n=this.idToItem.get(t.id);n?.instance.primeHighlightCache()}getElementPoolLimit(){const t=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:n}=this.itemMetricsCache;return Math.max(8,Math.ceil(t/Math.max(n,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let t=this.elementPool.pop();for(;t!=null&&!this.isElementPoolGenerationCurrent(t);)t=this.elementPool.pop();return t??=document.createElement(xi),this.markElementPoolGenerationCurrent(t),t}releaseRenderedItem(t){const{element:n}=t;n!=null&&this.renderedItemOwnsFocus(n)&&(this.shouldFixContainerFocus=!0),t.instance.cleanUp(!0),t.element=void 0,n!=null&&(n.remove(),this.cleanElement(n),this.queueElementForPool(n))}renderedItemOwnsFocus(t){const{activeElement:n}=document;return n===t||t.contains(n)||t.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(t){const{shadowRoot:n}=t;if(n!=null)for(const i of Array.from(n.children))Ea(i)||i.remove();this.isContainerManaged||t.replaceChildren()}queueElementForPool(t){const n=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(t)||this.getElementPoolSize()>=n||(this.isElementClean(t)?this.elementPool.push(t):this.pendingElementPool.push(t))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;const{pendingElementPool:t}=this;this.pendingElementPool=[];const n=this.getElementPoolLimit();for(const i of t)this.isElementPoolGenerationCurrent(i)&&this.isElementClean(i)&&this.elementPool.length<n?this.elementPool.push(i):this.isElementPoolGenerationCurrent(i)&&this.getElementPoolSize()<n&&this.pendingElementPool.push(i)}isElementClean(t){return t.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(t){this.elementPoolTracker.set(t,this.elementPoolVersion)}isElementPoolGenerationCurrent(t){return this.elementPoolTracker.get(t)===this.elementPoolVersion}resolveEffectiveScrollBehavior(t,n){return lo()?"instant":t.behavior!=="smooth-auto"?t.behavior??"instant":Math.abs(n-this.getScrollTop())<=this.getHeight()*10?"smooth":"instant"}scrollTo(t){if(this.root==null)return;const n=this.normalizeScrollTarget(t);if(n==null)return;const i=this.resolveScrollTargetTop(n);i!=null&&(this.primeScrollTarget(n),this.resolveEffectiveScrollBehavior(n,i)==="smooth"?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=n,this.render())}setSelectedLines(t,n){this.applySelectedLines(t,n)}getSelectedLines(){return this.selectedLines}clearSelectedLines(t){this.applySelectedLines(null,t)}getItem(t){return this.idToItem.get(t)?.item}updateItem(t){const n=this.idToItem.get(t.id);return n==null?(console.error(`CodeView.updateItem: unknown item id "${t.id}"`),!1):this.syncItemRecord(n,t)?(this.markItemLayoutDirty(n),this.scrollDirty=!0,this.render(),this.syncSelection(),!0):!1}updateItemId(t,n){if(t===n)return!0;const i=this.idToItem.get(t);return i==null?(console.error(`CodeView.updateItemId: unknown item id "${t}"`),!1):this.idToItem.has(n)?(console.error(`CodeView.updateItemId: duplicate item id "${n}"`),!1):(this.idToItem.delete(t),i.item.id=n,this.idToItem.set(n,i),this.updateItemOptionsId(i.instance.options,n),this.selectedLines?.id===t&&(this.selectedLines={...this.selectedLines,id:n},this.options.onSelectedLinesChange?.(this.selectedLines)),this.renamePendingScrollTarget(t,n),this.renamePendingLayoutAnchor(t,n),this.render(),!0)}addItem(t){this.addItems([t]),this.syncSelection()}addItems(t){this.appendItemsInternal(t),this.syncSelection()}setItems(t){t.length===0?this.reset():this.items.length===0?this.appendItemsInternal(t):this.tryAppendItems(t)||this.reconcileItems(t),this.syncSelection()}appendItemsInternal(t,n=!0){if(t.length===0)return;const i=this.getLayout();let r=this.items.length===0?0:this.scrollHeight+i.gap;const o=r;for(let s=0;s<t.length;s++){const l=t[s];if(l==null)throw new Error("CodeView.appendItemsInternal: missing input item");if(this.idToItem.has(l.id))throw new Error(`CodeView.addItem: duplicate id "${l.id}"`);const a=this.createItem(l,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=La(a),r+=a.height+i.gap}this.scrollHeight=r-i.gap,this.scrollDirty=!0,n&&(this.canSkipRenderForAppend(o)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(t){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&t>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(t){if(t==null)return;this.capturePendingLayoutAnchor();const{options:n}=this,i=this.getLayout(),{itemMetricsCache:r}=this;ka(n,t)&&this.invalidateElementPool(),this.options=t;const o=this.computeMetricsCache(t.itemMetrics),s=!Ae(r,o),l=!Ae(i,this.getLayout());l&&this.syncLayout();const a=s||wa(n,t);if(a){const d=this.pendingLayoutReset;this.pendingLayoutReset={metrics:s?o:d?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:d?.includeEstimatedDiffHeights===!0||s||Ta(n,t)}}(l||a)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),ln(n,t)||this.renderOptionsRevision++,!this.isContainerManaged&&this.items.length>0&&this.render()}capturePendingLayoutAnchor(){this.root==null||this.items.length===0||this.pendingScrollTarget!=null||(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop()))}render(t=!1){ue.__STOP||(t?(ao(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):K(this.computeRenderRangeAndEmit))}instanceChanged(t,n){const i=this.instanceToItem.get(t);if(i==null)throw new Error("CodeView.instanceChanged: An instance has changed that is not registered");n&&this.markItemLayoutDirty(i),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getRenderedItems(){const{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1||n===-1||n<t)return[];const i=[];for(let r=t;r<=n;r++){const o=this.items[r];o?.element!=null&&(o.type==="diff"?i.push({id:o.item.id,type:"diff",item:o.item,version:o.version,element:o.element,instance:o.instance}):i.push({id:o.item.id,type:"file",item:o.item,version:o.version,element:o.element,instance:o.instance}))}return i}setSlotCoordinator(t){return t===this.slotCoordinator?!1:(this.slotCoordinator=t,this.slotSnapshot=void 0,!0)}getSlotSnapshot(t){return oi(this.getRenderedItems(),t)}subscribeToScroll(t){return this.scrollListeners.add(t),()=>{this.scrollListeners.delete(t)}}getLocalTopForInstance(t){const n=this.instanceToItem.get(t);if(n==null)throw new Error("CodeView.getLocalTopForInstance: unknown virtualized instance");return n.top}getTopForItem(t){const n=this.idToItem.get(t);if(n!=null)return n.top+this.getLayout().paddingTop}createItem(t,n,i){const{itemMetricsCache:r}=this;if(t.type==="diff"){const s=new la(this.createDiffOptions(t.id),this,r,this.workerManager,this.isContainerManaged);return{type:"diff",item:t,version:t.version,index:n,top:i,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:s}}const o=new ps(this.createFileOptions(t.id),this,r,this.workerManager,this.isContainerManaged);return{type:"file",item:t,version:t.version,index:n,top:i,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:o}}applySelectedLines(t,n){const{selectedLines:i}=this;t==null&&i==null||t!=null&&i?.id===t.id&&Vt(i.range,t.range)||(i!=null&&i.id!==t?.id&&this.idToItem.get(i.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=t,this.idToItem.get(t?.id??"")?.instance.setSelectedLines(t?.range??null,n))}syncSelection(){if(this.selectedLines==null)return;const t=this.idToItem.get(this.selectedLines.id);if(t==null){this.selectedLines=null;return}t.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}renamePendingScrollTarget(t,n){const{pendingScrollTarget:i}=this;i==null||i.type==="position"||i.id!==t||(this.pendingScrollTarget={...i,id:n})}renamePendingLayoutAnchor(t,n){this.pendingLayoutAnchor?.id===t&&(this.pendingLayoutAnchor.id=n)}createFileOptionsPrototype(){const t={};for(const n of Ca)he(t,n,()=>this.options[n]);he(t,"stickyHeader",()=>this.options.stickyHeaders),he(t,"collapsed",n=>this.getItemOptions(ze(n),"file")?.item.collapsed===!0);for(const n of Xn)this.defineItemSharedCallback(t,"file",n);for(const n of Qn)this.defineItemSelectionCallback(t,"file",n);return t}createDiffOptionsPrototype(){const t={};for(const n of va)he(t,n,()=>this.options[n]);he(t,"stickyHeader",()=>this.options.stickyHeaders),he(t,"hunkSeparators",()=>this.options.hunkSeparators),he(t,"collapsed",n=>this.getItemOptions(ze(n),"diff")?.item.collapsed===!0);for(const n of Xn)this.defineItemSharedCallback(t,"diff",n);for(const n of Qn)this.defineItemSelectionCallback(t,"diff",n);return t}createFileOptions(t){const n=Object.create(this.fileOptionsPrototype);return Jn(n,{id:t}),n}createDiffOptions(t){const n=Object.create(this.diffOptionsPrototype);return Jn(n,{id:t}),n}updateItemOptionsId(t,n){ze(t).id=n}getItemOptions(t,n){const i=this.idToItem.get(t.id);if(!(i==null||i.type!==n))return i}defineItemSharedCallback(t,n,i){he(t,i,r=>{if(this.options[i]==null)return;const o=ze(r),s=o.callbackCache??={};let l=s[i];return l==null&&(l=((...a)=>{const d=this.getItemOptions(o,n);if(d==null)return;const h=this.options[i];return h?.(...a,d)}),s[i]=l),l})}defineItemSelectionCallback(t,n,i){he(t,i,r=>{if(this.options.enableLineSelection!==!0)return;const o=ze(r),s=o.callbackCache??={};let l=s[i];return l==null&&(l=(a=>{const d=this.getItemOptions(o,n);if(d==null)return;const h=a==null?null:{id:d.item.id,range:a};this.options.controlledSelection!==!0&&(a!=null||this.selectedLines?.id===d.item.id)&&this.applySelectedLines(h,{notify:!1}),this.options.onSelectedLinesChange?.(h);const c=this.options[i];return c?.(a,d)}),s[i]=l),l})}markLayoutDirtyFromIndex(t){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??t,t)}markItemLayoutDirty(t){if(this.items[t.index]!==t)throw new Error(`CodeView.markItemLayoutDirty: unknown item id "${t.item.id}"`);this.markLayoutDirtyFromIndex(t.index)}tryAppendItems(t){if(t.length<=this.items.length)return!1;for(let n=0;n<this.items.length;n++){const i=this.items[n];if(i==null)throw new Error("CodeView.tryAppendItems: missing existing item");const r=t[n];if(r==null||i.item.id!==r.id||i.type!==r.type)return!1}for(let n=0;n<this.items.length;n++){const i=this.items[n];if(i==null)throw new Error("CodeView.tryAppendItems: missing existing item");const r=t[n];if(r==null)throw new Error("CodeView.tryAppendItems: append candidate missing prefix item");this.syncItemRecord(i,r)&&this.markLayoutDirtyFromIndex(n)}return this.appendItemsInternal(t.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(t){const{items:n,idToItem:i}=this,r=new Set(n),o=[],s=new Map,l=new Map;let a;for(let d=0;d<t.length;d++){const h=t[d];if(h==null)throw new Error("CodeView.reconcileItems: missing input item");if(s.has(h.id))throw new Error(`CodeView.setItems: duplicate id "${h.id}"`);const c=i.get(h.id),u=c!=null&&c.type===h.type?c:this.createItem(h,d,0);u.index=d,c!=null&&c.type===h.type?(r.delete(c),this.syncItemRecord(u,h)&&(a=Math.min(a??d,d))):a=Math.min(a??d,d),n[d]!==u&&(a=Math.min(a??d,d)),o.push(u),s.set(h.id,u),l.set(u.instance,u)}for(let d=0;d<n.length;d++){const h=n[d];if(h==null||!r.has(h))continue;this.releaseRenderedItem(h);const c=Math.max(o.length-1,0);a=Math.min(a??c,c)}a!=null&&(this.items=o,this.idToItem=s,this.instanceToItem=l,this.renderState.firstIndex>=o.length?this.resetRenderState():this.renderState.lastIndex>=o.length&&(this.renderState.lastIndex=o.length-1),this.markLayoutDirtyFromIndex(a),this.scrollDirty=!0,this.render())}syncItemRecord(t,n){if(t.type!==n.type)throw new Error(`CodeView.syncItemRecord: type mismatch for id "${n.id}"`);return t.version===n.version?!1:(t.item=n,t.version=n.version,t.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(t){const{paddingBottom:n,paddingTop:i}=this.getLayout();return Math.max(i+t+n-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>ei}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),vn):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(t){const n=this.getMaxPagedScrollTop();return Math.max(0,Math.min(t,n))}clampScrollTop(t){const n=this.getMaxScrollTop();return Math.max(0,Math.min(t,n))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(t){const n=this.getMaxScrollPageOffset();return Math.max(0,Math.min(t,n))}resolveScrollPageWindow(t,n){let i=ie(this.clampPagedScrollTop(n)),r=this.clampScrollPageOffset(t-i);return i=ie(this.clampPagedScrollTop(t-r)),r=this.clampScrollPageOffset(t-i),{pagedScrollTop:i,scrollPageOffset:r}}resolvePagedScrollPosition(t){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(t),scrollPageOffset:0};const n=this.clampScrollPageOffset(this.scrollPageOffset),i=t-n,r=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),s=i>ei&&n<o,l=i<cr&&n>0;return i<0||i>r||s||l?this.resolveScrollPageWindow(t,l?Math.min(ya,r):ur):{pagedScrollTop:ie(this.clampPagedScrollTop(i)),scrollPageOffset:n}}needsScrollPageUpdate(t){const n=ie(this.clampScrollTop(t)),{scrollPageOffset:i}=this.resolvePagedScrollPosition(n);return i!==this.scrollPageOffset}getPagedLayoutTop(t){return this.shouldRebaseScroll()?Math.max(t-this.scrollPageOffset,0):t}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(t){const n=this.idToItem.get(t.id);if(n==null){console.warn(`CodeView.scrollTo: unknown item id "${t.id}"`);return}if(t.type==="item")return{top:n.top,height:n.height};if(t.type==="range"){const r=this.getRangeScrollPosition(n,t);if(r==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ti(t.range)} for item "${t.id}"`);return}return{top:n.top+r.top,height:r.height}}const i=this.getLineScrollPosition(n,t);if(i==null){console.warn(`CodeView.scrollTo: unable to resolve line ${t.lineNumber} for item "${t.id}"`);return}return{top:n.top+i.top,height:i.height}}normalizeScrollTarget(t){if(t.type==="position"||t.align!=="nearest")return t;const n=this.getScrollTargetRect(t);if(n==null)return;const i=t.offset??0,r=this.getLayout().paddingTop+n.top,o=r+n.height,s=this.getScrollTop(),l=s+(t.type==="line"||t.type==="range"?this.getStickyHeaderOffset():0),a=s+this.getHeight();if(!(r-i<=l&&o+i>=a)){if(r-i<l)return{...t,align:"start"};if(o+i>a)return{...t,align:"end"}}}resolveScrollTargetTop(t){if(t.type==="position"){const r=this.clampScrollTop(t.position);return r!==t.position?r:this.clampScrollTop(t.position-this.getStickyHeaderOffset())}const n=this.idToItem.get(t.id);if(n==null){console.warn(`CodeView.scrollTo: unknown item id "${t.id}"`);return}if(t.type==="item")return this.clampScrollTop(this.resolveAlignedScrollPosition(n.top,n.height,t.align,t.offset));if(t.type==="range"){const r=this.getRangeScrollPosition(n,t);if(r==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ti(t.range)} for item "${t.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(n.top+r.top,r.height,t.align,t.offset,this.getStickyHeaderOffset()))}const i=this.getLineScrollPosition(n,t);if(i==null){console.warn(`CodeView.scrollTo: unable to resolve line ${t.lineNumber} for item "${t.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(n.top+i.top,i.height,t.align,t.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(t,n,i,r=0,o=0){t+=this.getLayout().paddingTop;const s=this.getHeight();return i==="center"&&n+r<s?t-(s-n)/2+r:i==="end"?t-(s-n)+r:t-o-r}getLineScrollPosition(t,n){return t.type==="diff"?t.instance.getLinePosition(n.lineNumber,n.side):t.instance.getLinePosition(n.lineNumber)}getRangeScrollPosition(t,n){const{range:i}=n,r=this.getLineScrollPosition(t,{type:"line",id:n.id,lineNumber:i.start,side:i.side}),o=this.getLineScrollPosition(t,{type:"line",id:n.id,lineNumber:i.end,side:i.endSide??i.side});if(r==null||o==null)return;const s=r.top,l=s+r.height,a=o.top,d=a+o.height,h=Math.min(s,a);return{top:h,height:Math.max(l,d)-h}}computeTargetScrollTopForFrame(t,n){if(this.pendingScrollTarget==null)return t;const i=this.resolveScrollTargetTop(this.pendingScrollTarget);if(i==null)return t;const{scrollAnimation:r}=this;return r==null?i:this.computeSpringStep(r,i,n).position}computeSpringStep(t,n,i){const r=Math.max(0,i-t.lastTimestamp),{omega:o}=this.getSmoothScrollSettings(),s=Math.exp(-o*r),l=t.position-n,a=t.velocity+o*l;return{position:n+(l+a*r)*s,velocity:(a*(1-o*r)-o*l)*s}}advanceScrollAnimation(t,n){if(this.pendingScrollTarget==null)return;const i=this.resolveScrollTargetTop(this.pendingScrollTarget);if(i==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}const r=this.scrollAnimation;if(r==null)return i;r.position+=n;const{position:o,velocity:s}=this.computeSpringStep(r,i,t);r.lastTimestamp=t,r.position=o,r.velocity=s;const{positionEpsilon:l,velocityEpsilon:a}=this.getSmoothScrollSettings();return Math.abs(i-o)<=l&&Math.abs(s)<=a?(r.position=i,r.velocity=0,this.scrollAnimation=void 0,i):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(ue.__STOP||this.container==null)return;const n=this.getHeight(),i=this.getScrollTop();let r=i,o=this.pendingLayoutAnchor!=null,s=this.getScrollAnchor(r);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,o=!0),o&&s!=null){const S=this.resolveAnchoredScrollTop(s);if(S!=null){const k=S-r;r=S,this.scrollAnimation!=null&&(this.scrollAnimation.position+=k)}}o&&(r=this.clampScrollTop(r),this.syncContainerHeight());const l=this.computeTargetScrollTopForFrame(r,t),a=!o&&(this.renderState.scrollTop===-1||Math.abs(l-this.renderState.scrollTop)>n+this.config.overscrollSize*2);a&&(s=void 0),this.windowSpecs=Wt({scrollTop:l,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:a,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let d=i;(this.pendingScrollTarget!=null&&l!==d||this.needsScrollPageUpdate(l))&&(this.applyScrollFix(l,d,this.windowSpecs),d=l);const{top:h,bottom:c}=this.windowSpecs,{firstIndex:u,lastIndex:f}=this.renderState;if(u>=0)for(let S=u;S<=f;S++){const k=this.items[S];if(k==null)throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${S}`);k.top>h-k.height&&k.top<=c||this.releaseRenderedItem(k)}let p;const m=new Set,y=this.findFirstVisibleIndex(h),v=this.findLastVisibleIndex(c);for(let S=y;S<=v;S++){const k=this.items[S];if(k==null)throw new Error("CodeView.computeRenderRangeAndEmit: missing item");const{instance:w}=k;k.element==null?(k.element=this.acquireElement(),ri(this.stickyContainer,k.element,p),w.virtualizedSetup(),ii(k,k.element)&&(k.renderedOptionsRevision=this.renderOptionsRevision,m.add(k)),p=k.element):(ri(this.stickyContainer,k.element,p),ii(k,void 0,k.renderedOptionsRevision!==this.renderOptionsRevision)&&(k.renderedOptionsRevision=this.renderOptionsRevision,m.add(k)),p=k.element)}this.renderState.firstIndex=y<=v?y:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.reconcileRenderedItems(m),this.syncContainerHeight(),this.updateStickyPositioning();const g=s!=null?this.resolveAnchoredScrollTop(s):void 0;s===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);const C=g!=null?g-r:0;let b=l,x=!1;if(this.pendingScrollTarget!=null){const S=this.advanceScrollAnimation(t,C);S!=null?(b=S,x=!0):b=r}else b=g??l;b!==d&&(this.applyScrollFix(b,d,this.windowSpecs),d=b),x&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=ie(d),this.flushManagers(m),this.validateStickyContainerHeight(),this.fixContainerFocus(),(a||this.scrollAnimation!=null)&&this.render()};flushManagers(t){for(const n of t)n.instance.flushManagers()}syncContainerHeight(){const t=this.getPagedScrollHeight();this.container==null||this.containerHeight===t||(this.container.style.height=`${t}px`,this.containerHeight=t)}getStickyBounds(t){const{firstIndex:n,lastIndex:i}=t!=null?{firstIndex:this.findFirstVisibleIndex(t.top),lastIndex:this.findLastVisibleIndex(t.bottom)}:this.renderState;if(n===-1||i===-1||n>i)return;const r=this.items[n]?.instance.getAdvancedStickySpecs(t),o=this.items[i]?.instance.getAdvancedStickySpecs(t);if(!(r==null||o==null))return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(o.topOffset+o.height)}}applyStickyPositioning({stickyTop:t,stickyBottom:n}){const i=this.getHeight(),{itemMetricsCache:r}=this,o=n-t;this.renderState.stickyHeight=o,this.renderState.stickyTop=t,this.renderState.stickyBottom=n,this.stickyOffset.style.height=`${t}px`;const s=(Math.random()*r.lineHeight>>0)*-1,l=-Math.max(o+s,0)+i;this.stickyContainer.style.top=`${l}px`,this.stickyContainer.style.bottom=`${l+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(t){this.syncContainerHeight();const n=this.getStickyBounds(t);n!=null&&this.applyStickyPositioning(n)}reconcileRenderedItems(t){const{firstIndex:n,lastIndex:i}=this.renderState;if(n===-1)return;let r=-1,o=!1;for(let s=n;s<this.items.length&&!(!o&&s>i);s++){const l=this.items[s];if(l==null)throw new Error("CodeView.reconcileRenderedItems: Invalid item");r===-1?r=l.top:l.top!==r&&(l.top=r,l.instance.syncVirtualizedTop(),o=!0),(t==null?s<=i:t.has(l))&&(l.instance.reconcileHeights()&&(o=!0,l.height=l.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(l)),r+=l.instance.getVirtualizedHeight(),s<this.items.length-1&&(r+=this.getLayout().gap)}o&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){const t=this.getStickyBounds();if(t==null)return;const{stickyTop:n,stickyBottom:i}=t;i-n===this.renderState.stickyHeight&&n===this.renderState.stickyTop&&i===this.renderState.stickyBottom||this.applyStickyPositioning(t)}handleScroll=()=>{ue.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=t=>{for(const n of t)if(n.target===this.stickyContainer){if(n.borderBoxSize[0].blockSize!==this.renderState.stickyHeight){const i=this.getScrollTop(),r=this.getScrollAnchor(i);this.reconcileRenderedItems(),this.updateStickyPositioning();const o=r!=null?this.resolveAnchoredScrollTop(r):void 0;if(o!=null){const s=o-i;this.applyScrollFix(o,i,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=s)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0)}}else this.scrollDirty=!0,this.heightDirty=!0,this.render()};getScrollAnchorViewportTop(t,n){return t<n?n+this.getStickyHeaderOffset():n}getScrollAnchor(t){if(this.pendingLayoutAnchor!=null)return this.pendingLayoutAnchor;const{firstIndex:n,lastIndex:i,stickyTop:r,stickyBottom:o}=this.renderState;if(n===-1||i===-1)return;const s=this.getHeight();if(!(r===-1||o===-1))for(let l=n;l<=i;l++){const a=this.items[l];if(a==null)continue;const d=this.getLayout().paddingTop+a.top;if(d+a.height<=t)continue;if(d>=t+s)break;if(d>=t)return{type:"item",id:a.item.id,viewportOffset:d-t};const h=this.getScrollAnchorViewportTop(d,t)-d,c=a.instance.getNumericScrollAnchor(h);if(c!=null){const u=d+c.top;return{type:"line",id:a.item.id,lineNumber:c.lineNumber,side:c.side,viewportOffset:u-t}}}}resolveAnchoredScrollTop(t){const n=this.idToItem.get(t.id);if(n==null)return;const{paddingTop:i}=this.getLayout();if(t.type==="item"){const s=i+n.top;return this.clampScrollTop(s-t.viewportOffset)}const r=n.type==="diff"?n.instance.getLinePosition(t.lineNumber,t.side):n.instance.getLinePosition(t.lineNumber);if(r==null)return;const o=i+n.top+r.top;return this.clampScrollTop(o-t.viewportOffset)}applyScrollFix(t,n,i){if(this.root==null)return;const r=ie(this.clampScrollTop(t)),o=ie(n),{scrollPageOffset:s}=this,l=ie(this.clampPagedScrollTop(o-s)),{pagedScrollTop:a,scrollPageOffset:d}=this.resolvePagedScrollPosition(r),h=a,c=s!==d;r===this.renderState.scrollTop&&r===o&&h===l&&!c||(this.suspendScrollInteractions(),(h!==l||c)&&(this.scrollPageOffset=d,this.syncPagedScrollScaffolding(i)),h!==l&&this.root.scrollTo({top:h,behavior:"instant"}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(t){const n=this.resolveScrollTargetTop(t);return n==null?!0:ie(this.getScrollTop())===ie(n)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;const t=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(t+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;const{onSnapshotChange:t}=this.slotCoordinator,n=oi(this.getRenderedItems(),this.slotCoordinator);Ra(this.slotSnapshot,n)||(this.slotSnapshot=n,t(n))}notifyScroll(){if(this.scrollListeners.size===0)return;const t=this.getScrollTop();for(const n of this.scrollListeners)n(t,this)}findFirstVisibleIndex(t){let n=0,i=this.items.length-1,r=this.items.length;for(;n<=i;){const o=n+i>>1,s=this.items[o];if(s==null)throw new Error("CodeView.findFirstVisibleIndex: invalid item index");s.top+s.height>t?(r=o,i=o-1):n=o+1}return r}findLastVisibleIndex(t){let n=0,i=this.items.length-1,r=-1;for(;n<=i;){const o=n+i>>1,s=this.items[o];if(s==null)throw new Error("CodeView.findLastVisibleIndex: invalid item index");s.top<=t?(r=o,n=o+1):i=o-1}return r}recomputeLayout(t=0,n){if(this.items.length===0){this.scrollHeight=0;return}const i=this.getLayout();let r=0;if(t>0){const o=this.items[t-1];if(o==null)throw new Error("CodeView.recomputeLayout: invalid dirty index");r=o.top+o.height+i.gap}for(let o=t;o<this.items.length;o++){const s=this.items[o];if(s==null)throw new Error("CodeView.recomputeLayout: invalid item index");s.top=r,s.type==="diff"?s.height=s.instance.prepareCodeViewItem(s.item.fileDiff,r,n,s.item.annotations??[]):s.height=s.instance.prepareCodeViewItem(s.item.file,r,n,s.item.annotations??[]),r+=s.height,o<this.items.length-1&&(r+=i.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 La(e){return e.instance.cleanUp(!0),e.type==="diff"?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,e.item.annotations??[])}function ka(e,t){return!Me(e.theme??P,t.theme??P)||(e.themeType??"system")!==(t.themeType??"system")||e.unsafeCSS!==t.unsafeCSS}function wa(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 Ta(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 Ea(e){return e instanceof SVGElement?!0:Ke(e)&&(e.hasAttribute("data-core-css")||e.hasAttribute("data-theme-css")||e.hasAttribute("data-unsafe-css"))}function ti(e){const t=ni(e.start,e.side),n=ni(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function ni(e,t){return t==null?`${e}`:`${t==="deletions"?"D":"A"}${e}`}function ii(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 ri(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Ia(e){return(e.annotations?.length??0)>0}function oi(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:i}){if(e.length===0)return;if(t||i)return e;if(!n)return;const r=[];for(const o of e)Ia(o.item)&&r.push(o);return r.length>0?r:void 0}function Ra(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++){const i=e[n],r=t[n];if(i==null||r==null||i.id!==r.id||i.type!==r.type||i.element!==r.element||i.version!==r.version)return!1}return!0}var Aa=class fr{options;tokensStable=[];tokensUnstable=[];lastUnstableCodeChunk="";lastStableGrammarState;constructor(t){this.options=t}async enqueue(t){const n=(this.lastUnstableCodeChunk+t).split(`
|
|
1416
|
+
`),i=[];let r=[];const o=this.tokensUnstable.length;return n.forEach((s,l)=>{const a=l===n.length-1,d=this.options.highlighter.codeToTokens(s,{...this.options,grammarState:this.lastStableGrammarState}),h=d.tokens[0];a||h.push({content:`
|
|
1417
|
+
`,offset:0}),a?(r=h,this.lastUnstableCodeChunk=s):(this.lastStableGrammarState=d.grammarState,i.push(...h))}),this.tokensStable.push(...i),this.tokensUnstable=r,{recall:o,stable:i,unstable:r}}close(){const t=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0,{stable:t}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0}clone(){const t=new fr(this.options);return t.lastUnstableCodeChunk=this.lastUnstableCodeChunk,t.tokensUnstable=this.tokensUnstable,t.tokensStable=this.tokensStable,t.lastStableGrammarState=this.lastStableGrammarState,t}},si=class extends TransformStream{tokenizer;options;constructor(e){const t=new Aa(e),{allowRecalls:n=!1}=e;super({async transform(i,r){const{stable:o,unstable:s,recall:l}=await t.enqueue(i);n&&l>0&&r.enqueue({recall:l});for(const a of o)r.enqueue(a);if(n)for(const a of s)r.enqueue(a)},async flush(i){const{stable:r}=t.close();if(!n)for(const o of r)i.enqueue(o)}}),this.tokenizer=t,this.options=e}};function Ha(e){const t=document.createElement("span");return t.style=Ir(e.htmlStyle??Rr(e)),t.textContent=e.content,t}let Ma=-1;var Tl=class{options;__id=`file-stream:${++Ma}`;highlighter;stream;abortController;fileContainer;pre;code;gutterElement;contentElement;themeCSSStyle;appliedThemeCSS;currentRowCount=0;constructor(e={theme:P}){this.options=e,this.currentLineIndex=this.options.startingLineIndex??1}cleanUp(){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 St(hn(this.options.lang,this.options)),this.highlighter}queuedSetupArgs;async setup(e,t){const n=this.queuedSetupArgs!=null;if(this.queuedSetupArgs=[e,t],n)return;this.highlighter??=await this.initializeHighlighter();const[i,r]=this.queuedSetupArgs;this.queuedSetupArgs=void 0;const o=i;this.setupStream(o,r,this.highlighter)}setupStream(e,t,n){const{disableLineNumbers:i=!1,overflow:r="scroll",theme:o=P,themeType:s="system"}=this.options,l=this.getOrCreateFileContainer();l.parentElement==null&&t.appendChild(l),this.pre??=document.createElement("pre"),this.pre.parentElement==null&&l.shadowRoot?.appendChild(this.pre);const a=typeof o=="string"?n.getTheme(o).type:void 0,d=cn({theme:o,highlighter:n});this.applyThemeState(l,d,s,a);const h=mn(this.pre,{type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:i,overflow:r,split:!1,totalLines:0});h.textContent="",this.pre=h,this.code=Ge({code:this.code,pre:h}),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;const{onStreamStart:c,onStreamClose:u,onStreamAbort:f}=this.options;this.stream?.cancel().catch(()=>{}),this.stream=e,this.stream.pipeThrough(typeof o=="string"?new si({...this.options,theme:o,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:_("token"),tokenizeTimeLimit:0}):new si({...this.options,themes:o,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:_("token"),tokenizeTimeLimit:0})).pipeTo(new WritableStream({start(p){c?.(p)},close(){u?.()},abort(p){f?.(p)},write:this.handleWrite}),{signal:this.abortController.signal}).catch(p=>{p.name!=="AbortError"&&console.error("FileStream pipe error:",p)})}queuedTokens=[];handleWrite=e=>{"recall"in e&&this.queuedTokens.length>=e.recall?this.queuedTokens.length=this.queuedTokens.length-e.recall:this.queuedTokens.push(e),K(this.render),this.options.onStreamWrite?.(e)};currentLineIndex;currentLineElement;render=()=>{this.options.onPreRender?.(this);const{gutter:e,content:t}=this.getOrCreateStreamColumns(),n=document.createDocumentFragment(),i=document.createDocumentFragment();for(const r of this.queuedTokens)if("recall"in r){if(this.currentLineElement==null)throw new Error("FileStream.render: no current line element, shouldnt be possible to get here");if(r.recall>this.currentLineElement.childNodes.length)throw new Error("FileStream.render: Token recall exceed the current line, there's probably a bug...");for(let o=0;o<r.recall;o++)this.currentLineElement.lastChild?.remove()}else{const o=Ha(r);if(this.currentLineElement==null){const{gutterLine:s,contentLine:l}=this.createLine();n.appendChild(s),i.appendChild(l)}if(this.currentLineElement?.appendChild(o),r.content===`
|
|
1418
|
+
`){this.currentLineIndex++;const{gutterLine:s,contentLine:l}=this.createLine();n.appendChild(s),i.appendChild(l)}}n.childNodes.length>0&&e.appendChild(n),i.childNodes.length>0&&t.appendChild(i),this.queuedTokens.length=0,this.options.onPostRender?.(this)};getOrCreateStreamColumns(){if(this.code==null)throw new Error("FileStream: expected code element to exist");if(this.gutterElement!=null&&this.contentElement!=null)return{gutter:this.gutterElement,content:this.contentElement};const e=document.createElement("div");e.dataset.gutter="";const 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(){const e=this.currentLineIndex,t=`${e-1}`,n=document.createElement("div");n.dataset.columnNumber=`${e}`,n.dataset.lineType="context",n.dataset.lineIndex=t;const i=document.createElement("span");i.dataset.lineNumberContent="",i.textContent=`${e}`,n.appendChild(i);const r=document.createElement("div");return r.dataset.line=`${e}`,r.dataset.lineType="context",r.dataset.lineIndex=t,this.currentRowCount+=1,this.updateRowSpan(),this.currentLineElement=r,{gutterLine:n,contentLine:r}}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,i){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n,s=this.options.theme??P,l=typeof s=="string"?s:{...s},a=He(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}this.themeCSSStyle=bn({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:gn(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:i,scrollbarGutter:a}:void 0}};function pr(e,t){const{resolution:n,hunkIndex:i,startContentIndex:r,endContentIndex:o,indexesToDelete:s=new Set}=t,l=e.hunks[i];if(l==null)throw console.error({diff:e,hunkIndex:i}),new Error(`resolveRegion: Invalid hunk index: ${i}`);if(r<0||o>=l.hunkContent.length||r>o)throw new Error(`resolveRegion: Invalid content range, ${r}, ${o}`);const{hunks:a,additionLines:d,deletionLines:h}=e,c={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey!=null?`${e.cacheKey}:${n[0]}-${i}:${r}-${o}`:void 0},u={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},f=i===a.length-1&&o===l.hunkContent.length-1,p=!e.isPartial;for(const[y,v]of a.entries()){Da(e,c,u,v.deletionLineIndex-v.collapsedBefore,v.additionLineIndex-v.collapsedBefore,v.collapsedBefore,p);const g={...v,hunkContent:[],additionStart:u.nextAdditionStart,deletionStart:u.nextDeletionStart,additionLineIndex:u.nextAdditionLineIndex,deletionLineIndex:u.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:u.splitLineCount,unifiedLineStart:u.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(const[C,b]of v.hunkContent.entries())if(y!==i||C<r||C>o){ai(b,c,h,d);const x={...b,additionLineIndex:u.nextAdditionLineIndex,deletionLineIndex:u.nextDeletionLineIndex};g.hunkContent.push(x),Ut(x,u,g)}else if(s.has(C))g.hunkContent.push({type:"context",lines:0,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex});else if(b.type==="context"){ai(b,c,h,d);const x={...b,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex};g.hunkContent.push(x),Ut(x,u,g)}else{Pa(n,b,c,h,d);const x={type:"context",lines:n==="deletions"?b.deletions:n==="additions"?b.additions:b.deletions+b.additions,deletionLineIndex:u.nextDeletionLineIndex,additionLineIndex:u.nextAdditionLineIndex};g.hunkContent.push(x),Ut(x,u,g)}if(y===i&&f){const C=n==="deletions"?v.noEOFCRDeletions:v.noEOFCRAdditions;g.noEOFCRAdditions=C,g.noEOFCRDeletions=C}c.hunks.push(g)}const m=a.at(-1);return m!=null&&!e.isPartial&&gr(c,h,d,m.deletionLineIndex+m.deletionCount,m.additionLineIndex+m.additionCount,Math.min(h.length-(m.deletionLineIndex+m.deletionCount),d.length-(m.additionLineIndex+m.additionCount))),c.splitLineCount=u.splitLineCount,c.unifiedLineCount=u.unifiedLineCount,c}function gr(e,t,n,i,r,o){for(let s=0;s<o;s++){const l=t[i+s],a=n[r+s];if(l==null||a==null)throw new Error("pushCollapsedContextLines: missing collapsed context line");e.deletionLines.push(l),e.additionLines.push(a)}}function Da(e,t,n,i,r,o,s){o<=0||(s&&(gr(t,e.deletionLines,e.additionLines,i,r,o),n.nextAdditionLineIndex+=o,n.nextDeletionLineIndex+=o),n.nextAdditionStart+=o,n.nextDeletionStart+=o,n.splitLineCount+=o,n.unifiedLineCount+=o)}function ai(e,t,n,i){if(e.type==="context")for(let r=0;r<e.lines;r++){const o=i[e.additionLineIndex+r];if(o==null)throw console.error({additionLines:i,content:e,i:r}),new Error("pushContentLinesToDiff: Context line does not exist");t.deletionLines.push(o),t.additionLines.push(o)}else{const r=Math.max(e.deletions,e.additions);for(let o=0;o<r;o++){if(o<e.deletions){const s=n[e.deletionLineIndex+o];if(s==null)throw console.error({deletionLines:n,content:e,i:o}),new Error("pushContentLinesToDiff: Deletion line does not exist");t.deletionLines.push(s)}if(o<e.additions){const s=i[e.additionLineIndex+o];if(s==null)throw console.error({additionLines:i,content:e,i:o}),new Error("pushContentLinesToDiff: Addition line does not exist");t.additionLines.push(s)}}}}function Pa(e,t,n,i,r){if(e==="deletions"||e==="both")for(let o=0;o<t.deletions;o++){const s=i[t.deletionLineIndex+o];if(s==null)throw console.error({deletionLines:i,content:t,i:o}),new Error("pushResolveLinesToDiff: Deletion line does not exist");n.deletionLines.push(s),n.additionLines.push(s)}if(e==="additions"||e==="both")for(let o=0;o<t.additions;o++){const s=r[t.additionLineIndex+o];if(s==null)throw console.error({additionLines:r,content:t,i:o}),new Error("pushResolveLinesToDiff: Addition line does not exist");n.deletionLines.push(s),n.additionLines.push(s)}}function Ut(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 mr(e){const t=typeof e=="string"?e:e.type;return t==="accept"||t==="incoming"?"additions":t==="reject"||t==="current"?"deletions":"both"}function Oa(e,t,n){return pr(e,{resolution:mr(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:Na(t)})}function Na(e){const t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}function br({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function vr(e,t){const n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:$a(n,e.startContentIndex)}}function li(e,t=6){t=Math.max(t,1);const n={deletionLines:[],additionLines:[],conflictStack:[],conflictBuilders:[],actions:[],hunks:[],nextConflictIndex:0,splitLineCount:0,unifiedLineCount:0,lastHunkEnd:0,activeHunk:void 0,maxContextLines:t,maxContextLines2:t*2},i=e.contents,r=i.length;if(r>0){let c=0,u=0,f=i.indexOf(`
|
|
1419
|
+
`,c);for(;f!==-1;)di(n,i.slice(c,f+1),u),c=f+1,u++,f=i.indexOf(`
|
|
1420
|
+
`,c);c<r&&di(n,i.slice(c),u)}if(n.conflictStack.length>0)throw new Error("parseMergeConflictDiffFromFile: unfinished merge conflict marker stack");n.activeHunk!=null&&n.activeHunk.hunkContent.length>0&&(Cn(n,n.activeHunk,"trailing"),yr(n));for(let c=0;c<n.conflictBuilders.length;c++){const u=n.conflictBuilders[c];if(u==null||!u.completed)throw new Error(`parseMergeConflictDiffFromFile: failed to build merge conflict action ${c}`)}if(n.hunks.length>0&&n.additionLines.length>0&&n.deletionLines.length>0){const c=n.hunks[n.hunks.length-1],u=Math.max(n.additionLines.length-(c.additionStart+c.additionCount-1),0);n.splitLineCount+=u,n.unifiedLineCount+=u}const o=n.deletionLines.join(""),s=n.additionLines.join(""),l=gi(e,"current",o),a=gi(e,"incoming",s);let d="change";s===""?d="deleted":o===""&&(d="new");const h={name:e.name,prevName:void 0,type:d,hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,isPartial:!1,deletionLines:n.deletionLines,additionLines:n.additionLines,cacheKey:e.cacheKey!=null?`${e.cacheKey}:merge-conflict-diff`:void 0};return{fileDiff:h,currentFile:l,incomingFile:a,actions:n.actions,markerRows:Lr(h,n.actions)}}function di(e,t,n){const i=e.conflictStack[e.conflictStack.length-1];if(i==null){if(t.length>=7&&t.charCodeAt(0)===60&&pi(t)==="start"){ui(e,t,n);return}hi(e,t);return}const r=pi(t);if(r==="start"){ui(e,t,n);return}if(r==="base"){i.stage="base",i.baseMarkerLineIndex=n,i.markerLines.base=t;return}if(r==="separator"){i.stage="incoming",i.separatorLineIndex=n,i.markerLines.separator=t;return}if(r==="end"){const o=e.conflictStack.pop();if(o==null)throw new Error("parseMergeConflictDiffFromFile: encountered end marker before start marker");Ua(e,o,n,t);return}i.stage==="current"?ci(e,"deletion",t,i.conflictIndex,"current"):i.stage==="base"?hi(e,t,i.conflictIndex):ci(e,"addition",t,i.conflictIndex,"incoming")}function Cr(e){return e.activeHunk??=xr(e.additionLines.length+1,e.deletionLines.length+1),e.activeHunk}function Sr(e,t,n,i){const r=e.conflictBuilders[t];if(r==null)throw new Error(`parseMergeConflictDiffFromFile: failed to locate conflict action ${t}`);const o=r.action,s=e.hunks.length;if(o.hunkIndex<0)o.hunkIndex=s;else if(o.hunkIndex!==s)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t} spans multiple hunks and cannot be anchored`);if(o.startContentIndex<0&&(o.startContentIndex=i),o.endContentIndex=i,o.endMarkerContentIndex=i,n==="current"){o.currentContentIndex??=i;return}if(n==="base"){o.baseContentIndex??=i;return}o.incomingContentIndex=i}function Fa(e,t,n,i){const r=e.hunkContent,o=r[r.length-1];return o?.type==="change"?(t==="addition"?o.additions++:o.deletions++,r.length-1):(r.push({type:"change",additions:t==="addition"?1:0,deletions:t==="deletion"?1:0,additionLineIndex:n,deletionLineIndex:i}),r.length-1)}function Cn(e,t,n){let i=t.contextBufferCount,r=t.contextBufferAdditionStart,o=t.contextBufferDeletionStart;if(n==="leading"&&i>e.maxContextLines){const h=i-e.maxContextLines;r+=h,o+=h,i=e.maxContextLines,t.additionStart+=h,t.deletionStart+=h,t.additionLineIndex+=h,t.deletionLineIndex+=h}if(n==="trailing"&&i>e.maxContextLines&&(i=e.maxContextLines),i===0){t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0;return}const s=t.hunkContent,l=s[s.length-1];let a;l?.type==="context"?(l.lines+=i,a=s.length-1):(s.push({type:"context",lines:i,additionLineIndex:r,deletionLineIndex:o}),a=s.length-1),t.additionCount+=i,t.deletionCount+=i;const d=t.contextBufferBaseConflicts;if(d!=null){const h=r-t.contextBufferAdditionStart;for(const[c,u]of d)c>=h&&c<h+i&&Sr(e,u,"base",a)}t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0}function yr(e){if(e.activeHunk==null)return;const t=e.activeHunk;if(e.activeHunk=void 0,t.hunkContent.length===0)return;let n=0,i=0;for(const s of t.hunkContent)s.type==="context"?(n+=s.lines,i+=s.lines):(n+=Math.max(s.additions,s.deletions),i+=s.additions+s.deletions);const r=Math.max(t.additionStart-1-e.lastHunkEnd,0),o={collapsedBefore:r,additionStart:t.additionStart,additionCount:t.additionCount,additionLines:t.additionLines,additionLineIndex:t.additionLineIndex,deletionStart:t.deletionStart,deletionCount:t.deletionCount,deletionLines:t.deletionLines,deletionLineIndex:t.deletionLineIndex,hunkContent:t.hunkContent,hunkContext:void 0,hunkSpecs:`@@ -${fi(t.deletionStart,t.deletionCount)} +${fi(t.additionStart,t.additionCount)} @@
|
|
1421
|
+
`,splitLineStart:e.splitLineCount+r,splitLineCount:n,unifiedLineStart:e.unifiedLineCount+r,unifiedLineCount:i,noEOFCRAdditions:!1,noEOFCRDeletions:!1};e.hunks.push(o),e.splitLineCount+=r+n,e.unifiedLineCount+=r+i,e.lastHunkEnd=t.additionStart+t.additionCount-1}function za(e){if(e.activeHunk==null)return;const t=e.activeHunk,n=t.contextBufferCount,i=n-e.maxContextLines2,r=t.contextBufferAdditionStart+n-e.maxContextLines,o=t.contextBufferDeletionStart+n-e.maxContextLines;let s;if(t.contextBufferBaseConflicts!=null){const d=n-e.maxContextLines;for(const[h,c]of t.contextBufferBaseConflicts)h>=d&&(s??=new Map,s.set(h-d,c))}Cn(e,t,"trailing");const l=t.additionCount,a=t.deletionCount;yr(e),e.activeHunk=xr(t.additionStart+l+i,t.deletionStart+a+i),e.activeHunk.contextBufferAdditionStart=r,e.activeHunk.contextBufferDeletionStart=o,e.activeHunk.contextBufferCount=e.maxContextLines,e.activeHunk.contextBufferBaseConflicts=s}function hi(e,t,n=-1){const i=Cr(e);i.contextBufferCount===0&&(i.contextBufferAdditionStart=e.additionLines.length,i.contextBufferDeletionStart=e.deletionLines.length),e.additionLines.push(t),e.deletionLines.push(t),n>=0&&(i.contextBufferBaseConflicts??=new Map,i.contextBufferBaseConflicts.set(i.contextBufferCount,n)),i.contextBufferCount++}function ci(e,t,n,i,r){let o=Cr(e);o.hunkContent.length>0&&o.contextBufferCount>e.maxContextLines2&&(za(e),o=e.activeHunk),Cn(e,o,o.hunkContent.length===0?"leading":"before-change");const s=e.additionLines.length,l=e.deletionLines.length;t==="addition"?e.additionLines.push(n):e.deletionLines.push(n);const a=Fa(o,t,s,l);t==="addition"?(o.additionCount++,o.additionLines++):(o.deletionCount++,o.deletionLines++),Sr(e,i,r,a)}function Ua(e,t,n,i){if(t.separatorLineIndex==null||t.markerLines.separator==null)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t.conflictIndex} is missing a separator marker`);const r=e.conflictBuilders[t.conflictIndex];if(r==null)throw new Error(`parseMergeConflictDiffFromFile: failed to finalize conflict ${t.conflictIndex}`);const o=r.action;o.markerLines.separator=t.markerLines.separator,o.markerLines.end=i,t.markerLines.base!=null&&(o.markerLines.base=t.markerLines.base),o.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?t.baseMarkerLineIndex+1:void 0};const s=o.currentContentIndex??o.incomingContentIndex;if(o.currentContentIndex??=s,o.incomingContentIndex??=s,o.startContentIndex<0&&s!=null&&(o.startContentIndex=s),o.endContentIndex<0&&s!=null&&(o.endContentIndex=s),o.endMarkerContentIndex<0&&s!=null&&(o.endMarkerContentIndex=s),o.hunkIndex<0||o.startContentIndex<0||o.endContentIndex<0||o.endMarkerContentIndex<0)throw new Error(`parseMergeConflictDiffFromFile: failed to anchor merge conflict ${t.conflictIndex}`);e.actions[o.conflictIndex]=o,r.completed=!0}function ui(e,t,n){const i=e.nextConflictIndex;e.nextConflictIndex++,e.conflictStack.push({conflictIndex:i,stage:"current",startLineIndex:n,markerLines:{start:t}}),e.conflictBuilders[i]={completed:!1,action:{conflict:{conflictIndex:i,startLineIndex:n,startLineNumber:n+1,separatorLineIndex:n,separatorLineNumber:n+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:void 0,baseMarkerLineNumber:void 0},conflictIndex:i,hunkIndex:-1,startContentIndex:-1,endContentIndex:-1,endMarkerContentIndex:-1,markerLines:{start:t,separator:"",end:""}}}}function xr(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 fi(e,t){return t===1?`${e}`:`${e},${t}`}function pi(e){if(e.length<7)return;const t=e.charCodeAt(0);if(t!==60&&t!==62&&t!==61&&t!==124)return;const n=Ba(e);if(n<7)return;let i=1;for(;i<n&&e.charCodeAt(i)===t;)i++;if(!(i<7)){if(t===61)return i===n?"separator":void 0;if(!(i!==n&&!_a(e.charCodeAt(i))))return t===60?"start":t===62?"end":"base"}}function Ba(e){let t=e.length;return t>0&&e.charCodeAt(t-1)===10&&t--,t>0&&e.charCodeAt(t-1)===13&&t--,t}function _a(e){return e===9||e===10||e===11||e===12||e===13||e===32}function gi(e,t,n){return{...e,contents:n,cacheKey:e.cacheKey!=null?`${e.cacheKey}:merge-conflict-${t}`:void 0}}function Lr(e,t){const n=[],i=new Array(e.hunks.length),r=(s,l)=>{const a=e.hunks[s];if(a==null)return 0;let d=i[s];if(d==null){d=new Array(a.hunkContent.length+1);let h=a.unifiedLineStart;d[0]=h;for(let c=0;c<a.hunkContent.length;c++){const u=a.hunkContent[c];h+=u.type==="context"?u.lines:u.deletions+u.additions,d[c+1]=h}i[s]=d}return d[Math.max(l,0)]??a.unifiedLineStart},o=(s,l)=>{const a=r(s,l),d=i[s]?.[Math.max(l+1,0)]??r(s,l+1);return Math.max(a,d-1)};for(const s of t){if(s==null)continue;const l=e.hunks[s.hunkIndex];if(l==null)continue;const a=r(s.hunkIndex,s.startContentIndex);if(n.push(ke(s,"marker-start",s.startContentIndex,s.markerLines.start,a)),s.baseContentIndex!=null){const f=s.currentContentIndex,p=s.incomingContentIndex;if(f==null||p==null)continue;const m=s.markerLines.base;if(m==null)continue;const y=l.hunkContent[f],v=l.hunkContent[s.baseContentIndex],g=l.hunkContent[p];if(y?.type!=="change"||v?.type!=="context"||g?.type!=="change")continue;const C=r(s.hunkIndex,f),b=r(s.hunkIndex,p);n.push(ke(s,"marker-base",s.baseContentIndex,m,C+y.deletions)),n.push(ke(s,"marker-separator",s.baseContentIndex,s.markerLines.separator,b),ke(s,"marker-end",s.endMarkerContentIndex,s.markerLines.end,o(s.hunkIndex,s.endMarkerContentIndex)));continue}const d=s.currentContentIndex;if(d==null)continue;const h=l.hunkContent[d];if(h?.type!=="change")continue;const c=r(s.hunkIndex,d),u=h.deletions>0?c+h.deletions:a;n.push(ke(s,"marker-separator",d,s.markerLines.separator,u),ke(s,"marker-end",s.endMarkerContentIndex,s.markerLines.end,o(s.hunkIndex,s.endMarkerContentIndex)))}return n}function ke(e,t,n,i,r){return{type:t,hunkIndex:e.hunkIndex,contentIndex:n,conflictIndex:e.conflictIndex,lineText:i,lineIndex:r}}function $a(e,t){let n=e.unifiedLineStart;for(let i=0;i<t;i++){const r=e.hunkContent[i];n+=r.type==="context"?r.lines:r.deletions+r.additions}return n}var mi=class extends lr{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:P},t,n){super(void 0,t,n),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(const i of e){const r=i!=null?vr(i,n):void 0;if(i==null||r==null)continue;const o={type:"actions",hunkIndex:r.hunkIndex,lineIndex:r.lineIndex,conflictIndex:i.conflictIndex};this.addInjectedRow(o)}for(const i of t)this.addInjectedRow(i)}addInjectedRow(e){const t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=Re){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=Re){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}){const n=e==="change"?t==="change-deletion"?"current":"incoming":void 0;return{gutterLineType:e==="change"?"context":t,gutterProperties:bi(n),contentProperties:vi(e,n)}}getSplitLineDecoration({side:e,type:t}){const n=t==="change"?e==="deletions"?"current":"incoming":void 0;return{gutterLineType:t==="change"?"context":t,gutterProperties:bi(n),contentProperties:vi(t,n)}}getUnifiedInjectedRowsForLine=e=>{const t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;const{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),i=[],r=[];for(const o of t){if(o.type==="actions"){i.push({content:Va({row:o,includeDefaultActions:n==="default",includeSlot:!0}),gutter:Ci("action")});continue}(o.type==="marker-end"?r:i).push({content:Wa(o),gutter:Ci("marker",o.type)})}return{before:i.length>0?i:void 0,after:r.length>0?r:void 0}};getOptionsWithDefaults(){const e=super.getOptionsWithDefaults();return e.diffStyle="unified",e.lineDiffType="none",e.mergeConflictActionsType=this.options.mergeConflictActionsType??"default",e}};function bi(e){return e!=null?{"data-merge-conflict":e}:void 0}function vi(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 Ci(e,t){const n=G(void 0,"annotation",1);return n.properties["data-gutter-buffer"]=e==="action"?"merge-conflict-action":`merge-conflict-${t??"marker"}`,n}function Va({row:e,includeDefaultActions:t,includeSlot:n}){const i=t?Ga(e.conflictIndex):[];return i.push(R({tagName:"slot",properties:{name:br({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":""}})),R({tagName:"div",properties:{"data-merge-conflict-actions":""},children:[R({tagName:"div",properties:{"data-merge-conflict-actions-content":""},children:i})]})}function Wa(e){return R({tagName:"div",properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":""},children:[V(e.lineText.replace(/(?:\r\n|\n|\r)$/,""))]})}function Ga(e){return[Bt({resolution:"current",label:"Accept current change",conflictIndex:e}),Si(),Bt({resolution:"incoming",label:"Accept incoming change",conflictIndex:e}),Si(),Bt({resolution:"both",label:"Accept both",conflictIndex:e})]}function Bt({resolution:e,label:t,conflictIndex:n}){return R({tagName:"button",properties:{type:"button","data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[V(t)]})}function Si(){return R({tagName:"span",properties:{"data-merge-conflict-action-separator":""},children:[V("|")]})}function ja(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&&qa(e.conflict,t.conflict)}function qa(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}let Ka=-1;var El=class extends dr{options;__id=`unresolved-file:${++Ka}`;type="unresolved-file";computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:P},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 new 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(qe(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 mi(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return il(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:i}){const{maxContextLines:r,onMergeConflictAction:o}=this.options;e:if(o!=null){const s=t!=null;if(s!==(n!=null)||s!==(i!=null))throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together");if(t!=null&&n!=null&&i!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:i};break e}else if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!se(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw new 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 new Error("UnresolvedFile.getOrComputeDiff: file is null, should be impossible");if(!se(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){const l=li(e,r);this.computedCache={file:e,fileDiff:l.fileDiff,actions:l.actions,markerRows:l.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}else{t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}}else{if(t!=null||n!=null||i!=null)throw new 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&&!se(e,this.computedCache.file))throw new 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){const s=li(this.computedCache.file,r);this.computedCache.fileDiff=s.fileDiff,this.computedCache.actions=s.actions,this.computedCache.markerRows=s.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}if(!(t==null||n==null||i==null))return{fileDiff:t,actions:n,markerRows:i}}hydrate(e){const{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,fileContainer:s,prerenderedHTML:l,preventEmit:a=!1}=e,d=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});d!=null&&(this.hydrateElements(s,l),this.setActiveMergeConflictState(d.actions,d.markerRows),tl(this.pre,d.fileDiff,this.options.collapsed)||nl(this.headerElement,d.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:d.fileDiff,lineAnnotations:o}),this.pre!=null&&this.renderMergeConflictActionSlots()),a||this.emitPostRender())}rerender(){!this.enabled||this.fileDiff==null||this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){const{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,preventEmit:s=!1,...l}=e,a=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});if(a==null)return!1;this.setActiveMergeConflictState(a.actions,a.markerRows);const d=super.render({...l,fileDiff:a.fileDiff,lineAnnotations:o,preventEmit:!0});return d&&(this.renderMergeConflictActionSlots(),s||this.emitPostRender()),d}resolveConflict(e,t,n=this.computedCache.fileDiff){const i=this.conflictActions[e];if(n==null||i==null)return;if(i.conflictIndex!==e)throw console.error({conflictIndex:e,action:i}),new Error("UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match");const r=Oa(n,i,t),o=this.computedCache.file,{file:s,actions:l,markerRows:a}=Ya({fileDiff:r,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:o,resolution:t});return{file:s,fileDiff:r,actions:l,markerRows:a}}resolveConflictAndRender(e,t){const n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),new Error("UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match");const i={resolution:t,conflict:n.conflict},{file:r,fileDiff:o,actions:s,markerRows:l}=this.resolveConflict(e,t)??{};r==null||o==null||s==null||l==null||(this.computedCache={file:r,fileDiff:o,actions:s,markerRows:l},this.setActiveMergeConflictState(s,l),this.workerManager!=null?this.hunksRenderer.renderDiff(o):this.render({forceRender:!0}),this.options.onMergeConflictResolve?.(r,i))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof mi&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType==="none"?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{const t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),new Error("UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match");const 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(){const{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!="function"||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}const t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){const i=this.conflictActions[n];if(i==null)continue;if(i.conflictIndex!==n)throw console.error({conflictIndex:n,action:i}),new Error("UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match");const r=vr(i,e);if(r==null)continue;const o=i.conflictIndex,s=br({hunkIndex:r.hunkIndex,lineIndex:r.lineIndex,conflictIndex:o}),l=`${n}-${s}`;let a=this.conflictActionCache.get(l);if(a==null||!ja(a.action,i)){a?.element.remove();const d=this.renderMergeConflictAction(i);if(d==null)continue;const h=un(s);h.appendChild(d),this.fileContainer.appendChild(h),a={element:h,action:i},this.conflictActionCache.set(l,a)}t.delete(l)}for(const[n,{element:i}]of t.entries())this.conflictActionCache.delete(n),i.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!="function")return;const t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<"u"&&t instanceof DocumentFragment){const n=document.createElement("div");return n.style.display="contents",n.appendChild(t),n}}}clearMergeConflictActionCache(){for(const{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function Ya({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:i,resolution:r}){const o=t[n];if(o==null)throw new Error("rebuildFileAndActions: missing resolved action for unresolved file rebuild");const s=Ja(t,n,o,r),l=Lr(e,s);return{file:Xa({fileDiff:e,resolvedAction:o,resolvedConflictIndex:n,previousFile:i,resolution:r}),actions:s,markerRows:l}}function Xa({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:i,resolution:r}){const o=vt(n?.contents??""),{conflict:s}=e,l=Qa(o,s,r),a=[...o.slice(0,s.startLineIndex),...l,...o.slice(s.endLineIndex+1)].join("");return{name:n?.name??i.name,contents:a,cacheKey:n?.cacheKey!=null?`${n.cacheKey}:mc-${t}-${r}`:void 0}}function Qa(e,t,n){const i=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),r=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n==="current"?i:n==="incoming"?r:[...i,...r]}function Ja(e,t,n,i){const r=Za(n.conflict,i);return e.map((o,s)=>{if(s!==t&&o!=null)return o.conflict.startLineIndex>n.conflict.endLineIndex?{...o,conflict:el(o.conflict,r)}:o})}function Za(e,t){const n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,i=e.endLineIndex-e.separatorLineIndex-1;return(t==="current"?n:t==="incoming"?i:n+i)-(e.endLineIndex-e.startLineIndex+1)}function el(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?e.baseMarkerLineIndex+t:void 0,baseMarkerLineNumber:e.baseMarkerLineNumber!=null?e.baseMarkerLineNumber+t:void 0}}function tl(e,t,n=!1){return!n&&e==null&&t!=null}function nl(e,t,n=!1){return e==null&&t!=null&&!n}function il(e,t){return{...t,...e,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType=="function"?"custom":e?.mergeConflictActionsType}}function rl(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}const kr=1e3,ol=kr*4,sl=[0,1e-6,.99999,1],al={overscrollSize:kr,intersectionObserverMargin:ol,resizeDebugging:!1};let lt=0,ll=-1;var Il=class re{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++ll}`;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(t){this.config={...al,...t}}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:sl,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{re.__STOP?(re.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:re.__lastScrollPosition}),K(this.computeRenderRangeAndEmit)):(re.__lastScrollPosition=this.getScrollTop(),re.__STOP=!0)};for(const[i,r]of this.connectQueue.entries())this.connect(i,r);this.connectQueue.clear(),this.markDOMDirty(),K(this.computeRenderRangeAndEmit)}}instanceChanged(t,n){this.instancesChanged.add(t),n&&this.markDOMDirty(),K(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=Wt({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(t,n){const i=this.getScrollTop(),r=this.getHeight(),o=this.config.intersectionObserverMargin,s=i-o,l=i+r+o;return!(t<s-n||t>l)}handleContainerResize=t=>{if(this.root==null)return;let n=!1;for(const i of t){const r=i.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-lt,newSize:r}),lt=r)):i.target===this.root?r!==this.height&&(this.heightDirty=!0,n=!0):i.target===this.contentContainer&&(this.scrollHeightDirty=!0,n=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-lt,newSize:r}),lt=r))}n&&K(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new 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(t){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),t??=this.root.firstElementChild??void 0,t instanceof HTMLElement&&(this.contentContainer=t,this.resizeObserver?.observe(t))}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(t){return this.getScrollTop()+Ue(t,this.getScrollContainerElement())}connect(t,n){if(this.observers.has(t))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(t,n):(this.intersectionObserver.observe(t),this.observers.set(t,n),this.instancesChanged.add(n),this.markDOMDirty(),K(this.computeRenderRangeAndEmit)),()=>this.disconnect(t)}disconnect(t){const n=this.observers.get(t);this.connectQueue.delete(t),n!=null&&(this.intersectionObserver?.unobserve(t),this.observers.delete(t),this.visibleInstances.delete(t)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),K(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{re.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,K(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{re.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,K(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{re.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,K(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(re.__STOP)return;const 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){const o=Wt({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&rl(this.windowSpecs,o)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=o}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const i=this.getScrollAnchor(this.height),r=new Set;for(const o of t?this.observers.values():this.visibleInstances.values())o.onRender(t)&&r.add(o);for(const o of this.instancesChanged)r.has(o)||o.onRender(t)&&r.add(o);this.scrollFix(i);for(const o of r)o.reconcileHeights();n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&K(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(t){if(t==null)return;const n=this.getScrollContainerElement(),{lineIndex:i,lineOffset:r,fileElement:o,fileOffset:s,fileTypeOffset:l}=t;if(i!=null&&r!=null){const d=o.shadowRoot?.querySelector(`[data-line][data-line-index="${i}"]`);if(d instanceof HTMLElement){const h=Ue(d,n);if(h!==r){const c=h-r;this.applyScrollFix(c)}return}}const a=Ue(o,n);if(l==="top")a!==s&&this.applyScrollFix(a-s);else{const d=a+o.getBoundingClientRect().height;d!==s&&this.applyScrollFix(d-s)}}applyScrollFix(t){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+t,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+t,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(t){const n=this.getScrollContainerElement();let i;for(const[r]of this.visibleInstances.entries()){const o=Ue(r,n),s=o+r.offsetHeight;let l,a;s<=0?(l=s,a="bottom"):(l=o,a="top");let d,h;if(s>0&&o<t)for(const u of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(u instanceof HTMLElement))continue;const f=u.dataset.lineIndex;if(f==null)continue;const p=Ue(u,n);if(!(p<0)){d=f,h=p;break}}if(i?.lineOffset!=null&&h==null)continue;let c=!1;(i==null||h!=null&&(i.lineOffset==null||h<i.lineOffset)||h==null&&i.lineOffset==null&&(l>=0&&(i.fileOffset<0||l<i.fileOffset)||l<0&&i.fileOffset<0&&l>i.fileOffset))&&(c=!0),c&&(i={fileElement:r,fileTypeOffset:a,fileOffset:l,lineIndex:d,lineOffset:h})}return i}handleIntersectionChange=t=>{this.scrollDirty=!0;for(const{target:n,isIntersecting:i}of t){if(!(n instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(n);r!=null&&(i&&!this.visibleInstances.has(n)?(r.setVisibility(!0),this.visibleInstances.set(n,r),this.visibleInstancesDirty=!0):!i&&this.visibleInstances.has(n)&&(r.setVisibility(!1),this.visibleInstances.delete(n),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&K(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let t=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return t=Math.max(0,Math.min(t,this.getScrollHeight()-this.getHeight())),this.scrollTop=t,t}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 Ue(e,t){const n=e.getBoundingClientRect(),i=t?.getBoundingClientRect().top??0;return n.top-i}function Rl(e){const t=[];for(const n of e){const i=Ce.get(n);if(i==null)throw new Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(i)}return t}function Al(e){for(const t of Array.isArray(e)?e:[e])if(!Ce.has(t))return!1;return!0}function Hl(e,t,n=[]){if(e==="text"||e==="ansi")throw new Error("registerCustomLanguage: 'text' and 'ansi' are reserved language names");if(Gt.has(e)){console.error(`registerCustomLanguage: lang: ${e} is already registered`);return}Gt.set(e,t);for(const i of n)Po(i,e)}async function Ml(e){const t=[],n=[];for(const i of e){if(i==="text"||i==="ansi")continue;const r=Pi(i)??Di(i);"then"in r?n.push(r):t.push(r)}return n.length>0&&await Promise.all(n).then(i=>{for(const r of i){if(r==null)throw new Error("resolvedLanguages: unable to resolve language");t.push(r)}}),t}function Dl(e){return Y.getResolvedThemes(e)}function Pl(e,t,n=!1){const i=Ar({name:e,variablePrefix:_("global"),variableDefaults:t,fontStyle:n});Pr(e,()=>Promise.resolve(i))}async function Ol(e){for(const n of e)Oi(n);const t=await Y.resolveThemes(e);for(let n=0;n<e.length;n++)Ni(e[n],t[n]);return t}function Nl(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 Fl(e){const t=document.createElement("div");t.dataset.line=`${e}`;const n=document.createElement("div");n.dataset.columnNumber="",n.textContent=`${e}`;const i=document.createElement("div");return i.dataset.columnContent="",t.appendChild(n),t.appendChild(i),{row:t,content:i}}function zl(e,t=!1){return R({tagName:"style",children:[V(t?ts(e):pn(e))],properties:{[to]:t?"":void 0,[wi]:t?void 0:""}})}function Ul(e){return R({tagName:"style",children:[V(e)],properties:{[ki]:""}})}function Bl(e,t,n){const i=e.hunks[t];if(i==null)throw console.error({hunkIndex:t,diff:e}),new Error("diffAcceptRejectHunk: Invalid hunk index");return pr(e,{resolution:mr(n),hunkIndex:t,...typeof n=="object"?{startContentIndex:n.changeIndex,endContentIndex:n.changeIndex}:{startContentIndex:0,endContentIndex:Math.max(0,(i.hunkContent.length??1)-1)}})}function _l(e){return e.includes(`\r
|
|
1422
|
+
`)?"CRLF":e.includes("\r")?"CR":e.includes(`
|
|
1423
|
+
`)?"LF":"none"}function $l(e){const t=xs(e);if(t.length!==1)throw console.error(t),new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");const{files:n}=t[0];if(n.length!==1)throw console.error(n),new Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]}function Vl(e){const t=e[0];if(t!=="+"&&t!=="-"&&t!==" "&&t!=="\\"){console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);return}const n=e.substring(1);return{line:n===""?`
|
|
1424
|
+
`:n,type:t===" "?"context":t==="\\"?"metadata":t==="+"?"addition":"deletion"}}function Wl(e,t){return{...e,lang:t}}function Gl(e,t=10){const n=[];let i;for(const o of e.split(`
|
|
1425
|
+
`)){const s=o.match(Yr);if(s!=null){i!=null&&(i.hunkLines.length>0&&(dt(i,t,"trailing"),_t(i,n)),i=void 0);const l=parseInt(s[3]),a=parseInt(s[1]),d=parseInt(s[4]??"1"),h=parseInt(s[2]??"1");isNaN(l)||isNaN(a)||isNaN(d)||isNaN(h)?n.push(o):i={additionStart:l,deletionStart:a,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(i==null){n.push(o);continue}if(o.startsWith(" "))i.contextLines.push(o);else if(o!==""){if(i.hunkLines.length>0&&i.contextLines.length>t*2){const l=i.contextLines.length-t*2,a=i.contextLines.slice(-t);dt(i,t,"trailing");const{additionCount:d,deletionCount:h}=i;_t(i,n),i={additionStart:i.additionStart+d+l,deletionStart:i.deletionStart+h+l,deletionCount:0,additionCount:0,contextLines:a,hunkLines:[]}}dt(i,t,i.hunkLines.length===0?"leading":"before-change"),i.hunkLines.push(o),o.startsWith("+")?i.additionCount+=1:o.startsWith("-")&&(i.deletionCount+=1)}}i!=null&&i.hunkLines.length>0&&(dt(i,t,"trailing"),_t(i,n));const r=n.join(`
|
|
1426
|
+
`);return e.endsWith(`
|
|
1427
|
+
`)?`${r}
|
|
1428
|
+
`:r}function dt(e,t,n){if(n==="leading"&&e.contextLines.length>t){const i=e.contextLines.length-t;e.contextLines.splice(0,i),e.additionStart+=i,e.deletionStart+=i}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 _t(e,t){t.push(`@@ -${yi(e.deletionStart,e.deletionCount)} +${yi(e.additionStart,e.additionCount)} @@`),t.push(...e.hunkLines)}function yi(e,t){return t===1?`${e}`:`${e},${t}`}export{Zr as ALTERNATE_FILE_NAMES_GIT,ft as AttachedLanguages,gt as AttachedThemes,Kr as COMMIT_METADATA_SPLIT,to as CORE_CSS_ATTRIBUTE,sn as CUSTOM_HEADER_SLOT_ID,si as CodeToTokenTransformStream,wl as CodeView,Pe as DEFAULT_CODE_VIEW_FILE_METRICS,ro as DEFAULT_CODE_VIEW_LAYOUT,bl as DEFAULT_COLLAPSED_CONTEXT_THRESHOLD,so as DEFAULT_EXPANDED_REGION,Re as DEFAULT_RENDER_RANGE,oo as DEFAULT_SMOOTH_SCROLL_SETTINGS,P as DEFAULT_THEMES,io as DEFAULT_TOKENIZE_MAX_LENGTH,an as DEFAULT_VIRTUAL_FILE_METRICS,qr as DIFFS_DEVELOPMENT_BUILD,Ti as DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY,no as DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE,xi as DIFFS_TAG_NAME,lr as DiffHunksRenderer,Ei as EMPTY_RENDER_RANGE,Ne as EXTENSION_TO_FILE_FORMAT,Qr as FILENAME_HEADER_REGEX,Jr as FILENAME_HEADER_REGEX_GIT,ul as FILE_CONTEXT_BLOB,ss as File,dr as FileDiff,Qo as FileRenderer,Tl as FileStream,Li as GIT_DIFF_FILE_BREAK_REGEX,on as HEADER_METADATA_SLOT_ID,rn as HEADER_PREFIX_SLOT_ID,Yr as HUNK_HEADER,eo as INDEX_LINE_METADATA,Ai as InteractionManager,pl as MERGE_CONFLICT_BASE_MARKER_REGEX,ml as MERGE_CONFLICT_END_MARKER_REGEX,gl as MERGE_CONFLICT_SEPARATOR_MARKER_REGEX,fl as MERGE_CONFLICT_START_MARKER_REGEX,Gt as RegisteredCustomLanguages,Hi as ResizeManager,Ce as ResolvedLanguages,Tt as ResolvingLanguages,Xr as SPLIT_WITH_NEWLINES,Gi as SVGSpriteSheet,Ms as ScrollSyncManager,Aa as ShikiStreamTokenizer,ki as THEME_CSS_ATTRIBUTE,cl as UNIFIED_DIFF_FILE_BREAK_REGEX,wi as UNSAFE_CSS_ATTRIBUTE,El as UnresolvedFile,ps as VirtualizedFile,la as VirtualizedFileDiff,Il as Virtualizer,Xs as areDiffLineAnnotationsEqual,Fe as areDiffRenderOptionsEqual,_e as areDiffTargetsEqual,Oe as areFileRenderOptionsEqual,se as areFilesEqual,Qs as areHunkDataEqual,pt as areLanguagesAttached,Jo as areLineAnnotationsEqual,Ae as areObjectsEqual,ln as areOptionsEqual,ji as arePrePropertiesEqual,yt as areRenderRangesEqual,Vt as areSelectionsEqual,We as areThemesAttached,Me as areThemesEqual,rl as areVirtualWindowSpecsEqual,Nl as areWorkerStatsEqual,An as attachResolvedLanguages,Hn as attachResolvedThemes,ye as cleanLastNewline,ko as cleanUpResolvedLanguages,wo as cleanUpResolvedThemes,Kl as codeToHtml,jt as createAnnotationElement,un as createAnnotationWrapperNode,Ar as createCSSVariablesTheme,$n as createDiffSpanDecoration,nt as createEmptyRowBuffer,zi as createFileHeaderElement,G as createGutterGap,Ri as createGutterItem,qi as createGutterUtilityContentNode,co as createGutterUtilityElement,we as createGutterWrapper,R as createHastElement,ut as createIconElement,it as createNoNewlineElement,Ui as createPreElement,Do as createPreWrapperProperties,Fl as createRowNodes,Le as createSeparator,Ha as createSpanFromToken,zl as createStyleElement,V as createTextNodeElement,Ul as createThemeStyleElement,_i as createTransformerWithState,Ki as createUnsafeCSSStyleNode,Wt as createWindowFromScrollPosition,ao as dequeueRender,U as detachString,Bl as diffAcceptRejectHunk,yl as disposeHighlighter,ho as findCodeElement,_ as formatCSSVariablePrefix,kl as getCustomExtensionsMap,Ll as getCustomExtensionsVersion,X as getFiletypeFromFileName,Fi as getHighlighterIfLoaded,hn as getHighlighterOptions,cn as getHighlighterThemeStyles,Ds as getHunkSeparatorSlotName,Ao as getIconForType,pe as getLineAnnotationName,_l as getLineEndingType,qt as getLineNodes,Ge as getOrCreateCodeNode,Rl as getResolvedLanguages,Pi as getResolvedOrResolveLanguage,Eo as getResolvedOrResolveTheme,Dl as getResolvedThemes,St as getSharedHighlighter,$l as getSingularPatch,dn as getThemes,Ps as getTotalLineCountFromHunks,il as getUnresolvedDiffHunksRendererOptions,Al as hasResolvedLanguages,Ro as hasResolvedThemes,Os as isDefaultRenderRange,vl as isHighlighterLoaded,Io as isHighlighterLoading,Cl as isHighlighterNull,Mi as isWorkerContext,Zt as parseDiffFromFile,Vl as parseLineType,xs as parsePatchFiles,Qi as patchScrollbarGutterSize,qe as pluckInteractionOptions,lo as prefersReducedMotion,Sl as preloadHighlighter,Ji as prerenderHTMLIfNecessary,ys as processFile,Oo as processLine,Cs as processPatch,rt as pushOrJoinSpan,K as queueRender,Pl as registerCustomCSSVariableTheme,Hl as registerCustomLanguage,Pr as registerCustomTheme,Zi as releaseStringDetachBuffer,Ws as renderDiffWithHighlighter,Ko as renderFileWithHighlighter,xl as replaceCustomExtensions,Oa as resolveConflict,Di as resolveLanguage,Ml as resolveLanguages,pr as resolveRegion,To as resolveTheme,Ol as resolveThemes,Po as setCustomExtension,Wl as setLanguageOverride,mn as setPreNodeProperties,Gl as trimPatchContext,ts as wrapCoreCSS,gn as wrapThemeCSS,pn as wrapUnsafeCSS};
|