pulls.review 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client/assets/ActionButton-BYTohOMA.js +1 -0
- package/dist/client/assets/ActionIconButton-B2taMg1G.js +1 -0
- package/dist/client/assets/{ChatMessage-Ccffh_8Z.js → ChatMessage-BRtxpV-j.js} +44 -44
- package/dist/client/assets/ChatWidget-DGoJBAHG.js +1 -0
- package/dist/client/assets/{DisplayFileIcon-DWj5Zxib.js → DisplayFileIcon-CgcKzuIF.js} +3 -3
- package/dist/client/assets/LandingHero-BcDLrBWu.js +1 -0
- package/dist/client/assets/LocalAgentSettings-DnWX-4ja.js +1 -0
- package/dist/client/assets/MarkdownMermaid-CZsnBTo5.js +134 -0
- package/dist/client/assets/ModelPicker-DJOF4_oE.js +3 -0
- package/dist/client/assets/SelectViewport-CLu2vHZ1.js +1 -0
- package/dist/client/assets/_repo_-B9Xsfdgp.js +22 -0
- package/dist/client/assets/analyze-Dt4HsiiL.js +1 -0
- package/dist/client/assets/{core-messages-ClW97ZVa.js → core-messages-BKVsL0s6.js} +1 -1
- package/dist/client/assets/dark-BBICmi9u.js +1 -0
- package/dist/client/assets/de-X0_7KOpR.js +1 -0
- package/dist/client/assets/decode-BMLx_QAi.js +1 -0
- package/dist/client/assets/{diagnostics-wATZy2jc.js → diagnostics-FPncUZ9A.js} +1 -1
- package/dist/client/assets/diff-BVBdGkpM.js +37 -0
- package/dist/client/assets/diff-CNjyt43T.js +1 -0
- package/dist/client/assets/diffs-store-M5WP-Rye.js +1432 -0
- package/dist/client/assets/dist-B3ulq7dg.js +3 -0
- package/dist/client/assets/en-4wf48bhl.js +1 -0
- package/dist/client/assets/es-z_aJuLEM.js +1 -0
- package/dist/client/assets/fr-BSSnc845.js +1 -0
- package/dist/client/assets/glimmer-js-BheR6Tf0.js +1 -0
- package/dist/client/assets/glimmer-ts-B3Q3-uij.js +1 -0
- package/dist/client/assets/handlebars-qjPKy-PP.js +1 -0
- package/dist/client/assets/i18n-BaWfCCFj.js +2 -0
- package/dist/client/assets/id-DpmfJDwA.js +1 -0
- package/dist/client/assets/index-B346Vuj9.css +1 -0
- package/dist/client/assets/index-DAczNoU5.js +2 -0
- package/dist/client/assets/install-BtceKESn.js +4 -0
- package/dist/client/assets/it-DnvTXQOp.js +1 -0
- package/dist/client/assets/ja-EKD3f8pB.js +1 -0
- package/dist/client/assets/ko-3WANYsbE.js +1 -0
- package/dist/client/assets/llm-DwxQbGwE.js +88 -0
- package/dist/client/assets/llm-store-CBiRLoQj.js +1 -0
- package/dist/client/assets/local-agents-Bhc2OYII.js +1 -0
- package/dist/client/assets/pages-IPE7GMm2.js +1 -0
- package/dist/client/assets/pages-local-B-qUAdMG.js +1 -0
- package/dist/client/assets/pages-web-CV7QqqdA.js +21 -0
- package/dist/client/assets/portalTarget-DKryvPGY.js +1 -0
- package/dist/client/assets/pt-BR-BC7-mMJ3.js +1 -0
- package/dist/client/assets/rpc-backends-Bm_fmyjf.js +1 -0
- package/dist/client/assets/ru-ChI2XEFF.js +1 -0
- package/dist/client/assets/{ruby-CfFGiaYl.js → ruby-CaMjWH7T.js} +1 -1
- package/dist/client/assets/runtime-dom.esm-bundler-D9VhaAqy.js +2 -0
- package/dist/client/assets/{source-CvnvCX42.js → source-BWADV8Aq.js} +1 -1
- package/dist/client/assets/time-ago-CMSCAiQn.js +1 -0
- package/dist/client/assets/upload-riZ3DIfL.js +1 -0
- package/dist/client/assets/useCommitView-CgsbPEnq.js +1 -0
- package/dist/client/assets/useDocumentTitle-D1Q-0ufQ.js +92 -0
- package/dist/client/assets/useNonce-AntPf6d2.js +1 -0
- package/dist/client/assets/useTypeahead-DtM58Ahg.js +1 -0
- package/dist/client/assets/utils-DaMPgnza.js +1 -0
- package/dist/client/assets/vue-i18n-X72ILEtz.js +3 -0
- package/dist/client/assets/zh-CN-DXr4JfHY.js +1 -0
- package/dist/client/assets/zh-TW-CmCU_HxU.js +1 -0
- package/dist/client/index.html +9 -8
- package/dist/{devframe-DH2vpasJ.mjs → devframe-C2cyQ64F.mjs} +153 -6
- package/dist/devframe.mjs +1 -1
- package/dist/index.mjs +6 -2
- package/package.json +2 -2
- package/dist/client/assets/ActionButton-V4dY2wPS.js +0 -1
- package/dist/client/assets/ActionIconButton-4b5xelMn.js +0 -1
- package/dist/client/assets/ChatWidget-BFjNWi3R.js +0 -1
- package/dist/client/assets/GithubAvatar-DGJrpCsX.js +0 -1
- package/dist/client/assets/LandingHero-DWdx6_8g.js +0 -1
- package/dist/client/assets/LocalAgentSettings-COjAszEL.js +0 -1
- package/dist/client/assets/ModelPicker-CDTiUMZ3.js +0 -3
- package/dist/client/assets/SelectViewport-DF4P4Akh.js +0 -1
- package/dist/client/assets/_repo_-D3lApLQL.js +0 -22
- package/dist/client/assets/analyze-BgWIIbl3.js +0 -1
- package/dist/client/assets/de-BoIOg_UW.js +0 -1
- package/dist/client/assets/diff-CNRGXNmw.js +0 -1
- package/dist/client/assets/diff-Cx43r-a6.js +0 -37
- package/dist/client/assets/diffs-store-D3BzIMVi.js +0 -1431
- package/dist/client/assets/en-CbWYrCM5.js +0 -1
- package/dist/client/assets/es-CqEudTln.js +0 -1
- package/dist/client/assets/fr-qiQQ-4AO.js +0 -1
- package/dist/client/assets/i18n-Cx8anq4V.js +0 -2
- package/dist/client/assets/id-BkDzu8gq.js +0 -1
- package/dist/client/assets/index-De-UtOit.css +0 -1
- package/dist/client/assets/index-KDAJXf4E.js +0 -2
- package/dist/client/assets/install-D-S32JY7.js +0 -4
- package/dist/client/assets/it-tZZZbUKN.js +0 -1
- package/dist/client/assets/ja-kGPK4Fmt.js +0 -1
- package/dist/client/assets/ko-CULiae40.js +0 -1
- package/dist/client/assets/llm-Le5CPsNn.js +0 -88
- package/dist/client/assets/llm-store-CzMnTJNa.js +0 -1
- package/dist/client/assets/local-agents-BQLn-Ppw.js +0 -1
- package/dist/client/assets/pages-ByEfDjFa.js +0 -1
- package/dist/client/assets/pages-local-CVPpEWZ_.js +0 -1
- package/dist/client/assets/pages-web-BLxMupU5.js +0 -21
- package/dist/client/assets/portalTarget-DQg8GgWm.js +0 -1
- package/dist/client/assets/pt-BR-BcwoZLSs.js +0 -1
- package/dist/client/assets/rpc-backends-DYtuJyeF.js +0 -1
- package/dist/client/assets/ru-DOordgLF.js +0 -1
- package/dist/client/assets/runtime-dom.esm-bundler-Du_ZCcVN.js +0 -2
- package/dist/client/assets/time-ago-Bdao9Hh1.js +0 -1
- package/dist/client/assets/upload-DRO7bkBV.js +0 -1
- package/dist/client/assets/useDocumentTitle-BQJCa6Lm.js +0 -92
- package/dist/client/assets/useNonce-CwUrgryd.js +0 -1
- package/dist/client/assets/vue-i18n-CGHHpbTP.js +0 -5
- package/dist/client/assets/zh-CN-CmTqGY9s.js +0 -1
- package/dist/client/assets/zh-TW-DKGtbJQy.js +0 -1
|
@@ -1,1431 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ChatWidget-BFjNWi3R.js","./vue-i18n-CGHHpbTP.js","./runtime-dom.esm-bundler-Du_ZCcVN.js","./ActionButton-V4dY2wPS.js","./ActionIconButton-4b5xelMn.js","./floating-ui.dom-CfpSQvPs.js","./ChatMessage-Ccffh_8Z.js","./rolldown-runtime-Dd_uD5pT.js","./llm-store-CzMnTJNa.js","./i18n-Cx8anq4V.js","./locales-SpkpwNqX.js","./preload-helper-BaNbYf_w.js","./en-CbWYrCM5.js","./core-messages-ClW97ZVa.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{$ as t,At as n,Bt as r,Cr as i,Dr as a,Dt as o,Er as s,F as c,G as l,H as u,Hn as d,Ht as f,Jt as p,K as m,Kt as h,M as g,Pt as _,Q as v,Tt as y,U as b,W as x,Wn as S,Xt as C,bt as w,c as T,d as E,er as D,et as O,f as k,h as A,i as j,jn as M,l as N,mn as P,n as F,qn as I,qt as L,sn as ee,tt as R,un as te,xn as ne,yn as z,zn as re}from"./vue-i18n-CGHHpbTP.js";import{C as B,w as V,x as ie}from"./runtime-dom.esm-bundler-Du_ZCcVN.js";import{t as ae}from"./diagnostics-wATZy2jc.js";import{i as oe,n as H,t as se}from"./i18n-Cx8anq4V.js";import{T as ce,o as le,w as ue,y as de}from"./source-CvnvCX42.js";import{a as fe,i as pe,n as me,o as he,r as ge,t as _e}from"./analyze-BgWIIbl3.js";import{n as ve,o as ye}from"./llm-Le5CPsNn.js";import{i as be}from"./locales-SpkpwNqX.js";import{t as xe}from"./preload-helper-BaNbYf_w.js";import{$ as Se,B as Ce,G as we,H as Te,J as Ee,K as De,Q as Oe,U as ke,V as Ae,W as je,X as Me,Y as Ne,Z as Pe,a as Fe,at as Ie,b as Le,c as Re,d as ze,et as Be,f as Ve,g as He,h as Ue,i as We,it as Ge,l as Ke,m as qe,n as Je,nt as Ye,ot as Xe,q as Ze,r as Qe,rt as $e,s as et,tt,u as nt,z as rt}from"./useDocumentTitle-BQJCa6Lm.js";import{a as it,c as at,t as ot}from"./index-KDAJXf4E.js";import{t as U}from"./ActionButton-V4dY2wPS.js";import{n as st,t as W}from"./ActionIconButton-4b5xelMn.js";import{n as ct,t as lt}from"./ChatMessage-Ccffh_8Z.js";import{a as ut,c as dt,d as ft,i as pt,l as mt,n as ht,o as gt,r as _t,s as vt,t as yt,u as bt}from"./DisplayFileIcon-DWj5Zxib.js";import{n as xt}from"./core-messages-ClW97ZVa.js";import{n as St,t as Ct}from"./GithubAvatar-DGJrpCsX.js";var wt=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},Tt=new class extends wt{};function Et(e,t,n){return Tt.diff(e,t,n)}function Dt(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Ot(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function kt(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function At(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function jt(e,t){return kt(e,t,``)}function Mt(e,t){return At(e,t,``)}function Nt(e,t){return t.slice(0,Pt(e,t))}function Pt(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Ft(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function It(e,t){if(t)return Rt(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Lt(e,t){if(t)return Rt(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Rt(e,t){if(!t)return[Lt(e),It(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Ft(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var zt=`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}`,Bt=RegExp(`[${zt}]+|\\s+|[^${zt}]`,`ug`);new class extends wt{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Ft(e,r)}else n=e.match(Bt)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Vt(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Vt(n,i,r,null,t.intlSegmenter),e}};function Vt(e,t,n,r,i){if(t&&n){let[a,o]=Rt(t.value,i),[s,c]=Rt(n.value,i);if(e){let r=Dt(a,s);e.value=At(e.value,s,r),t.value=jt(t.value,r),n.value=jt(n.value,r)}if(r){let e=Ot(o,c);r.value=kt(r.value,c,e),t.value=Mt(t.value,e),n.value=Mt(n.value,e)}}else if(n){if(e){let e=Lt(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Lt(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Lt(r.value,i),[a,o]=Rt(t.value,i),s=Dt(n,a);t.value=jt(t.value,s);let c=Ot(jt(n,s),o);t.value=Mt(t.value,c),r.value=kt(r.value,n,c),e.value=At(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Lt(r.value,i),n=Nt(It(t.value,i),e);t.value=Mt(t.value,n)}else if(e){let n=Nt(It(e.value,i),Lt(t.value,i));t.value=jt(t.value,n)}}var Ht=new class extends wt{tokenize(e){let t=RegExp(`(\\r?\\n)|[${zt}]+|[^\\S\\n\\r]+|[^${zt}]`,`ug`);return e.match(t)||[]}};function Ut(e,t,n){return Ht.diff(e,t,n)}var Wt=new class extends wt{constructor(){super(...arguments),this.tokenize=Kt}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
3
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
4
|
-
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
5
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
6
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Gt(e,t,n){return Wt.diff(e,t,n)}function Kt(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
7
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function qt(e){return e==`.`||e==`!`||e==`?`}new class extends wt{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(qt(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends wt{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends wt{constructor(){super(...arguments),this.tokenize=Kt}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Jt(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Jt(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Jt(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Jt(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends wt{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Yt(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Xt(e){if(!Yt(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Zt={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Qt(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Gt(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Gt(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||tn(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
|
|
8
|
-
`)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function $t(e,t){if(t||=Zt,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw 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(e=>$t(e,t)).join(`
|
|
9
|
-
`)}let n=[];if(e.isGit){if(t=Zt,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Xt(r)+` `+Xt(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Xt((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Xt((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Xt((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Xt((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Xt(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Xt(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
|
|
10
|
-
`)+`
|
|
11
|
-
`}function en(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Qt(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?$t(e,o.headerOptions):void 0)}}))}else{let s=Qt(e,t,n,r,i,a,o);return s?$t(s,o?.headerOptions):void 0}}function tn(e){let t=e.endsWith(`
|
|
12
|
-
`),n=e.split(`
|
|
13
|
-
`).map(e=>e+`
|
|
14
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function nn(e,t,n){if(e==null)return``;let r,i={},a={},o=``,s=``,c=``,l=2,u=3,d=2,f=[],p=0,m=0;for(let h=0;h<e.length;h+=1)if(o=e.charAt(h),Object.prototype.hasOwnProperty.call(i,o)||(i[o]=u++,a[o]=!0),s=c+o,Object.prototype.hasOwnProperty.call(i,s))c=s;else{if(Object.prototype.hasOwnProperty.call(a,c)){if(c.charCodeAt(0)<256){for(let e=0;e<d;e++)p<<=1,m==t-1?(m=0,f.push(n(p)),p=0):m++;r=c.charCodeAt(0);for(let e=0;e<8;e++)p=p<<1|r&1,m==t-1?(m=0,f.push(n(p)),p=0):m++,r>>=1}else{r=1;for(let e=0;e<d;e++)p=p<<1|r,m==t-1?(m=0,f.push(n(p)),p=0):m++,r=0;r=c.charCodeAt(0);for(let e=0;e<16;e++)p=p<<1|r&1,m==t-1?(m=0,f.push(n(p)),p=0):m++,r>>=1}l--,l==0&&(l=2**d,d++),delete a[c]}else{r=i[c];for(let e=0;e<d;e++)p=p<<1|r&1,m==t-1?(m=0,f.push(n(p)),p=0):m++,r>>=1}l--,l==0&&(l=2**d,d++),i[s]=u++,c=String(o)}if(c!==``){if(Object.prototype.hasOwnProperty.call(a,c)){if(c.charCodeAt(0)<256){for(let e=0;e<d;e++)p<<=1,m==t-1?(m=0,f.push(n(p)),p=0):m++;r=c.charCodeAt(0);for(let e=0;e<8;e++)p=p<<1|r&1,m==t-1?(m=0,f.push(n(p)),p=0):m++,r>>=1}else{r=1;for(let e=0;e<d;e++)p=p<<1|r,m==t-1?(m=0,f.push(n(p)),p=0):m++,r=0;r=c.charCodeAt(0);for(let e=0;e<16;e++)p=p<<1|r&1,m==t-1?(m=0,f.push(n(p)),p=0):m++,r>>=1}l--,l==0&&(l=2**d,d++),delete a[c]}else{r=i[c];for(let e=0;e<d;e++)p=p<<1|r&1,m==t-1?(m=0,f.push(n(p)),p=0):m++,r>>=1}l--,l==0&&(l=2**d,d++)}r=2;for(let e=0;e<d;e++)p=p<<1|r&1,m==t-1?(m=0,f.push(n(p)),p=0):m++,r>>=1;let h=!0;do p<<=1,m==t-1?(f.push(n(p)),h=!1):m++;while(h);return f.join(``)}function rn(e,t,n){let r=[],i=[],a={val:n(0),position:t,index:1},o=4,s=4,c=3,l=``,u,d=0,f=4,p=1;for(let e=0;e<3;e+=1)r[e]=String(e);for(;p!=f;){let e=a.val&a.position;a.position>>=1,a.position==0&&(a.position=t,a.val=n(a.index++)),d|=+(e>0)*p,p<<=1}switch(d){case 0:for(d=0,f=256,p=1;p!=f;){let e=a.val&a.position;a.position>>=1,a.position==0&&(a.position=t,a.val=n(a.index++)),d|=+(e>0)*p,p<<=1}u=String.fromCharCode(d);break;case 1:for(d=0,f=2**16,p=1;p!=f;){let e=a.val&a.position;a.position>>=1,a.position==0&&(a.position=t,a.val=n(a.index++)),d|=+(e>0)*p,p<<=1}u=String.fromCharCode(d);break;case 2:return``}if(u===void 0)throw Error(`No character found`);r[3]=String(u);let m=String(u);for(i.push(String(u));;){if(a.index>e)return``;for(d=0,f=2**c,p=1;p!=f;){let e=a.val&a.position;a.position>>=1,a.position==0&&(a.position=t,a.val=n(a.index++)),d|=+(e>0)*p,p<<=1}switch(u=d){case 0:for(d=0,f=256,p=1;p!=f;){let e=a.val&a.position;a.position>>=1,a.position==0&&(a.position=t,a.val=n(a.index++)),d|=+(e>0)*p,p<<=1}r[s++]=String.fromCharCode(d),u=s-1,o--;break;case 1:for(d=0,f=2**16,p=1;p!=f;){let e=a.val&a.position;a.position>>=1,a.position==0&&(a.position=t,a.val=n(a.index++)),d|=+(e>0)*p,p<<=1}r[s++]=String.fromCharCode(d),u=s-1,o--;break;case 2:return i.join(``)}if(o==0&&(o=2**c,c++),r[u])l=String(r[u]);else if(u===s)l=m+m.charAt(0);else return null;i.push(l),r[s++]=m+l.charAt(0),o--,m=l,o==0&&(o=2**c,c++)}}var an=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`;function on(e){if(e==null)return``;let t=nn(e,6,e=>an.charAt(e));switch(t.length%4){default:case 0:return t;case 1:return t+`===`;case 2:return t+`==`;case 3:return t+`=`}}var sn={};function cn(e,t){if(!sn[e]){sn[e]={};for(let t=0;t<e.length;t++)sn[e][e.charAt(t)]=t}return sn[e][t]}function ln(e){return e==null?``:e==``?null:rn(e.length,32,t=>cn(an,e.charAt(t)))}var un=de({headSha:ce(),result:le}),dn=`https://pulls.review`,fn=`<!-- pulls.review data -->`,pn=6e4;function mn(e){return e.replace(`T`,` `).slice(0,16)}function hn(e,t){return t?["```lz-string",on(JSON.stringify(e)),"```"].join(`
|
|
15
|
-
`):["```json",JSON.stringify(e,null,2),"```"].join(`
|
|
16
|
-
`)}function gn(e,t,n){let{result:r}=n,i=`${dn}/gh/${e.owner}/${e.repo}/${e.number}?from=${t}`,a=e=>[fn,`👁️🗨️ Review this pull request with grouped, summarized diffs at:`,`👉 ${i}`,``,`<details><summary>raw result</summary>`,``,`<br>`,``,`💭 analyzed by \`${r.model??r.source}\``,`🕰️ ${mn(r.generatedAt)} UTC`,`🔗 head ${n.headSha.slice(0,7)}`,`🤖 automated by [pulls.review](${dn})`,``,hn(n,e),``,`</details>`,``].join(`
|
|
17
|
-
`),o=a(!1);if(o.length<=pn)return o;let s=a(!0);if(s.length>pn)throw ae.commentTooLarge({n:s.length});return s}function _n(e){if(!e.startsWith(fn))return;let t=e.match(/```(json|lz-string)\n([\s\S]*?)\n```/);if(t)try{let e=t[1]===`lz-string`?ln(t[2]):t[2];if(!e)return;let n=ue(un,JSON.parse(e));return n.success?n.output:void 0}catch{return}}async function vn(e,t){return(await(await e.request(`/repos/${t.owner}/${t.repo}/issues/${t.number}/comments?per_page=100`)).json()).flatMap(e=>{let t=_n(e.body);return t&&e.user?[{id:e.id,login:e.user.login,url:e.html_url,updatedAt:e.updated_at,analysis:t}]:[]}).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}async function yn(e,t,n){let r=await(await e.request(`/repos/${t.owner}/${t.repo}/issues/${t.number}/comments`,{method:`POST`,body:{body:n}})).json();return{id:r.id,url:r.html_url}}async function bn(e,t,n,r){let i=await(await e.request(`/repos/${t.owner}/${t.repo}/issues/comments/${n}`,{method:`PATCH`,body:{body:r}})).json();return{id:i.id,url:i.html_url}}var xn=new Set,Sn=null;function G(e){xn.add(e),Sn??=requestAnimationFrame(wn)}function Cn(e){xn.delete(e)&&xn.size===0&&Sn!=null&&(cancelAnimationFrame(Sn),Sn=null)}function wn(e){let t=new Set(xn);xn.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}Sn=xn.size>0?requestAnimationFrame(wn):null}function Tn(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function En(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Dn(e,t){let n=e?.theme??Te,r=t?.theme??Te,i=On(e),a=On(t);return En(n,r)&&Tn(e,t,[`theme`,`parseDiffOptions`])&&Tn(i,a)}function On(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function kn(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function An({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function K(e){return{type:`text`,value:e}}function q({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function jn({name:e,width:t=16,height:n=16,properties:r}){return q({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[q({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Mn(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function Nn(e){return q({tagName:`div`,properties:{"data-gutter":``},children:e})}function Pn(e,t,n,r={}){return q({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[q({tagName:`span`,properties:{"data-line-number-content":``},children:[K(`${t}`)]})]})}function J(e,t,n){return q({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Fn(){return q({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[jn({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function In(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ln(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var Rn=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),Cn(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||kn(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Ln(e.composedPath())||(ir(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(ir(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(ir(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){ir(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();ir(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);ir(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Un(i)&&this.hoveredLine?.lineElement===i.lineElement;Hn(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Hn(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Un(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Gn(i)&&p!=null){p(i);break}if(Wn(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Un(i))break;Hn(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,ir(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),ir(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),ir(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Ln(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(In(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=bt(Fn());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Vn(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Jn(t));if(Vn(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Vn(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Vn(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Ln(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Jn(e);if(t&&Ln(n))return;let r=Yn(e);return r==null?this.pathFromAnnotationSlot(e):Jn(r)}pathFromAnnotationSlot(e){let t=Xn(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Jn(t);let n=Qn(Zn(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Jn(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=$n(t)?t:$n(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}kn(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,G(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{Cn(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!tr(this.renderedSelectedLinesState,n),i=!tr(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Kn(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=rr(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=rr(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:qn(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:qn(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:nr(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:nr(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function zn({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Bn({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Bn({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Vn(e){return e!=null&&`kind`in e&&e.kind===`line`}function Hn(e){return e!=null&&`kind`in e&&e.kind===`token`}function Un(e){return Vn(e)||Hn(e)}function Wn(e){return`type`in e&&e.type===`line-info`}function Gn(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Kn(e){return e===`current`||e===`incoming`||e===`both`}function qn(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Jn(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Yn(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Xn(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function Zn(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Qn(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function $n(e){return e!=null&&typeof e.elementFromPoint==`function`}function er(e,t){return e===t||kn(e??void 0,t??void 0)}function tr(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&er(e?.range??null,t.range)}function nr(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function rr(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function ir(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}console.log(...n)}var ar=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),cr(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?dr(t):fr(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:or(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:sr(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&lr(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function or(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function sr(e){return Math.max(Math.ceil(e),0)}function cr(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?lr(e,{codeWidthChanged:!0,numberWidthChanged:!0}):ur(e))}function lr(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function ur(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function dr(e){e.codeElement.isConnected&&ur(e)}function fr(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function pr(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 mr(e){return q({tagName:`div`,children:[q({tagName:`div`,children:e.annotations?.map(e=>q({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function hr(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 gr({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return q({tagName:`div`,children:[t===`custom`?q({tagName:`slot`,properties:{name:rt}}):_r({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[vr(r)]],properties:i})}function _r({name:e,prevName:t,iconType:n}){let r=[q({tagName:`slot`,properties:{name:Se}}),jn({name:hr(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[K(t)]})],properties:{"data-prev-name":``}})),r.push(jn({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[K(e)]})],properties:{"data-title":``}})),r.push(q({tagName:`slot`,properties:{name:Pe}})),q({tagName:`div`,children:r,properties:{"data-header-content":``}})}function vr(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(q({tagName:`span`,children:[K(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(q({tagName:`span`,children:[K(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(q({tagName:`slot`,properties:{name:Oe}})),q({tagName:`div`,children:t,properties:{"data-metadata":``}})}function yr(e){return q({tagName:`pre`,properties:br(e)})}function br({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var xr=new Map,Sr={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Cr(e){if(xr.has(e))return xr.get(e)??`text`;if(Sr[e]!=null)return Sr[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(xr.has(t[1]))return xr.get(t[1])??`text`;if(Sr[t[1]]!=null)return Sr[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return xr.has(n)?xr.get(n)??`text`:Sr[n]??`text`}function wr(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:Array.isArray(e)?e:[e??`text`],themes:mt(t),preferredHighlighter:n}}function Tr(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Er(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Dr(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(K(`
|
|
18
|
-
`)),e}var Or=Symbol(`no-token`),kr=Symbol(`multiple-tokens`);function Ar(e){let t=jr(e);if(t!=null)return t;let n=Or,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Nr(e,a);for(let t of e.children)Mr(t)}else Mr(e);r.push(e),i=[],a=void 0;return}for(let e of i)Mr(e);r.push(q({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Or){if(e===kr){n=kr;return}if(n===Or){n=e;return}n!==e&&(n=kr)}};for(let t of e.children){let e=t.type===`element`?Ar(t):Or;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function jr(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Mr(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Mr(t)}}function Nr(e,t){e.properties[`data-char`]=t}function Pr(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+Fr(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Fr(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Ir(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=Mn(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Ar(a),i.push(Dr(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Rr,Lr),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Lr}}var Lr=Pr({classPrefix:`hl-`}),Rr={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Y(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var zr=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Br=/^0(?:\.0+)?%?$/;function Vr(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Hr(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Ur(e){if(e==null)return null;let t=Hr(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Wr(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||zr.test(t))return!0;let n=Vr(t);return n!=null&&Br.test(n)}function Gr(e,t,n){if(t==null||n==null)return!1;let r=Ur(e),i=Ur(t),a=Ur(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Kr=new WeakMap;function qr(e){let t=Kr.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;Jr(r,`editor.background`,i),Jr(r,`editor.foreground`,a),Jr(r,`sideBar.background`,o),Jr(r,`sideBar.foreground`,s),Jr(r,`input.background`,n[`input.background`]??o),Jr(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),Jr(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),Jr(r,`gitDecoration.addedResourceForeground`,Yr(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),Jr(r,`gitDecoration.modifiedResourceForeground`,Yr(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),Jr(r,`gitDecoration.deletedResourceForeground`,Yr(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Wr(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Wr(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Xr(l,o)||Gr(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Kr.set(e,u),u}function Jr(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Yr(...e){for(let t of e)if(t!=null&&t!==``)return t}function Xr(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Zr({theme:e=Te,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=qr(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Y(`global`)}fg:${a.fg};`,r+=`${Y(`global`)}bg:${a.bg};`,r+=Qr(i,n)}else{let n=t.getTheme(e.dark),i=qr(n);r+=`${Y(`global`)}dark:${i.fg};`,r+=`${Y(`global`)}dark-bg:${i.bg};`,r+=Qr(n,`dark`),n=t.getTheme(e.light),i=qr(n),r+=`${Y(`global`)}light:${i.fg};`,r+=`${Y(`global`)}light-bg:${i.bg};`,r+=Qr(n,`light`)}return r}function Qr(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Y(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Y(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Y(`global`)}${t}modified-color:${a};`),n}function $r(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function ei(e,t){for(let n of t)e.push(n)}var ti=`-1,-1`;function ni(e){return e?.some(e=>e.lineNumber===0)??!1}function ri(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function ii(e){return e.startingLine===0&&e.totalLines>0}function ai(e,t){return e.endsWith(`\r
|
|
19
|
-
`)?t+`\r
|
|
20
|
-
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
21
|
-
`)?t+`
|
|
22
|
-
`:t}function oi(e,t){return q({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}var si=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
23
|
-
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
24
|
-
<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"/>
|
|
25
|
-
</symbol>
|
|
26
|
-
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
27
|
-
<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"/>
|
|
28
|
-
</symbol>
|
|
29
|
-
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
30
|
-
<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"/>
|
|
31
|
-
</symbol>
|
|
32
|
-
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
33
|
-
<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"/>
|
|
34
|
-
</symbol>
|
|
35
|
-
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
36
|
-
<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"/>
|
|
37
|
-
</symbol>
|
|
38
|
-
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
39
|
-
<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"/>
|
|
40
|
-
</symbol>
|
|
41
|
-
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
42
|
-
<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"/>
|
|
43
|
-
</symbol>
|
|
44
|
-
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
45
|
-
<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"/>
|
|
46
|
-
</symbol>
|
|
47
|
-
<symbol id="diffs-icon-eye-slash" viewBox="0 0 16 16">
|
|
48
|
-
<path d="m13.47 1.47-12 12 1.06 1.06 12-12zM8 14c-.92 0-1.802-.208-2.624-.547l1.173-1.174c.476.142.963.221 1.451.221 1.66 0 3.307-.949 4.626-2.196a10.4 10.4 0 0 0 1.494-1.751A5 5 0 0 0 14.443 8a5 5 0 0 0-.323-.553 10 10 0 0 0-1.238-1.5l1.061-1.062C15.222 6.173 16 7.511 16 8c0 1.05-3.582 6-8 6"/><path d="M8 11q-.084 0-.167-.005l3.162-3.162q.006.083.005.167a3 3 0 0 1-3 3M5.005 8.167l3.162-3.162a3 3 0 0 0-3.162 3.162"/><path d="M8 3.5c.485 0 .97.081 1.445.227l1.168-1.169C9.794 2.212 8.915 2 8 2 3.582 2 0 6.8 0 8c0 .555.766 1.88 2.027 3.144l1.06-1.06a9.5 9.5 0 0 1-1.203-1.461 4.3 4.3 0 0 1-.345-.617L1.536 8l.003-.006c.064-.149.176-.359.345-.617a9.8 9.8 0 0 1 1.482-1.73C4.675 4.427 6.326 3.5 8 3.5"/>
|
|
49
|
-
</symbol>
|
|
50
|
-
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
51
|
-
<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"/>
|
|
52
|
-
</symbol>
|
|
53
|
-
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
54
|
-
<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"/>
|
|
55
|
-
</symbol>
|
|
56
|
-
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
57
|
-
<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"/>
|
|
58
|
-
</symbol>
|
|
59
|
-
<symbol id="diffs-icon-symbol-added-duo" viewBox="0 0 16 16">
|
|
60
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
|
|
61
|
-
</symbol>
|
|
62
|
-
<symbol id="diffs-icon-symbol-added-fill" viewBox="0 0 16 16">
|
|
63
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 4a.75.75 0 0 0-.75.75v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5A.75.75 0 0 0 8 4" clip-rule="evenodd"/>
|
|
64
|
-
</symbol>
|
|
65
|
-
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
66
|
-
<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"/>
|
|
67
|
-
</symbol>
|
|
68
|
-
<symbol id="diffs-icon-symbol-deleted-duo" viewBox="0 0 16 16">
|
|
69
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
|
|
70
|
-
</symbol>
|
|
71
|
-
<symbol id="diffs-icon-symbol-deleted-fill" viewBox="0 0 16 16">
|
|
72
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M4.75 7.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
|
|
73
|
-
</symbol>
|
|
74
|
-
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
75
|
-
<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"/>
|
|
76
|
-
</symbol>
|
|
77
|
-
<symbol id="diffs-icon-symbol-diffstat-duo" viewBox="0 0 16 16">
|
|
78
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
|
|
79
|
-
</symbol>
|
|
80
|
-
<symbol id="diffs-icon-symbol-diffstat-fill" viewBox="0 0 16 16">
|
|
81
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5zM8 3.546a.75.75 0 0 0-.75.75V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2V4.296a.75.75 0 0 0-.75-.75" clip-rule="evenodd"/>
|
|
82
|
-
</symbol>
|
|
83
|
-
<symbol id="diffs-icon-symbol-extracted" viewBox="0 0 16 16">
|
|
84
|
-
<path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/><path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 1.5c-1.613 0-2.807.089-3.704.288-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288s2.807-.089 3.704-.288c.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5" clip-rule="evenodd"/>
|
|
85
|
-
</symbol>
|
|
86
|
-
<symbol id="diffs-icon-symbol-extracted-duo" viewBox="0 0 16 16">
|
|
87
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8" clip-rule="evenodd" opacity=".2"/><path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/>
|
|
88
|
-
</symbol>
|
|
89
|
-
<symbol id="diffs-icon-symbol-extracted-fill" viewBox="0 0 16 16">
|
|
90
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5 4.25a.75.75 0 0 0-.75.75v3.25a.75.75 0 0 0 1.5 0V6.81l3.302 3.302a1.5 1.5 0 1 0 1.06-1.06L6.811 5.75H8.25a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
|
|
91
|
-
</symbol>
|
|
92
|
-
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
93
|
-
<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"/>
|
|
94
|
-
</symbol>
|
|
95
|
-
<symbol id="diffs-icon-symbol-ignored-duo" viewBox="0 0 16 16">
|
|
96
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11.53 4.47a.75.75 0 0 1 0 1.06l-6 6a.75.75 0 0 1-1.06-1.06l6-6a.75.75 0 0 1 1.06 0"/>
|
|
97
|
-
</symbol>
|
|
98
|
-
<symbol id="diffs-icon-symbol-ignored-fill" viewBox="0 0 16 16">
|
|
99
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m3.53 4.47a.75.75 0 0 0-1.06 0l-6 6a.75.75 0 1 0 1.06 1.06l6-6a.75.75 0 0 0 0-1.06" clip-rule="evenodd"/>
|
|
100
|
-
</symbol>
|
|
101
|
-
<symbol id="diffs-icon-symbol-inlined" viewBox="0 0 16 16">
|
|
102
|
-
<path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/><path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8m0-1.5c1.613 0 2.807-.089 3.704-.288.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5s-2.807.089-3.704.288c-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288" clip-rule="evenodd"/>
|
|
103
|
-
</symbol>
|
|
104
|
-
<symbol id="diffs-icon-symbol-inlined-duo" viewBox="0 0 16 16">
|
|
105
|
-
<path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8" clip-rule="evenodd" opacity=".2"/><path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/>
|
|
106
|
-
</symbol>
|
|
107
|
-
<symbol id="diffs-icon-symbol-inlined-fill" viewBox="0 0 16 16">
|
|
108
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.5 4a1.5 1.5 0 1 0 .388 2.948l3.301 3.302H7.75a.75.75 0 0 0 0 1.5H11a.75.75 0 0 0 .75-.75V7.75a.75.75 0 0 0-1.5 0v1.44L6.948 5.887A1.5 1.5 0 0 0 5.5 4" clip-rule="evenodd"/>
|
|
109
|
-
</symbol>
|
|
110
|
-
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
111
|
-
<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"/>
|
|
112
|
-
</symbol>
|
|
113
|
-
<symbol id="diffs-icon-symbol-modified-duo" viewBox="0 0 16 16">
|
|
114
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0"/>
|
|
115
|
-
</symbol>
|
|
116
|
-
<symbol id="diffs-icon-symbol-modified-fill" viewBox="0 0 16 16">
|
|
117
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 5a3 3 0 1 0 0 6 3 3 0 0 0 0-6" clip-rule="evenodd"/>
|
|
118
|
-
</symbol>
|
|
119
|
-
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
120
|
-
<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"/>
|
|
121
|
-
</symbol>
|
|
122
|
-
<symbol id="diffs-icon-symbol-moved-duo" viewBox="0 0 16 16">
|
|
123
|
-
<path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8.496 4.695a.75.75 0 0 0-.051 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-.051 1.06L6.49 8.003 4.693 9.998a.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"/>
|
|
124
|
-
</symbol>
|
|
125
|
-
<symbol id="diffs-icon-symbol-moved-fill" viewBox="0 0 16 16">
|
|
126
|
-
<path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m1.555 4.745a.75.75 0 0 0-1.11 1.01L10.486 8l-2.04 2.245a.75.75 0 0 0 1.109 1.01l2.5-2.75a.75.75 0 0 0 0-1.01zm-4 0a.75.75 0 0 0-1.11 1.01l2.043 2.248-1.796 1.995a.75.75 0 0 0 1.116 1.004l2.25-2.5a.75.75 0 0 0-.003-1.007z" clip-rule="evenodd"/>
|
|
127
|
-
</symbol>
|
|
128
|
-
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
129
|
-
<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"/>
|
|
130
|
-
</symbol>
|
|
131
|
-
</svg>`;function ci(e,t){return e==null||t==null?e===t:ui(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var li={};function ui(e=li,t=li){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function di(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function fi(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function pi(){let e=document.createElement(`style`);return e.setAttribute($e,``),e}var mi=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;--diffs-warning-light:#d5a910;--diffs-warning-dark:#ffd452;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--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))));--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))));--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))));--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))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--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))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--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)))));--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)))));--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)))));--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))));--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)));--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))));--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)));--diffs-selection-base:var(--diffs-modified-base);--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)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}input,button{font-family:inherit;font-size:inherit;line-height:inherit}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr;&[data-dehydrated]{--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}&:hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span,[data-edit-prediction-suffix] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit));font-weight:light-dark(var(--diffs-token-light-font-weight,inherit),var(--diffs-token-dark-font-weight,inherit));font-style:light-dark(var(--diffs-token-light-font-style,inherit),var(--diffs-token-dark-font-style,inherit));text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions],[data-editor-overlay]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-computed-editor-active-line-bg:var(--diffs-computed-selected-line-bg);--diffs-computed-hovered-line-bg:var(--diffs-computed-editor-active-line-bg);--diffs-hover-mix-target:var(--diffs-bg-hover-override,var(--diffs-mixer));--diffs-line-bg:var(--diffs-computed-hovered-line-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}[data-line],[data-no-newline]{&[data-decoration-bg]{--mix-deco-light:92%;--mix-deco-dark:85%;&[data-decoration-bg-depth="2"]{--mix-deco-light:88%;--mix-deco-dark:80%}&[data-decoration-bg-depth="3"]{--mix-deco-light:85%;--mix-deco-dark:78%}--diffs-hover-mix-target:var(--diffs-decoration-bg);--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)))}}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[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]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}:where([data-background]){& [data-gutter-buffer],& [data-column-number]{--mix-light:91%;--mix-dark:85%}& [data-line],& [data-no-newline]{--mix-light:88%;--mix-dark:80%}& [data-gutter-buffer],& [data-column-number],& [data-line],& [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg);&[data-line-type=change-deletion]{--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-line-type=change-addition]{--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=current]{--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=incoming]{--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}}}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline],[data-editor-overlay]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base));--diffs-selection-emphasis-mix-target:var(--diffs-selection-mix-target);&:where([data-editor-overlay]),&:where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline])[data-selected-line]{--mix-selection-light:82%;--mix-selection-dark:75%;--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line])){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base));--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-line][data-selected-line]):is([data-line-type=change-addition],[data-line-type=change-deletion]){--diffs-selection-emphasis-mix-target:light-dark(color-mix(in lab, var(--diffs-diff-line-mix-target,var(--diffs-selection-mix-target)) var(--mix-selection-light), var(--diffs-selection-mix-target)),var(--diffs-selection-mix-target))}&:where([data-editor-overlay]),&[data-selected-line]{--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)))}}[data-line][data-editor-active-line],[data-column-number][data-editor-active-line]{--diffs-computed-editor-active-line-bg:color-mix(in lab, var(--diffs-computed-selected-line-bg) var(--diffs-editor-active-line-source-mix,100%), var(--diffs-selection-emphasis-mix-target))}@media (pointer:fine){[data-line][data-hovered],[data-gutter-buffer][data-hovered],[data-column-number][data-hovered],[data-line-annotation][data-hovered],[data-no-newline][data-hovered],[data-merge-conflict][data-hovered],[data-merge-conflict-actions][data-hovered],[data-editor-overlay][data-hovered]{--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 97%, var(--diffs-hover-mix-target)),color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 91%, var(--diffs-hover-mix-target)))}}[data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line]){color:var(--diffs-selection-number-fg)}[data-no-newline]{user-select:none;& span{opacity:.6}}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid;& [data-additions]{border-left:1px solid var(--diffs-bg)}& [data-deletions]{border-right:1px solid var(--diffs-bg)}}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}[data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]{& [data-code],&[data-overflow=wrap],&[data-dehydrated][data-diff-type=split][data-overflow=scroll]{padding-top:0}}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative;& [data-gutter-buffer],& [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-diff-type=split][data-overflow=wrap],[data-dehydrated][data-diff-type=split][data-overflow=scroll]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid;& [data-code]{display:contents}& [data-deletions]{& [data-gutter]{grid-column:1}& [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}}& [data-additions]{& [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}& [data-content]{grid-column:4}}}[data-dehydrated][data-diff-type=split][data-overflow=scroll] [data-content]{overflow:clip}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch;&:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent calc(3px * 1.414), var(--diffs-bg-buffer) calc(3px * 1.414), var(--diffs-bg-buffer) calc(4px * 1.414));grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback));& [data-separator-wrapper]{min-width:16px}}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch;&:hover{color:var(--diffs-fg)}&[data-expand-all-button]{display:none}}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-content]{user-select:none;height:100%;overflow:clip}}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified]{& [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi;& [data-separator-content]{border-radius:6px}}& [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-gutter]{& [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}& [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-additions]{& [data-content] [data-separator=line-info]{background-color:var(--diffs-bg);& [data-separator-wrapper]{display:none}}& [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block;& [data-separator-content],& [data-expand-button]{display:none}}}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block;& [data-separator-content],& [data-expand-button]{display:none}}[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}}@media (pointer:fine){[data-separator=line-info] [data-separator-wrapper]{&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}& [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto;& [data-separator-content]{grid-column:unset;grid-row:unset}}@supports (width:1cqi){[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid;& [data-separator-content]{grid-area:1/2/-1;min-width:min-content}& [data-expand-button]{grid-column:1}}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-multi-button]{& [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}& [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}[data-indicators=classic]{& [data-line-type=change-addition],& [data-line-type=change-deletion]{&[data-no-newline],&[data-line]{&:before{user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}}}& [data-line-type=change-addition]{&[data-line],&[data-no-newline]{&:before{content:"+";color:var(--diffs-addition-base)}}}& [data-line-type=change-deletion]{&[data-line],&[data-no-newline]{&:before{content:"-";color:var(--diffs-deletion-base)}}}}[data-indicators=bars]{& [data-line-type=change-deletion],& [data-line-type=change-addition]{&[data-column-number]{&:before{content:"";user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}}}& [data-line-type=change-deletion]{&[data-column-number]{&:before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh / round(1lh / 2px)) calc(1lh / round(1lh / 2px))}}}& [data-line-type=change-addition]{&[data-column-number]{&:before{background-color:var(--diffs-addition-base)}}}}[data-overflow=wrap]{& [data-line]{white-space:pre-wrap;word-break:break-word}& [data-annotation-content]{word-break:break-word}}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{min-width:4px;padding:0;&:before{min-width:0}}& [data-line-number-content]{display:none}& [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}&[data-indicators=bars] [data-gutter-utility-slot]{left:6px}}[data-file][data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{border-right:0;min-width:0}}[data-diff-span]{box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex;&:after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + (var(--diffs-gap-block,var(--diffs-gap-fallback)) * 3));z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;white-space:normal;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(-1lh + 1ch);padding:0;display:flex;position:relative;&:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px;[data-decoration-bar-depth="1"] &{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] &{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] &{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] &{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] &{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto;& [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}& [data-error-stack]{color:var(--diffs-fg-number)}}}@layer theme,rendered,unsafe;
|
|
132
|
-
`,hi;function gi(e){if(hi!=null)return hi;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(De,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),hi=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),hi}function _i(e){let t=e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`;return`${we}: ${t};`}var vi=`@layer base, theme, rendered, unsafe;`,yi=RegExp(`${Ci(we)}\\s*:\\s*[^;]+;`);function bi(e){return`${vi}
|
|
133
|
-
@layer unsafe {
|
|
134
|
-
${e}
|
|
135
|
-
}`}function xi(e,t=`system`,n){return`${vi}
|
|
136
|
-
@layer rendered {
|
|
137
|
-
:host {${t===`system`?``:`
|
|
138
|
-
color-scheme: ${t};`}
|
|
139
|
-
${_i(n)}
|
|
140
|
-
${e}
|
|
141
|
-
}
|
|
142
|
-
}`}function Si(e,t){let n=_i(t);return e.replace(yi,n)}function Ci(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var wi=new WeakMap;function Ti(e){return wi.get(e)??e}function Ei({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function Di(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Oi(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function ki(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Ai(e,t,n){let r=new Map;for(let i of e){let e=Ti(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function ji(e,t,n){for(let r of t){let t=Ti(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Mi(e,t,n){if(e==null)return n(t);let r=Ti(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function Ni(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Pi(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function Fi({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Ii(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Ii(){let e=document.createElement(`style`);return e.setAttribute(Ye,``),e}var Li=void 0;function Ri(){return Li??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(mi)),t.adoptedStyleSheets=[e]}connectedCallback(){gi(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Ze,t)}function zi(e){return{...je,...e}}function Bi(e,t){let n=Vi(e,t);return t?n:e.diffHeaderHeight+n}function Vi(e,t){return e.paddingTop??(t?e.spacing:0)}function Hi(e){return e.paddingBottom??e.spacing}function Ui(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function X(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Wi(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Gi(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Ki(e){return{...e,hunks:Gi(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Z(e,t){return e-(t===0?0:1)}function Q(e,t){return Z(e,t)+t}var qi=1;function Ji(e,...t){return`ck${qi}:${JSON.stringify([e,...t])}`}function Yi(e){return e===``?[]:e.split(tt)}function Xi(e,t,n){let r=e===`clone`?Ki(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Zi(r,$i(r,n),ea(r,n));case`rename-pure`:{let e=ea(r,n);ta(r,n);let t=Yi(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,ra(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Zi(e,t,n){let r=Yi(t.contents),i=Yi(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=Qi(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,ra(e,t,n),e}function Qi(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Z(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=Q(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Q(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function $i(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function ea(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function ta(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function na(e,t,n){return e.cacheKey==null?ia(t,n):`${e.cacheKey}:hydrated`}function ra(e,t,n){let r=na(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function ia(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Ji(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}function aa(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var oa=new TextEncoder,sa=new TextDecoder(`utf-8`,{ignoreBOM:!0}),ca=/[\uD800-\uDFFF]/,la=1024,ua=new Uint8Array(la);function da(){ua.length!==la&&(ua=new Uint8Array(la))}function $(e){if(e.length===0)return e;if(ca.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;ua.length<t&&(ua=new Uint8Array(t));let{written:n}=oa.encodeInto(e,ua);return sa.decode(ua.subarray(0,n))}var fa=new TextDecoder(`utf-8`,{ignoreBOM:!0}),pa={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
|
|
143
|
-
`,v:`\v`,f:`\f`,r:`\r`};function ma(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=pa[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=ha(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=fa.decode(new Uint8Array(a))}}function ha(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var ga=4096,_a=.5;function va(e){for(let t of e.hunks)for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=ba(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function ya(e,t,n){let{hunkContent:r}=e;for(let e=1;e<r.length;e++){let i=r[e],a=r[e-1];if(i.type!==`change`||i.additions>0&&i.deletions>0||a.type!==`context`)continue;let o=i.additions>0,s=o?t.additionLines:t.deletionLines,c=o?i.additionLineIndex:i.deletionLineIndex,l=o?i.additions:i.deletions,u=s[c]??``;if(u.trim()!==``)continue;let d=!0;for(let e=1;e<l;e++)if(s[c+e]!==u){d=!1;break}if(!d)continue;let f=0;for(;f<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-f]===u;)f++;if(f===0||e===1&&f===a.lines||n!=null&&(f=n(i,f),f===0))continue;i.additionLineIndex-=f,i.deletionLineIndex-=f;let p=i.additionLineIndex+i.additions,m=i.deletionLineIndex+i.deletions,h=r[e+1];h?.type===`context`?(h.lines+=f,h.additionLineIndex=p,h.deletionLineIndex=m):r.splice(e+1,0,{type:`context`,lines:f,additionLineIndex:p,deletionLineIndex:m}),a.lines-=f,a.lines===0&&(r.splice(e-1,1),e--)}}function ba(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>ga)return null;let c=[];for(let t=0;t<n;t++)c.push(Sa(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(Sa(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=Ca(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*_a:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var xa=/\s+/g;function Sa(e){return e.replace(xa,``)}function Ca(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}var wa=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function Ta(e,t){try{return Ea(e,t)}finally{da()}}function Ea(e,{cacheKey:t,isGitDiff:n=Me.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=Fa(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=ka(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Ma(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?Oa(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Oa(r.contents):[],cacheKey:La(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(wa);if(t==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=Da(t[1],!0),r=Da(t[2],!0);c.name=$(r),n!==r&&(c.prevName=$(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(Ne):null;if(t!=null){let[,e,r]=t,i=Da(r,n);if(e===`---`&&i!==`/dev/null`){let e=$(i);c.prevName=e,c.name=e}else e===`+++`&&i!==`/dev/null`&&(c.name=$(i))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=$(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=$(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=$(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=$(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Be)??[];t!=null&&(c.prevObjectId=$(t)),n!=null&&(c.newObjectId=$(n)),r!=null&&(c.mode=$(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(c.prevName=$(Da(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(c.name=$(Da(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
144
|
-
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
145
|
-
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:La(p.hunkContext),hunkSpecs:$(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!Aa(t)||ja(t))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=Ra(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=za(t);(g==null||g.type!==`change`)&&(g=Ba(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=za(t);(g==null||g.type!==`change`)&&(g=Ba(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=za(t);(g==null||g.type!==`context`)&&(g=Ba(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=aa(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=aa(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=Z(b.additionStart,b.additionCount)+(x===0?0:1),t=Z(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Z(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Q(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=Q(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),va(c),c}}function Da(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?ma(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function Oa(e){let t=ka(e);for(let e=0;e<t.length;e++)t[e]=$(t[e]);return t}function ka(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
146
|
-
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function Aa(e){let t=e[0];return t===`+`||t===`-`||t===` `}function ja(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
147
|
-
`&&n!==`\r`)return!1}return!0}function Ma(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Na(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Na(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Na(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Na(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=Pa(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Na(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function Pa(e){return e.endsWith(`\r
|
|
148
|
-
`)?e.slice(0,-2):e.endsWith(`
|
|
149
|
-
`)?e.slice(0,-1):e}function Fa(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:Ia(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=Ia(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function Ia(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function La(e){return e==null?e:$(e)}function Ra(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function za(e){let t=e.slice(1);return $(t===``?`
|
|
150
|
-
`:t)}function Ba(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Va=`/dev/null`;function Ha(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Ua(),a=t??Ua(),o=Ta(en(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?Ji(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Ua(){return{name:Va,contents:``}}var Wa=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function Ga(e,t){return En(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Ka(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function qa(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[K(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Ja(e){return q({tagName:`div`,children:[jn({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 Ya({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(q({tagName:`div`,children:[K(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Ja(`up`)),s++),o||(e.push(Ja(`down`)),s++)):(e.push(Ja(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[K(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[K(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(q({tagName:`slot`,properties:{name:i}})),q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function Xa(e,t){return`hunk-separator-${e}-${t}`}function Za(e){let t=e.at(-1);return t==null?0:Math.max(Q(t.additionStart,t.additionCount),Q(t.deletionStart,t.deletionCount))}function Qa({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 $a({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function eo(e){return[Z(e.additionStart,e.additionCount)+1,Q(e.additionStart,e.additionCount)+1]}function to({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function no(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-Q(t.additionStart,t.additionCount),r=e.deletionLines.length-Q(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function ro({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-Q(n.additionStart,n.additionCount),i=e.deletionLines.length-Q(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function io({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=ro({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function ao({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=eo(a);if(t<o){let s=to({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=io({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=eo(a);return t<o+i.fromStart||t>=o+i.rangeSize}function oo({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=eo(n),l=to({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=io({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function so({type:e,metrics:t}){return t.hunkSeparatorHeight??Ui(e)}function co({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function lo({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 uo(e){return e!==`simple`&&e!==`metadata`}function fo({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!lo({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=so({type:e,metrics:t}),a=co({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function po({type:e,metrics:t}){if(!uo(e))return;let n=so({type:e,metrics:t}),r=co({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function mo({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=ho({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Z(r.deletionStart,r.deletionCount),s=Z(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=to({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?io({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(vo(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,vo(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(vo(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=yo(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(bo({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(vo(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function ho({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=go({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function go({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=to({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?io({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function _o(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function vo(e,t,n,r,i,a){let[o,s]=_o(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function yo(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function bo({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var xo={forcePlainText:!1};function So(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=xo){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Zr({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??To();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}mo({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&wo({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Eo({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else ei(f.deletionLines,s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else ei(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function Co(e,{deletionLineIndex:t,additionLineIndex:n,deletionDecorations:r,additionDecorations:i}){let a=0,o=0,s=-1,c=0,l=-1,u=0;for(let{value:t,added:n,removed:r}of e)r?(s===-1&&(s=a),a+=t.length,c=a):n?(l===-1&&(l=o),o+=t.length,u=o):(a+=t.length,o+=t.length);s!==-1&&r.push(Qa({line:t,spanStart:s,spanLength:c-s})),l!==-1&&i.push(Qa({line:n,spanStart:l,spanLength:u-l}))}function wo({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=aa(e),t=aa(t),e.length>s||t.length>s))return;let c=o===`char`?Et(e,t):Ut(e,t);if(o===`word-line`){Co(c,{deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a});return}let l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?($a({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),$a({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?$a({item:e,arr:l,enableJoin:d,isLastItem:t}):$a({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Qa({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Qa({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function To(){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 Eo({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??Cr(e.name),d=s??Cr(t.name),{state:f,transformers:p}=Ir(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Y(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Y(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,$r(i.codeToHast(aa(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,$r(i.codeToHast(aa(t.contents),m)))}}function Do(e,t){let n=Ha({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Oo(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function ko(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function Ao(e,t){return t.length>0&&t.length<e.deletionLines.length&&ko(t)}function jo(e,t,n){let r=e.deletionLines.join(``),i=Oo(t.length,r),a=Ha({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Mo(e,t){return jo(e,[``],t)}function No(e,t){if(e.additionLines.length===0)return Mo(e,t);if(Ao(e,e.additionLines))return jo(e,e.additionLines,t);let n=e.additionLines,r=Do(e,t);return Fo(r,n),r}function Po(e){return e.length>1&&e.at(-1)===``}function Fo(e,t){if(!Po(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&Q(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,Go(e);return}}}function Io(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Lo(e,Do(e,n));let r=Array.from(t);if(r.length===0)return Lo(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||aa(r)===aa(i))return Lo(e,Do(e,n))}let i=Ro(e,r);if(i.size===0)return Lo(e,Do(e,n));for(let t of i)if(!Bo(e,t,n))return Lo(e,Do(e,n));return Go(e),no(e)?Lo(e,Do(e,n)):Lo(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Lo(e,t){return Object.assign(e,t),t}function Ro(e,t){let n=new Set;for(let r of t){let t=zo(e,r);if(t==null)return new Set;n.add(t)}return n}function zo(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function Bo(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=Ha({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Ho(r,s),Vo(e,t),!0)}function Vo(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
151
|
-
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
152
|
-
`)}function Ho(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Uo(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,Wo(e)}function Uo(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function Wo(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function Go(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Z(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,Wo(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Q(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Q(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Ko=new WeakMap;function qo(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Jo(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function Yo(e,t,n){let r=e.hunks,i=e.additionLines,a=qo(i),o=a===i?e:{...e,additionLines:a},s=os(r,is(o,t,n),e.deletionLines.length),c=ls(o,s);if(e.additionLines=a,e.hunks=c,e.editSessionDirty=!0,ys(e),Fo(e,i),fs(r,e.hunks))return{regions:s.map(e=>e.previousSpan)}}function Xo(e,t,n,r){let i=new Set(t),a=Array.from(i).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(a.length===0)return;let o=t=>i.has(t)?r?.get(t):e.additionLines[t],{hunks:s}=e,c,l=0;for(let t of a){for(;l<s.length;){let e=s[l];if(t<hs(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:hs(r);if(i==null||t<i||c!=null&&c!==l)return Yo(e,n,o);c=l}if(c!=null){if(Zo(e,a,c,r,n)){e.editSessionDirty=!0;return}return Yo(e,n,o)}}function Zo(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Qo(e),o=e.hunks[n];if(o.hunkContent.some($o))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function Qo(e){let t=Ko.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Ko.set(e,{lines:e.deletionLines,set:n}),n}function $o(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function es(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function ts(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=to({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=gs(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=io({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=gs(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function ns(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=gs(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,gs(i)+i.deletionCount,e.deletionLines.length),n}function rs(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Do(e,t):No(e,t)),!0)}function is(e,t,n){if(Jo(e.deletionLines,e.additionLines)==null)return[];let r=Ha({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),i,a=(t,a)=>{i??=as(e.hunks);for(let e=0;e<=a;e++){let o=i.get(t.deletionLineIndex-e);if(o!=null&&o.additions===t.additions&&o.deletions===t.deletions){if(t.additions>0&&n!=null){for(let e=0;e<t.additions;e++)if(n(o.additionLineIndex+e)!==r.additionLines[t.additionLineIndex+e])return a}return e}}return a},o=[],s=0,c=0;for(let e of r.hunks){ya(e,r,a);let t=e.additionCount>0?e.additionLineIndex-s:e.deletionLineIndex-c;s+=t,c+=t;for(let t of e.hunkContent){if(t.type===`context`){s+=t.lines,c+=t.lines;continue}let e=Uo(t,0,0);e.additions===0&&(e.additionLineIndex=s),e.deletions===0&&(e.deletionLineIndex=c),o.push(e),s+=e.additions,c+=e.deletions}}return o}function as(e){let t=new Map;for(let n of e)for(let e of n.hunkContent)e.type===`change`&&(e.additions===0||e.deletions===0)&&t.set(e.deletionLineIndex,e);return t}function os(e,t,n){let r=e.map((e,t)=>{let n=gs(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&ss(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=cs(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function ss(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function cs(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function ls(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);ds(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);ds(s,c,i,r),r+=c,i+=c,n.push(us(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function us(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:_s(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:vs(t.additionStart,r),deletionStart:_s(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:vs(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${_s(t.deletionStart,i)},${i} +${_s(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Wo(s),s}function ds(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function fs(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(gs(r)!==gs(i)||r.deletionCount!==i.deletionCount||hs(r)!==hs(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!ps(r,i))return!0}return!1}function ps(e,t){let n=ms(e),r=ms(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*ms(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function hs(e){return Z(e.additionStart,e.additionCount)}function gs(e){return Z(e.deletionStart,e.deletionCount)}function _s(e,t){return t===0?e:e+1}function vs(e,t){return t===0?e-1:e}function ys(e){Go(e);for(let t=0;t<e.hunks.length;t++)Vo(e,t)}function bs(e){let t=e.lang??Cr(e.name),n=e.lang??(e.prevName==null?`text`:Cr(e.prevName));return t===`text`&&n===`text`}var xs=-1,Ss=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++xs}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:Te},t=Tr,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=dt(e.theme??Te)?gt():void 0)}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){let{editSessionActive:n}=this;this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,n&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();let{renderCache:r}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,Mo(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&X(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Ga(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff??this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!X(t.diff,e)||bs(e)||Fs(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!X(n,e)||!X(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Ga(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Ce}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=aa(u);s==null&&i&&(a.additionLines[t]=ai(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,Mo(a,this.options.parseDiffOptions)),u=!0;else if(Ao(a,a.additionLines))this.applyRecomputePreservingSessionType(a,jo(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=Xo(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,Io(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=es(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;this.pendingStructuralRows=void 0;let r=this.diff??n?.diff;if(r==null)return;let i=n?.result;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=Ns(e),i!=null&&(i.code.additionLines=js(a,r.additionLines,i.code.additionLines,e)),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Mo(r,this.options.parseDiffOptions)),i!=null&&(i.code.additionLines[0]=Ms(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(r,a):Object.assign(r,No(r,this.options.parseDiffOptions)),t!=null&&i!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n!=null&&(n.isDirty=!0)}applySessionDocumentChange(e,t){let{parseDiffOptions:n}=this.options,r=e.additionLines;if(Ao(e,r)){this.applyRecomputePreservingSessionType(e,jo(e,r,n));return}this.applyExpansionRemap(Yo(e,n,e=>t[e]))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>mr(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=Te,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ke,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await vt(wr(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Fs(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Ga(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!bs(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=Ps(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Te}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!X(e,n.diff)||!Ga(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(X(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||bs(e)||Fs(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||X(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&dt(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&dt(t.theme)}renderDiff(e=this.diff,t=Ae){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||bs(e)||Fs(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!X(e,this.renderCache.diff),d=!pr(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&Er(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Er(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=Ps(e),this.highlighter??=gt();let t=this.highlighter!=null&&dt(i.theme),n=this.highlighter!=null&&ft(this.computedLangs),r=!c&&n;if(l&&this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Ae){this.diff=e;let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return yr({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Fs(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:Ps(e);let n=this.highlighter!=null&&dt(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&ft(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=So(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(mo({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Ms(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&X(i,e)&&Ga(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&Ga(a.options,n)&&X(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&Ga(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&X(n.diff,e)&&Ga(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&X(e,n.diff)&&Ga(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=Is(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Nn(),deletionsGutterAST:Nn(),additionsGutterAST:Nn(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=ro({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,J(void 0,`buffer`,this.size)),h?.push(Ka(this.size))):(x.pushToGutter(`deletions`,J(void 0,`buffer`,this.size)),g?.push(Ka(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,Pn(t,n,r,i))};function T(e){C.flush(),a===`unified`?Os(`unified`,e,x):(Os(`deletions`,e,x),Os(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),mo({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Ts(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=ks(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=ks(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Ds({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Ts(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Es(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=ks(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=ks(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Ds({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Es(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(qa(e)),x.pushToGutter(`unified`,J(e,`metadata`,1))):(x.deletionsContentAST.push(qa(e)),x.pushToGutter(`deletions`,J(e,`metadata`,1)),k||(x.pushToGutter(`additions`,J(void 0,`buffer`,1)),x.additionsContentAST.push(Ka(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(qa(e)),x.pushToGutter(`unified`,J(e,`metadata`,1))):(x.additionsContentAST.push(qa(e)),x.pushToGutter(`additions`,J(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,J(void 0,`buffer`,1)),x.deletionsContentAST.push(Ka(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(Za(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Nn(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,oi(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return bt(this.renderFullAST(e,t))}renderPartialHTML(e,t){return bt(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!ii(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(ri(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(ri(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Ds({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Ds({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(this.annotationSlotName(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(this.annotationSlotName(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return gr({fileOrDiff:e,mode:t,stickyHeader:n})}},Cs=new Intl.PluralRules(`en-US`);function ws(e){return`${e} unmodified line${Cs.select(e)===`one`?``:`s`}`}function Ts(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Es(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Ds({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,J(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,J(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,J(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Os(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Ya({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Ya({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Ya({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Ya({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Xa(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?ws(n):`More unchanged context may be available`;c.pushToGutter(e,Ya({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Ya({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function ks(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function As(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function js(e,t,n,r){let i=As(e),a=As(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=Ms(e,r.getLineText(e));return l}function Ms(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Ns(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Ps(e){if(e.lang!=null)return[e.lang];let t=Cr(e.prevName??e.name),n=Cr(e.name);return t===n?[n]:[t,n]}function Fs(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Is(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ls(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Rs(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function zs(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Bs({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function Vs(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:Ni(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Hs(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function Us(e){let t={...e};return delete t.cacheKey,t}function Ws(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??Cr(e.name),r=t.lang??Cr(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function Gs(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ks(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&Gs(n.lines,t.deletionLines)}var qs=-1,Js=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++qs}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:Te},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new ar,this.scrollSyncManager=new Wa,this.interactionManager=new Rn(`diff`,zn(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Te}getHunksRendererOptions(e){return Vs(e)}createHunksRenderer(e){return new Ss(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=Z(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(zn(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!En(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Mi(this.editSession?.annotations,e,Tr);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,ji(t,e,Tr))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;Cn(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=Bs(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||$s(this.pre,Zs({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||ec(this.headerElement,Qs({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Di(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Ha(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,n),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||!Hs(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw Error(`FileDiff: loadDiffFiles is required to load full files for a partial diff`);let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;let e=this.__prepareForEditing();if(e==null)throw this.fileDiff?.isPartial===!0&&!Hs(this.fileDiff)?Error(`FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff`):Error(`FileDiff.prepareForEditing: a partial diff requires loadDiffFiles`);if(await e,!this.__canAttachEditor())throw Error(`FileDiff.prepareForEditing: the diff did not finish loading`)}__prepareForEditing(){if(!this.__canAttachEditor()){if(this.fileDiff?.isPartial===!0&&!Hs(this.fileDiff))throw Error(`FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit`);return this.loadFilesIfNecessary(),this.pendingFiles?.promise}}async loadFilesForDiff(e,t){try{let n=await t(e);if(this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(Xi(`merge`,e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await zs(()=>this.primeHighlightCache(e)),this.enabled&&this.fileDiff===e&&this.rerender()}}installHydratedSessionDiff(e){if(e.isPartial)throw Error(`FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing`);return this.fileDiff===e&&this.editSession?.outgoingDiff!=null&&(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(X(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Ai(t,Tr,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Yi(t.contents),a=n!=null&&Ks(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=Us(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,Go(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??Ai(this.lineAnnotations,Tr),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=Bs(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!Xs(u,this.deletionFile)||!Xs(d,this.additionFile)),y=e!=null&&!X(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&pr(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Ha(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(rs(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,Ee);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!X(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData),this.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,{fileDiff:s}=this,c=o!=null&&s!=null&&o!==i,l=c&&o!=null&&s!=null?Ws(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??Cr(i.name),c=gt({theme:o,lang:s});c==null?vt({themes:mt(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||Er(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return mo({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&Ws(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?Gi(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);if(!this.__canAttachEditor())throw Error(`FileDiff.__attachEditor: a complete diff is required before editing`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(Ys(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=Ki(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=ts(e,this.hunksRenderer.getExpandedHunksMap(),t);return rs(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(ns(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return ao({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return oo({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=eo(o);if(e<s){let c=to({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=io({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=eo(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){G(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||bs(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Rs(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!Ls(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:di(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=fi();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:ki(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ki(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=si;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&X(r,n)?i:void 0)??bt(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,rt,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Se,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Pe,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Oe,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=pi(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=bi(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=gi(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Fi({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:xi(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Si(this.themeCSSStyle.textContent??``,gi(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Ri()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Pi(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=tc(t[0]),a=tc(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=bt(i),r.content.innerHTML=bt(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ei({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ei({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Ei({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=tc(r?.[0]),a=tc(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=tc(r?.[0]),a=tc(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=bt(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Pi(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=tc(t[0]),i=tc(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};ci(u,this.appliedPreAttributes)||(Oi(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Ys(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function Xs(e,t){return e==null||t==null?e==null&&t==null:Wi(e,t)}function Zs({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Qs({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function $s(e,t,n=!1){return!n&&e==null&&t}function ec(e,t,n=!1){return e==null&&t&&!n}function tc(e){if(e!=null&&e.type===`element`)return e.children??[]}function nc({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Bi(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=to({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=fo({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=rc(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?io({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=po({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=po({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=Hi(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function rc(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return ic(e,t)}function ic(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var ac=3e3,oc=new Map,sc=-1,cc=class extends Js{__id=`little-virtualized-file-diff:${++sc}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:oc,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=zi(n)}setMetrics(e,t=!1){let n=zi(e);(t||!Tn(this.metrics,n))&&(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return ni(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Dn(t,e),r=n&&gc(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:_c(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=oc,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},metrics:{lineHeight:n}}=this,r=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(r,this.editor?.__getGhostTextRows()??oc);let{ghostTextRowsByIndex:i}=this.cache,a=t!==`scroll`||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!a&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&ii(this.renderRange)){let t=lc(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}for(let t of s){if(t==null)continue;let r=t.children[1];if(!(r instanceof HTMLElement))continue;let s=o===`split`&&t===this.codeDeletions;for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let c=xc(r,o),l=i.get(c)??0;if(s&&l>0)continue;let u=this.cache.heightDeltas.get(c)??0;if(!a&&u===l*n)continue;let d=t.getBoundingClientRect().height+l*n,f=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(f=!0),d+=t.nextElementSibling.getBoundingClientRect().height);let p=this.getEstimatedLineHeight(f),m=d-p;m!==u&&(e=!0,this.cache.measuredHeightDeltaTotal+=m-u,m===0?this.cache.heightDeltas.delete(c):this.cache.heightDeltas.set(c,m))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.installHydratedSessionDiff(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=zi(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=Bi(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return mo({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=fo({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=po({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??Bi(this.metrics,n)+this.cache.fileAnnotationHeight,u;return mo({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=fo({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=po({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!X(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(this.fileDiff===e&&e.isPartial){if(this.isAdvancedMode()){let n=Xi(`clone`,e,t);if(await zs(()=>this.primeHighlightCache(n)),this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Xi(`merge`,e,t),this.setHydratedState(t),!this.installHydratedSessionDiff(e)&&(await zs(()=>this.primeHighlightCache(e)),this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return ao({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),this.enabled&&this.fileDiff!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!X(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??oc);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Bi(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=nc({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:vc(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=Bs(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!bc(s,this.deletionFile)||!bc(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Ha(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!X(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if(g&&this.resetLayoutCache({includeEstimatedHeights:!0}),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(!X(this.getRenderedDiff(),this.pendingRender?.diff))throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!X(a,o),renderedDiffChanged:!X(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return yc(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=vc(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=uc(this.cache.heightDeltas),u=Bi(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=pc(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+mc(i,e)*this.metrics.lineHeight+dc(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=ac}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+dc(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=to({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?fo({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?io({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?po({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:hc({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=to({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=io({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=vc(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Bi(this.metrics,i),h=e.hunks.length>0?Hi(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(mo({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?fo({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=po({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let P=Math.round(M-w/2),F=Math.max(0,Math.ceil(p/s)-w),I=Math.max(0,Math.min(P,F)),L=I*s,ee=P<0?C+P*s:C,R=E[I]??0,te=L===0?0:g+R,ne=I+ee/s,z=ne<E.length?v-E[ne]:v-(k-t-_);return{startingLine:L,totalLines:ee,bufferBefore:te,bufferAfter:Math.max(0,z)}}};function lc(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===ti&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function uc(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function dc({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=fc(e,n);return(t[fc(e,r)]??0)-(t[i]??0)}function fc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function pc(e){return Math.ceil(e/ac)*ac}function mc(e,t){let n=0;for(let r of e)r<t&&n++;return n}function hc({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function gc(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function _c(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function vc(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function yc(e){return typeof e==`function`?`custom`:e??`line-info`}function bc(e,t){return e==null||t==null?e==null&&t==null:Wi(e,t)}function xc(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Sc(e,t){return e==null||t==null?e===t:e.top===t.top&&e.bottom===t.bottom}var Cc=1e3,wc=Cc*4,Tc=[0,1e-6,.99999,1],Ec={overscrollSize:Cc,intersectionObserverMargin:wc,resizeDebugging:!1},Dc=0,Oc=-1,kc=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Oc}`;config;type=`simple`;intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;reconcileQueue=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Ec,...e}}setup(t,n){if(this.root==null){this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Tc,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),G(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)};for(let[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),G(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),G(this.computeRenderRangeAndEmit)}requestHeightReconcile(e){this.reconcileQueue.add(e),G(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=An({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}getRoot(){return this.root}isInstanceVisible(e,t){let n=this.getScrollTop(),r=this.getHeight(),i=this.config.intersectionObserverMargin,a=n-i,o=n+r+i;return!(e<a-t||e>o)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: content size change`,this.__id,{sizeChange:e-Dc,newSize:e}),Dc=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log(`Virtualizer: scroller size change`,this.__id,{sizeChange:e-Dc,newSize:e}),Dc=e))}t&&G(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw Error(`Virtualizer.setupWindow: Invalid setup method`);window.addEventListener(`scroll`,this.handleWindowScroll,{passive:!0}),window.addEventListener(`resize`,this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw Error(`Virtualizer.setupElement: Invalid setup method`);this.root.addEventListener(`scroll`,this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){Cn(this.computeRenderRangeAndEmit),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleElementScroll),window.removeEventListener(`scroll`,this.handleWindowScroll),window.removeEventListener(`resize`,this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.reconcileQueue.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.scrollHeightDirty=!0}getOffsetInScrollContainer(e){return this.getScrollTop()+Ac(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error(`Virtualizer.connect: instance is already connected...`);return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),G(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.instancesChanged.delete(t),this.reconcileQueue.delete(t),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),G(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,G(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{!e.__STOP&&this.root!=null&&this.root instanceof Document&&(this.scrollDirty=!0,G(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,G(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty,n=this.instancesChanged.size>0;if(this.instancesChanged.size===0){let e=An({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!t&&Sc(this.windowSpecs,e)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.reconcileQueue.size===0)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let r=this.getScrollAnchor(this.height),i=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&i.add(e);for(let e of this.instancesChanged)i.has(e)||e.onRender(t)&&i.add(e);this.scrollFix(r);for(let e of i)this.reconcileQueue.delete(e),e.reconcileHeights();for(let e of this.reconcileQueue)e.reconcileHeights()&&(n=!0);this.reconcileQueue.clear(),n||=this.instancesChanged.size>0,n&&this.markDOMDirty(),(n||t)&&G(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:i,fileOffset:a,fileTypeOffset:o}=e;if(n!=null&&r!=null){let e=i.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=Ac(e,t);if(n!==r){let e=n-r;this.applyScrollFix(e)}return}}let s=Ac(i,t);if(o===`top`)s!==a&&this.applyScrollFix(s-a);else{let e=s+i.getBoundingClientRect().height;e!==a&&this.applyScrollFix(e-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:`instant`}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:`instant`}),this.markDOMDirty()}getScrollAnchor(e){let t=this.getScrollContainerElement(),n;for(let[r]of this.visibleInstances.entries()){let i=Ac(r,t),a=i+r.offsetHeight,o,s;a<=0?(o=a,s=`bottom`):(o=i,s=`top`);let c,l;if(a>0&&i<e)for(let e of r.shadowRoot?.querySelectorAll(`[data-line][data-line-index]`)??[]){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(n==null)continue;let r=Ac(e,t);if(!(r<0)){c=n,l=r;break}}if(n?.lineOffset!=null&&l==null)continue;let u=!1;(n==null||l!=null&&(n.lineOffset==null||l<n.lineOffset)||l==null&&n.lineOffset==null&&(o>=0&&(n.fileOffset<0||o<n.fileOffset)||o<0&&n.fileOffset<0&&o>n.fileOffset))&&(u=!0),u&&(n={fileElement:r,fileTypeOffset:s,fileOffset:o,lineIndex:c,lineOffset:l})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(let{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw Error(`Virtualizer.handleIntersectionChange: target not an HTMLElement`);let e=this.observers.get(t);e!=null&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&G(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=this.clampScrollTop(e),this.scrollTop=e,e}scrollTo({top:e,behavior:t=`auto`}){let{root:n}=this;if(n==null)return;let r=this.clampScrollTop(e);n instanceof Document?window.scrollTo({top:r,behavior:t}):n.scrollTo({top:r,behavior:t}),this.scrollDirty=!0,G(this.computeRenderRangeAndEmit)}clampScrollTop(e){return Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight()))}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function Ac(e,t){let n=e.getBoundingClientRect(),r=t?.getBoundingClientRect().top??0;return n.top-r}var jc=E(`diffs:group-nav`,`tabs`),Mc=k(`(min-width: 1024px)`),Nc=u(()=>jc.value===`sidebar`&&Mc.value),Pc=Symbol(`diffs-virtualizer`),Fc=5,Ic=2;function Lc(e,t){let n=e.querySelector(`[data-file-start="${t}"]`);if(!n)return;let r=Number.parseFloat(getComputedStyle(n).scrollMarginTop),i=()=>Math.abs(n.getBoundingClientRect().top-r)<=Ic,a=0;function o(){if(i()||a++>=Fc){window.removeEventListener(`scrollend`,o,{capture:!0});return}n.scrollIntoView({behavior:`smooth`,block:`start`})}i()||(window.addEventListener(`scrollend`,o,{capture:!0}),n.scrollIntoView({behavior:`smooth`,block:`start`}))}function Rc(e,t,n,r,i){if(e<=0||n<=0)return i;let a=Math.floor(n/(e/t)*2)/2;return Math.min(i,Math.max(r,a))}function zc(e,t,n,r,i){let a=S(i);function s(){if(!e.value||!t.value)return;let n=Number.parseFloat(getComputedStyle(e.value).fontSize);a.value=Rc(t.value.getBoundingClientRect().width,n,e.value.clientWidth,r,i)}return A(e,s),P(n,()=>o(s)),document.fonts?.ready.then(s),a}var Bc=E(`diffs:file-list`,`tree`),Vc={},Hc=[`aria-label`,`title`];function Uc(e,t){return r(),m(`span`,{class:`i-ph-circle-wavy-warning-duotone shrink-0 text-amber-600 dark:text-amber-400`,role:`img`,"aria-label":e.$t(`note.critical`),title:e.$t(`note.critical`)},null,8,Hc)}var Wc=at(Vc,[[`render`,Uc]]);function Gc(e,t,n){return e.hunks.some(e=>{let[r,i]=t===`additions`?[e.newStart,e.newLines]:[e.oldStart,e.oldLines];return n>=r&&n<r+i})}function Kc(e,t){let n={text:e.text,critical:e.critical??!1};return Gc(t,e.side,e.line)&&(n.anchor={side:e.side,line:e.line}),n}function qc(e){return e?.some(e=>e.critical)??!1}function Jc(e,t,n,r){return{key:e.key,label:e.label,summary:e.summary,category:e.category??`other`,critical:(e.critical??!1)||[...n.values()].some(qc),files:t,notes:n,missing:r,added:t.reduce((e,t)=>e+t.additions,0),deleted:t.reduce((e,t)=>e+t.deletions,0)}}function Yc(e,t){let n=new Map(t.map(e=>[e.path,e])),r=new Map(t.flatMap(e=>e.previousPath?[[e.previousPath,e]]:[])),i=new Set;function a(e){let t=[],a=[];for(let o of e.filePaths){let e=n.get(o)??r.get(o);e?(t.push(e),i.add(e)):a.push(o)}let o=new Map;function s(e,t){let i=n.get(e)??r.get(e);i&&o.set(i.sha,[...o.get(i.sha)??[],t(i)])}for(let t of e.fileNotes??[])s(t.path,()=>({text:t.text,critical:t.critical??!1}));for(let t of e.lineNotes??[])s(t.path,e=>Kc(t,e));return Jc(e,t,o,a)}let o=e.map(e=>({...a(e),children:(e.children??[]).map(a)})),s=t.filter(e=>!i.has(e));return s.length>0&&o.push({...Jc({key:`uncategorized`,label:H(`group.uncategorized`),summary:H(`group.uncategorizedSummary`),category:`other`},s,new Map,[]),children:[]}),o}function Xc(e){return e.files.length+e.children.reduce((e,t)=>e+t.files.length,0)}function Zc(e){return e.critical||e.children.some(e=>e.critical)}function Qc(e,t){let n=[...e.files,...e.children.flatMap(e=>e.files)];return n.length===0?1:n.filter(e=>t.has(e.sha)).length/n.length}function $c(e){return{added:e.added+e.children.reduce((e,t)=>e+t.added,0),deleted:e.deleted+e.children.reduce((e,t)=>e+t.deleted,0)}}var el={class:`flex flex-col items-start`},tl={class:`flex items-center gap-1.5`},nl={class:`flex items-center text-xs`},rl={class:`op-mute`},il={key:0,class:`op-mute`},al=R({__name:`DiffGroupNavItem`,props:{group:{},active:{type:Boolean},reviewed:{},expanded:{type:Boolean}},emits:[`select`,`toggle`],setup(e){let n=e,o=u(()=>$c(n.group)),s=u(()=>Xc(n.group)),c=u(()=>n.group.children.length),d=u(()=>Qc(n.group,n.reviewed)),f=u(()=>Zc(n.group));return(n,u)=>(r(),m(`div`,{class:i([`flex items-center border border-b-2 border-base rounded-t transition-all`,[D(pt)[e.group.category],e.active?`border-b-current shadow translate-y--1px`:``]])},[b(`button`,{type:`button`,class:i([[e.active?`op-100`:`op-fade hover:op-100`],`group flex items-center gap-2 px-2 py-0.5 text-left text-sm color-base hover:bg-active`]),onClick:u[1]||=t=>n.$emit(`select`,e.group.key)},[b(`div`,el,[b(`div`,tl,[t(_t,{category:e.group.category,class:i([`text-sm group-hover:saturate-100`,e.active?``:`saturate-0`])},null,8,[`category`,`class`]),b(`span`,null,a(e.group.label),1),f.value?(r(),x(Wc,{key:0,class:`text-sm`})):l(``,!0)]),b(`div`,nl,[t(St,{additions:o.value.added,deletions:o.value.deleted},null,8,[`additions`,`deletions`]),b(`span`,rl,`・`+a(n.$t(`common.files`,{n:s.value},s.value)),1),c.value?(r(),m(`span`,il,`・`+a(n.$t(`common.subgroups`,{n:c.value},c.value)),1)):l(``,!0)])]),d.value===0?l(``,!0):(r(),x(ut,{key:0,value:d.value,size:18,thickness:2,class:`color-base`},null,8,[`value`])),c.value?(r(),x(W,{key:1,type:`button`,icon:e.expanded?`i-ph:caret-up`:`i-ph:caret-down`,"aria-expanded":e.expanded,class:`mr--1 text-xs`,"aria-label":n.$t(e.expanded?`group.hideSubgroups`:`group.showSubgroups`),onClick:u[0]||=V(e=>n.$emit(`toggle`),[`stop`])},null,8,[`icon`,`aria-expanded`,`aria-label`])):l(``,!0)],2)],2))}}),ol={class:`min-w-0 flex flex-1 flex-col gap-1.5`},sl={class:`flex flex-wrap items-center gap-1.5`},cl={class:`flex items-center gap-1`},ll={class:`text-sm`},ul={class:`op-fade`},dl={class:`flex flex-wrap items-center gap-1.5`},fl=R({__name:`DiffGroupNav`,props:{groups:{},groupsVisable:{},reviewed:{}},emits:[`select`],setup(e,{emit:t}){let n=e,i=t,o=S();function s(e,t=o.value!==e){o.value=t?e:void 0}let c=u(()=>{let e=n.groups.find(e=>e.key===o.value);return e?e.children.map(e=>({...e,children:[]})):[]});function d(e){i(`select`,e),s(e,!0)}return(t,i)=>(r(),m(`div`,ol,[b(`div`,sl,[(r(!0),m(g,null,h(e.groups,t=>(r(),x(al,{key:t.key,group:t,active:e.groupsVisable.includes(t.key),reviewed:e.reviewed,expanded:o.value===t.key,onSelect:i[0]||=e=>d(e),onToggle:e=>s(t.key)},null,8,[`group`,`active`,`reviewed`,`expanded`,`onToggle`]))),128)),L(t.$slots,`default`)]),c.value.length?(r(),m(g,{key:0},[b(`div`,cl,[i[3]||=b(`div`,{class:`i-ph-folder-notch-open-duotone op-fade`},null,-1),b(`div`,ll,[b(`span`,ul,a(t.$t(`group.subgroupsOf`)),1),i[2]||=v(),b(`span`,null,a(n.groups.find(e=>e.key===o.value)?.label),1)]),i[4]||=b(`div`,{class:`flex-auto border-t border-base`},null,-1)]),b(`div`,dl,[(r(!0),m(g,null,h(c.value,n=>(r(),x(al,{key:n.key,group:n,active:e.groupsVisable.includes(n.key),reviewed:e.reviewed,onSelect:i[1]||=e=>t.$emit(`select`,e)},null,8,[`group`,`active`,`reviewed`]))),128))])],64)):l(``,!0)]))}});function pl(e){return e.replace(/\\/g,`/`)}function ml(e){return/\bnode_modules\b/.test(pl(e))}function hl(e){let t=e.split(`_`)[0]??``,n=t.lastIndexOf(`@`);if(n<=0)return;let r=t.slice(0,n),i=t.slice(n+1),a=r;return r.includes(`+`)&&(a=r.replace(`+`,`/`),a.startsWith(`@`)||(a=`@${a}`)),{name:a,version:i}}function gl(e){let t=pl(e).match(/\.pnpm\/([^/]+)/);if(t?.[1]!=null)return hl(t[1])}function _l(e){let t=pl(e),n=gl(t);if(n)return n.name;let r=t.lastIndexOf(`node_modules/`);if(r===-1)return;let[i,a]=t.slice(r+13).split(`/`);if(i!=null)return i.startsWith(`@`)&&a!=null?`${i}/${a}`:i}function vl(e,t=`~/`){return pl(e).replace(/.*\.pnpm\/[^/]+\/node_modules\//,t)}function yl(e,t,n={}){let{pnpmCollapse:r=`~/`,maxUp:i=3}=n,a=pl(e),o=pl(t).replace(/\/$/,``);if(a.includes(`.pnpm/`))return vl(a,r);if(!o)return a;if(a===o)return`.`;if(a.startsWith(`${o}/`)){let e=a.slice(o.length+1);return e.startsWith(`.`)?e:`./${e}`}let s=o.split(`/`),c=a.split(`/`),l=0;for(;l<s.length&&l<c.length&&s[l]===c[l];)l++;let u=s.length-l;return u>i||l===0?a:`${`../`.repeat(u)}${c.slice(l).join(`/`)}`}function bl(e,t,n){let r=ml(e)?_l(e):void 0;return{path:yl(e,t,n),moduleName:r}}var xl={class:`truncate`},Sl={class:`color-base`},Cl={key:1,class:`op-mute italic`},wl={key:2,class:`op-mute`},Tl={key:1,class:`text-xs op-mute shrink-0`},El=R({__name:`DisplayFilePath`,props:{path:{},root:{default:``},icon:{type:Boolean,default:!0},href:{},line:{},column:{},dim:{type:Boolean,default:!0},clickable:{type:Boolean},pnpmCollapse:{},tooltip:{type:[Boolean,String],default:!1}},setup(e){let t=e,n=u(()=>bl(t.path,t.root,{pnpmCollapse:t.pnpmCollapse})),o=u(()=>{let e=n.value.path,t=e.search(/[?#]/),r=t===-1?e:e.slice(0,t),i=t===-1?``:e.slice(t),a=r.lastIndexOf(`/`);return{dir:a===-1?``:r.slice(0,a+1),base:a===-1?r:r.slice(a+1),query:i}}),s=u(()=>t.href!=null||t.clickable);return(t,c)=>ne((r(),x(C(e.href?`a`:`span`),{href:e.href,class:i([`text-sm font-mono inline-flex gap-1 max-w-full min-w-0 items-center`,{"hover:color-active transition":s.value,"cursor-pointer":e.clickable&&!e.href}])},{default:z(()=>[e.icon?(r(),m(`span`,{key:0,class:i([D(ht)(o.value.base),`op-fade shrink-0`]),"aria-hidden":`true`},null,2)):l(``,!0),b(`span`,xl,[o.value.dir?(r(),m(`span`,{key:0,class:i(e.dim?`op-mute`:`color-base`)},a(o.value.dir),3)):l(``,!0),b(`span`,Sl,a(o.value.base),1),o.value.query?(r(),m(`span`,Cl,a(o.value.query),1)):l(``,!0),e.line==null?l(``,!0):(r(),m(`span`,wl,[v(`:`+a(e.line),1),e.column==null?l(``,!0):(r(),m(g,{key:0},[v(`:`+a(e.column),1)],64))]))]),n.value.moduleName?(r(),m(`span`,Tl,`(`+a(n.value.moduleName)+`)`,1)):l(``,!0)]),_:1},8,[`href`,`class`])),[[D(st),e.tooltip===!0?e.path:e.tooltip||``]])}}),Dl={key:1,class:`i-ph:sparkle-duotone mt-0.2 shrink-0 op-fade`,"aria-hidden":`true`},Ol=R({__name:`AnalysisNoteCard`,props:{note:{},borderless:{type:Boolean}},setup(e){return(n,a)=>(r(),m(`div`,{class:i([`flex items-center gap-2 overflow-hidden px-3 py-2 text-left text-sm font-sans`,[e.note.critical?`border-amber:30 bg-amber:10`:`border-base bg-base`,e.borderless?``:`my-1 border rounded-lg max-w-200`]])},[e.note.critical?(r(),x(Wc,{key:0,class:`mt-0.2 text-base`})):(r(),m(`span`,Dl)),(r(),x(c,null,{default:z(()=>[t(D(ct),{value:e.note.text,class:`min-w-0 flex-1`},null,8,[`value`])]),_:1}))],2))}}),kl=[`rows`,`placeholder`,`disabled`,`aria-invalid`],Al=R({__name:`FormTextarea`,props:y({placeholder:{},rows:{default:4},disabled:{type:Boolean},invalid:{type:Boolean},resize:{type:Boolean,default:!0}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=ee(e,`modelValue`);return(n,a)=>ne((r(),m(`textarea`,{"onUpdate:modelValue":a[0]||=e=>t.value=e,rows:e.rows,placeholder:e.placeholder,disabled:e.disabled,"aria-invalid":e.invalid||void 0,class:i([`color-base px-2 py-1.5 outline-none border rounded bg-raised w-full transition placeholder:op-mute focus:ring-2`,[e.invalid?`border-red-500/60 focus:ring-red-500/40`:`border-base focus:ring-primary-500/40`,{"resize-none":!e.resize,"op50 pointer-events-none":e.disabled}]])},null,10,kl)),[[ie,t.value]])}}),jl={class:`flex flex-col gap-2 p-2`},Ml={key:0,class:`text-xs text-red-600 dark:text-red-400`},Nl={class:`flex flex-wrap justify-end gap-2`},Pl=R({__name:`CommentComposer`,props:{hasPendingReview:{type:Boolean},busy:{type:Boolean},error:{}},emits:[`submit`,`cancel`],setup(e,{emit:n}){let i=e,o=n,s=S(``);function c(e){s.value.trim()&&o(`submit`,s.value,e)}return(n,u)=>(r(),m(`div`,jl,[t(Al,{modelValue:s.value,"onUpdate:modelValue":u[0]||=e=>s.value=e,rows:3,placeholder:n.$t(`review.leaveComment`),disabled:e.busy,invalid:!!e.error,onKeydown:[u[1]||=B(V(e=>c(`review`),[`meta`]),[`enter`]),u[2]||=B(V(e=>c(`review`),[`ctrl`]),[`enter`])]},null,8,[`modelValue`,`placeholder`,`disabled`,`invalid`]),e.error?(r(),m(`p`,Ml,a(e.error),1)):l(``,!0),b(`div`,Nl,[t(U,{size:`sm`,variant:`text`,disabled:e.busy,onClick:u[3]||=e=>o(`cancel`)},{default:z(()=>[v(a(n.$t(`common.cancel`)),1)]),_:1},8,[`disabled`]),i.hasPendingReview?l(``,!0):(r(),x(U,{key:0,size:`sm`,disabled:e.busy||!s.value.trim(),onClick:u[4]||=e=>c(`single`)},{default:z(()=>[v(a(n.$t(`review.addSingle`)),1)]),_:1},8,[`disabled`])),t(U,{size:`sm`,variant:`primary`,loading:e.busy,disabled:!s.value.trim(),onClick:u[5]||=e=>c(`review`)},{default:z(()=>[v(a(n.$t(e.hasPendingReview?`review.addToReview`:`review.startReview`)),1)]),_:1},8,[`loading`,`disabled`])])]))}}),Fl=Symbol(`file-collapse`),Il=[`title`],Ll=R({__name:`FileStatus`,props:{status:{}},setup(e){let t={added:`A`,removed:`D`,modified:`M`,renamed:`R`,copied:`C`},n={added:`color-success-500 bg-success-500:10`,removed:`color-error-500 bg-error-500:10`,modified:`color-warning-500 bg-warning-500:10`,renamed:`color-blue-500 bg-blue-500:10`,copied:`color-blue-500 bg-blue-500:10`};return(o,s)=>(r(),m(`span`,{class:i([`w-4 inline-flex shrink-0 items-center justify-center rounded text-xs font-mono`,n[e.status]]),title:o.$t(`fileStatus.${e.status}`)},a(t[e.status]),11,Il))}}),Rl=(0,e(ye(),1).default)(ve);function zl(e){return Rl(e)}var Bl=`@layer base {
|
|
153
|
-
:host {
|
|
154
|
-
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
155
|
-
"Courier New", monospace;
|
|
156
|
-
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
157
|
-
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
158
|
-
--diffs-mixer: light-dark(#000, #fff);
|
|
159
|
-
--diffs-gap-fallback: 8px;
|
|
160
|
-
--diffs-scrollbar-gutter-fallback: 6px;
|
|
161
|
-
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
162
|
-
--diffs-added-light: #0dbe4e;
|
|
163
|
-
--diffs-added-dark: #5ecc71;
|
|
164
|
-
--diffs-modified-light: #009fff;
|
|
165
|
-
--diffs-modified-dark: #69b1ff;
|
|
166
|
-
--diffs-deleted-light: #ff2e3f;
|
|
167
|
-
--diffs-deleted-dark: #ff6762;
|
|
168
|
-
--diffs-warning-light: #d5a910;
|
|
169
|
-
--diffs-warning-dark: #ffd452;
|
|
170
|
-
color-scheme: light dark;
|
|
171
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
172
|
-
font-size: var(--diffs-font-size, 13px);
|
|
173
|
-
line-height: var(--diffs-line-height, 20px);
|
|
174
|
-
font-feature-settings: var(--diffs-font-features);
|
|
175
|
-
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
176
|
-
--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))));
|
|
177
|
-
--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))));
|
|
178
|
-
--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))));
|
|
179
|
-
--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))));
|
|
180
|
-
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
181
|
-
--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))));
|
|
182
|
-
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
183
|
-
--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)))));
|
|
184
|
-
--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)))));
|
|
185
|
-
--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)))));
|
|
186
|
-
--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))));
|
|
187
|
-
--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)));
|
|
188
|
-
--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))));
|
|
189
|
-
--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)));
|
|
190
|
-
--diffs-selection-base: var(--diffs-modified-base);
|
|
191
|
-
--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)));
|
|
192
|
-
background-color: var(--diffs-bg);
|
|
193
|
-
color: var(--diffs-fg);
|
|
194
|
-
display: block;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
pre, code, [data-error-wrapper] {
|
|
198
|
-
isolation: isolate;
|
|
199
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
200
|
-
outline: none;
|
|
201
|
-
margin: 0;
|
|
202
|
-
padding: 0;
|
|
203
|
-
display: block;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
pre, code {
|
|
207
|
-
background-color: var(--diffs-bg);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
code {
|
|
211
|
-
contain: content;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
input, button {
|
|
215
|
-
font-family: inherit;
|
|
216
|
-
font-size: inherit;
|
|
217
|
-
line-height: inherit;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
*, :before, :after {
|
|
221
|
-
box-sizing: border-box;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
[data-icon-sprite] {
|
|
225
|
-
display: none;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
[data-diffs-header], [data-separator] {
|
|
229
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
[data-diffs-header][data-sticky] {
|
|
233
|
-
z-index: 1;
|
|
234
|
-
background-color: var(--diffs-bg);
|
|
235
|
-
position: sticky;
|
|
236
|
-
top: 0;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
[data-file-info] {
|
|
240
|
-
color: var(--fg);
|
|
241
|
-
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
242
|
-
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
243
|
-
padding: 10px;
|
|
244
|
-
font-weight: 700;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
[data-diff], [data-file] {
|
|
248
|
-
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
249
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
250
|
-
|
|
251
|
-
&[data-dehydrated] {
|
|
252
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
256
|
-
background-color: var(--diffs-bg-context);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
@supports (-webkit-touch-callout: none) {
|
|
261
|
-
:host {
|
|
262
|
-
--diffs-scrollbar-gutter-fallback: 0px;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
[data-line] span, [data-edit-prediction-suffix] span {
|
|
267
|
-
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
268
|
-
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
269
|
-
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
270
|
-
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
271
|
-
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
|
|
275
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
276
|
-
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
277
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
278
|
-
--diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
|
|
279
|
-
--diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
|
|
280
|
-
--diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
|
|
281
|
-
--diffs-line-bg: var(--diffs-computed-hovered-line-bg);
|
|
282
|
-
color: var(--diffs-fg);
|
|
283
|
-
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
[data-line], [data-no-newline] {
|
|
287
|
-
&[data-decoration-bg] {
|
|
288
|
-
--mix-deco-light: 92%;
|
|
289
|
-
--mix-deco-dark: 85%;
|
|
290
|
-
|
|
291
|
-
&[data-decoration-bg-depth="2"] {
|
|
292
|
-
--mix-deco-light: 88%;
|
|
293
|
-
--mix-deco-dark: 80%;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
&[data-decoration-bg-depth="3"] {
|
|
297
|
-
--mix-deco-light: 85%;
|
|
298
|
-
--mix-deco-dark: 78%;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
--diffs-hover-mix-target: var(--diffs-decoration-bg);
|
|
302
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
303
|
-
var(--diffs-bg) var(--mix-deco-light),
|
|
304
|
-
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
305
|
-
var(--diffs-bg) var(--mix-deco-dark),
|
|
306
|
-
var(--diffs-decoration-bg)));
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
311
|
-
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
312
|
-
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
313
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
[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"] {
|
|
317
|
-
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
318
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
322
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
323
|
-
var(--diffs-bg) 78%,
|
|
324
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
325
|
-
var(--diffs-bg) 68%,
|
|
326
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
327
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
331
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
332
|
-
var(--diffs-bg) 78%,
|
|
333
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
334
|
-
var(--diffs-bg) 68%,
|
|
335
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
336
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
340
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
341
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
:where([data-background]) {
|
|
345
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
346
|
-
--mix-light: 91%;
|
|
347
|
-
--mix-dark: 85%;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
& [data-line], & [data-no-newline] {
|
|
351
|
-
--mix-light: 88%;
|
|
352
|
-
--mix-dark: 80%;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
356
|
-
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
357
|
-
|
|
358
|
-
&[data-line-type="change-deletion"] {
|
|
359
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
360
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
361
|
-
|
|
362
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
363
|
-
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
364
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
368
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
369
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
370
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
371
|
-
var(--diffs-diff-line-mix-target)));
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
&[data-line-type="change-addition"] {
|
|
375
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
376
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
377
|
-
|
|
378
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
379
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
380
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
384
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
385
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
386
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
387
|
-
var(--diffs-diff-line-mix-target)));
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
&[data-merge-conflict="current"] {
|
|
391
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
392
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
393
|
-
|
|
394
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
395
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
396
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
400
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
401
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
402
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
403
|
-
var(--diffs-diff-line-mix-target)));
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
&[data-merge-conflict="incoming"] {
|
|
407
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
408
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
409
|
-
|
|
410
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
411
|
-
color: var(--diffs-modified-base);
|
|
412
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
416
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
417
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
418
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
419
|
-
var(--diffs-diff-line-mix-target)));
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
|
|
425
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
426
|
-
--diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
|
|
427
|
-
|
|
428
|
-
&:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
429
|
-
--mix-selection-light: 82%;
|
|
430
|
-
--mix-selection-dark: 75%;
|
|
431
|
-
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
&:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
|
|
435
|
-
--mix-selection-light: 75%;
|
|
436
|
-
--mix-selection-dark: 60%;
|
|
437
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
438
|
-
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
&:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
442
|
-
--diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
|
|
443
|
-
var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
|
|
444
|
-
var(--mix-selection-light),
|
|
445
|
-
var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
&:where([data-editor-overlay]), &[data-selected-line] {
|
|
449
|
-
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
450
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
451
|
-
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
452
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
453
|
-
var(--diffs-selection-mix-target)));
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
[data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
|
|
458
|
-
--diffs-computed-editor-active-line-bg: color-mix(in lab,
|
|
459
|
-
var(--diffs-computed-selected-line-bg)
|
|
460
|
-
var(--diffs-editor-active-line-source-mix, 100%),
|
|
461
|
-
var(--diffs-selection-emphasis-mix-target));
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
@media (pointer: fine) {
|
|
465
|
-
[data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
|
|
466
|
-
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
467
|
-
var(--diffs-computed-editor-active-line-bg) 97%,
|
|
468
|
-
var(--diffs-hover-mix-target)), color-mix(in lab,
|
|
469
|
-
var(--diffs-computed-editor-active-line-bg) 91%,
|
|
470
|
-
var(--diffs-hover-mix-target)));
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
[data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
|
|
475
|
-
color: var(--diffs-selection-number-fg);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
[data-no-newline] {
|
|
479
|
-
user-select: none;
|
|
480
|
-
|
|
481
|
-
& span {
|
|
482
|
-
opacity: .6;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
[data-diff-type="split"][data-overflow="scroll"] {
|
|
487
|
-
grid-template-columns: 1fr 1fr;
|
|
488
|
-
display: grid;
|
|
489
|
-
|
|
490
|
-
& [data-additions] {
|
|
491
|
-
border-left: 1px solid var(--diffs-bg);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
& [data-deletions] {
|
|
495
|
-
border-right: 1px solid var(--diffs-bg);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
[data-code] {
|
|
500
|
-
grid-auto-flow: dense;
|
|
501
|
-
grid-template-columns: var(--diffs-code-grid);
|
|
502
|
-
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
503
|
-
overscroll-behavior-x: none;
|
|
504
|
-
tab-size: var(--diffs-tab-size, 2);
|
|
505
|
-
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
506
|
-
padding-bottom: max(0px,
|
|
507
|
-
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
508
|
-
var(--diffs-scrollbar-gutter)));
|
|
509
|
-
scrollbar-gutter: stable;
|
|
510
|
-
align-self: flex-start;
|
|
511
|
-
display: grid;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
[data-diffs-scrollbar-measure] {
|
|
515
|
-
opacity: 0;
|
|
516
|
-
pointer-events: none;
|
|
517
|
-
scrollbar-gutter: auto;
|
|
518
|
-
grid-template-columns: none;
|
|
519
|
-
width: 100px;
|
|
520
|
-
height: 100px;
|
|
521
|
-
padding: 0;
|
|
522
|
-
position: absolute;
|
|
523
|
-
top: -200px;
|
|
524
|
-
left: -200px;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
[data-container-size] {
|
|
528
|
-
container-type: inline-size;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
[data-code]::-webkit-scrollbar {
|
|
532
|
-
width: 0;
|
|
533
|
-
height: var(--diffs-scrollbar-gutter);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
[data-code]::-webkit-scrollbar-track {
|
|
537
|
-
background: none;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
[data-code]::-webkit-scrollbar-thumb {
|
|
541
|
-
background-color: #0000;
|
|
542
|
-
background-clip: content-box;
|
|
543
|
-
border: 1px solid #0000;
|
|
544
|
-
border-radius: 3px;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
[data-code]::-webkit-scrollbar-corner {
|
|
548
|
-
background-color: #0000;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
@supports ((-moz-appearance: none)) {
|
|
552
|
-
[data-code] {
|
|
553
|
-
scrollbar-width: thin;
|
|
554
|
-
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
555
|
-
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
560
|
-
& [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
561
|
-
padding-top: 0;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
[data-gutter] {
|
|
566
|
-
grid-template-rows: subgrid;
|
|
567
|
-
grid-template-columns: subgrid;
|
|
568
|
-
z-index: 3;
|
|
569
|
-
background-color: var(--diffs-bg);
|
|
570
|
-
grid-column: 1;
|
|
571
|
-
display: grid;
|
|
572
|
-
position: relative;
|
|
573
|
-
|
|
574
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
575
|
-
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
[data-content] {
|
|
580
|
-
grid-template-rows: subgrid;
|
|
581
|
-
grid-template-columns: subgrid;
|
|
582
|
-
background-color: var(--diffs-bg);
|
|
583
|
-
grid-column: 2;
|
|
584
|
-
min-width: 0;
|
|
585
|
-
display: grid;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
[data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
589
|
-
grid-auto-flow: dense;
|
|
590
|
-
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
591
|
-
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
592
|
-
display: grid;
|
|
593
|
-
|
|
594
|
-
& [data-code] {
|
|
595
|
-
display: contents;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
& [data-deletions] {
|
|
599
|
-
& [data-gutter] {
|
|
600
|
-
grid-column: 1;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
& [data-content] {
|
|
604
|
-
border-right: 1px solid var(--diffs-bg);
|
|
605
|
-
grid-column: 2;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
& [data-additions] {
|
|
610
|
-
& [data-gutter] {
|
|
611
|
-
border-left: 1px solid var(--diffs-bg);
|
|
612
|
-
grid-column: 3;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
& [data-content] {
|
|
616
|
-
grid-column: 4;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
|
|
622
|
-
overflow: clip;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
[data-overflow="scroll"] [data-gutter] {
|
|
626
|
-
position: sticky;
|
|
627
|
-
left: 0;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
[data-interactive-lines] [data-line] {
|
|
631
|
-
cursor: pointer;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
[data-interactive-line-numbers] [data-column-number] {
|
|
635
|
-
cursor: pointer;
|
|
636
|
-
touch-action: none;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
[data-content-buffer], [data-gutter-buffer] {
|
|
640
|
-
user-select: none;
|
|
641
|
-
min-height: 1lh;
|
|
642
|
-
position: relative;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
[data-gutter-buffer] {
|
|
646
|
-
padding-left: 2ch;
|
|
647
|
-
padding-right: 1ch;
|
|
648
|
-
|
|
649
|
-
&:before {
|
|
650
|
-
content: "";
|
|
651
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
652
|
-
display: block;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
[data-gutter-buffer="annotation"] {
|
|
657
|
-
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
658
|
-
min-height: 0;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
[data-gutter-buffer="buffer"] {
|
|
662
|
-
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
[data-content-buffer] {
|
|
666
|
-
background-position: 5px 0;
|
|
667
|
-
background-size: 8px 8px;
|
|
668
|
-
background-origin: border-box;
|
|
669
|
-
background-image: repeating-linear-gradient(-45deg,
|
|
670
|
-
transparent,
|
|
671
|
-
transparent calc(3px * 1.414),
|
|
672
|
-
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
673
|
-
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
674
|
-
grid-column: 1;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
[data-separator] {
|
|
678
|
-
box-sizing: content-box;
|
|
679
|
-
background-color: var(--diffs-bg);
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
[data-separator="simple"] {
|
|
683
|
-
min-height: 4px;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
687
|
-
background-color: var(--diffs-bg-separator);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
691
|
-
height: 32px;
|
|
692
|
-
position: relative;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
[data-separator-wrapper] {
|
|
696
|
-
user-select: none;
|
|
697
|
-
fill: currentColor;
|
|
698
|
-
background-color: var(--diffs-bg);
|
|
699
|
-
align-items: center;
|
|
700
|
-
height: 100%;
|
|
701
|
-
display: flex;
|
|
702
|
-
position: absolute;
|
|
703
|
-
inset-inline: 0;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
[data-content] [data-separator-wrapper] {
|
|
707
|
-
display: none;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
[data-separator="metadata"] [data-separator-wrapper] {
|
|
711
|
-
background-color: var(--diffs-bg-separator);
|
|
712
|
-
height: 100%;
|
|
713
|
-
color: var(--diffs-fg-number);
|
|
714
|
-
white-space: nowrap;
|
|
715
|
-
text-overflow: ellipsis;
|
|
716
|
-
min-width: min-content;
|
|
717
|
-
padding-inline: 1ch;
|
|
718
|
-
inset-inline: 100% auto;
|
|
719
|
-
overflow: hidden;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
[data-separator="line-info"] {
|
|
723
|
-
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
724
|
-
|
|
725
|
-
& [data-separator-wrapper] {
|
|
726
|
-
min-width: 16px;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
731
|
-
margin-block: 0;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
[data-separator="line-info"][data-separator-first] {
|
|
735
|
-
margin-top: 0;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
[data-separator="line-info"][data-separator-last] {
|
|
739
|
-
margin-bottom: 0;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
[data-expand-index] [data-separator-wrapper] {
|
|
743
|
-
grid-template-columns: 32px auto;
|
|
744
|
-
display: grid;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
748
|
-
grid-template-columns: 32px 32px auto;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
[data-expand-button], [data-separator-content] {
|
|
752
|
-
background-color: var(--diffs-bg-separator);
|
|
753
|
-
flex: none;
|
|
754
|
-
align-items: center;
|
|
755
|
-
display: flex;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
[data-expand-index] [data-separator-content]:hover {
|
|
759
|
-
cursor: pointer;
|
|
760
|
-
text-decoration: underline;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
[data-expand-button] {
|
|
764
|
-
cursor: pointer;
|
|
765
|
-
min-width: 32px;
|
|
766
|
-
color: var(--diffs-fg-number);
|
|
767
|
-
border-right: 2px solid var(--diffs-bg);
|
|
768
|
-
flex-shrink: 0;
|
|
769
|
-
justify-content: center;
|
|
770
|
-
align-self: stretch;
|
|
771
|
-
|
|
772
|
-
&:hover {
|
|
773
|
-
color: var(--diffs-fg);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
&[data-expand-all-button] {
|
|
777
|
-
display: none;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
[data-expand-down] [data-icon] {
|
|
782
|
-
transform: scaleY(-1);
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
[data-separator-content] {
|
|
786
|
-
height: 100%;
|
|
787
|
-
color: var(--diffs-fg-number);
|
|
788
|
-
flex: auto;
|
|
789
|
-
justify-content: flex-start;
|
|
790
|
-
padding: 0 1ch;
|
|
791
|
-
overflow: hidden;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
795
|
-
& [data-separator-content] {
|
|
796
|
-
user-select: none;
|
|
797
|
-
height: 100%;
|
|
798
|
-
overflow: clip;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
[data-unmodified-lines] {
|
|
803
|
-
text-overflow: ellipsis;
|
|
804
|
-
white-space: nowrap;
|
|
805
|
-
flex: 0 auto;
|
|
806
|
-
min-width: 0;
|
|
807
|
-
display: block;
|
|
808
|
-
overflow: hidden;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
@supports (width: 1cqi) {
|
|
812
|
-
[data-unified] {
|
|
813
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
814
|
-
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
815
|
-
width: 100cqi;
|
|
816
|
-
|
|
817
|
-
& [data-separator-content] {
|
|
818
|
-
border-radius: 6px;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
823
|
-
border-top-left-radius: unset;
|
|
824
|
-
border-bottom-left-radius: unset;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
[data-gutter] {
|
|
829
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
830
|
-
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
& [data-separator="line-info"] [data-separator-content] {
|
|
834
|
-
border-top-left-radius: 6px;
|
|
835
|
-
border-bottom-left-radius: 6px;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
839
|
-
border-top-left-radius: unset;
|
|
840
|
-
border-bottom-left-radius: unset;
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
[data-additions] {
|
|
845
|
-
& [data-content] [data-separator="line-info"] {
|
|
846
|
-
background-color: var(--diffs-bg);
|
|
847
|
-
|
|
848
|
-
& [data-separator-wrapper] {
|
|
849
|
-
display: none;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
854
|
-
background-color: var(--diffs-bg-separator);
|
|
855
|
-
border-top-right-radius: 6px;
|
|
856
|
-
border-bottom-right-radius: 6px;
|
|
857
|
-
height: 100%;
|
|
858
|
-
display: block;
|
|
859
|
-
|
|
860
|
-
& [data-separator-content], & [data-expand-button] {
|
|
861
|
-
display: none;
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
867
|
-
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
871
|
-
background-color: var(--diffs-bg-separator);
|
|
872
|
-
height: 100%;
|
|
873
|
-
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
874
|
-
border-top-right-radius: 6px;
|
|
875
|
-
border-bottom-right-radius: 6px;
|
|
876
|
-
display: block;
|
|
877
|
-
|
|
878
|
-
& [data-separator-content], & [data-expand-button] {
|
|
879
|
-
display: none;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
884
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
885
|
-
border-top-left-radius: 6px;
|
|
886
|
-
border-bottom-left-radius: 6px;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
@media (pointer: fine) {
|
|
891
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
892
|
-
&[data-separator-multi-button] {
|
|
893
|
-
& [data-expand-up] {
|
|
894
|
-
border-top-left-radius: 6px;
|
|
895
|
-
border-bottom-left-radius: unset;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
& [data-expand-down] {
|
|
899
|
-
border-bottom-left-radius: 6px;
|
|
900
|
-
border-top-left-radius: unset;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
@media (pointer: coarse) {
|
|
908
|
-
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
909
|
-
grid-template-columns: 34px 34px auto;
|
|
910
|
-
|
|
911
|
-
& [data-separator-content] {
|
|
912
|
-
grid-column: unset;
|
|
913
|
-
grid-row: unset;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
@supports (width: 1cqi) {
|
|
918
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
919
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
920
|
-
border-top-left-radius: 6px;
|
|
921
|
-
border-bottom-left-radius: 6px;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
&[data-separator-multi-button] {
|
|
925
|
-
& [data-expand-up] {
|
|
926
|
-
border-top-left-radius: 6px;
|
|
927
|
-
border-bottom-left-radius: 6px;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
& [data-expand-down] {
|
|
931
|
-
border-bottom-left-radius: unset;
|
|
932
|
-
border-top-left-radius: unset;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
@media (pointer: fine) {
|
|
940
|
-
[data-separator-wrapper][data-separator-multi-button] {
|
|
941
|
-
grid-template-rows: 50% 50%;
|
|
942
|
-
display: grid;
|
|
943
|
-
|
|
944
|
-
& [data-separator-content] {
|
|
945
|
-
grid-area: 1 / 2 / -1;
|
|
946
|
-
min-width: min-content;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
& [data-expand-button] {
|
|
950
|
-
grid-column: 1;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
955
|
-
grid-template-columns: 34px auto;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
959
|
-
grid-template-columns: 100% auto;
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
963
|
-
& [data-separator-multi-button] {
|
|
964
|
-
& [data-expand-up] {
|
|
965
|
-
border-bottom: 1px solid var(--diffs-bg);
|
|
966
|
-
border-right: 2px solid var(--diffs-bg);
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
& [data-expand-down] {
|
|
970
|
-
border-top: 1px solid var(--diffs-bg);
|
|
971
|
-
border-right: 2px solid var(--diffs-bg);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
978
|
-
display: none;
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
[data-line-annotation] {
|
|
982
|
-
min-height: var(--diffs-annotation-min-height, 0);
|
|
983
|
-
z-index: 2;
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
[data-merge-conflict-actions] {
|
|
987
|
-
z-index: 2;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
[data-separator="custom"] {
|
|
991
|
-
grid-template-columns: subgrid;
|
|
992
|
-
display: grid;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
[data-line], [data-column-number], [data-no-newline] {
|
|
996
|
-
padding-inline: 1ch;
|
|
997
|
-
position: relative;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
[data-indicators="classic"] [data-line] {
|
|
1001
|
-
padding-inline-start: 2ch;
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
[data-indicators="classic"] {
|
|
1005
|
-
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
1006
|
-
&[data-no-newline], &[data-line] {
|
|
1007
|
-
&:before {
|
|
1008
|
-
user-select: none;
|
|
1009
|
-
width: 1ch;
|
|
1010
|
-
height: 1lh;
|
|
1011
|
-
display: inline-block;
|
|
1012
|
-
position: absolute;
|
|
1013
|
-
top: 0;
|
|
1014
|
-
left: 0;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
& [data-line-type="change-addition"] {
|
|
1020
|
-
&[data-line], &[data-no-newline] {
|
|
1021
|
-
&:before {
|
|
1022
|
-
content: "+";
|
|
1023
|
-
color: var(--diffs-addition-base);
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
& [data-line-type="change-deletion"] {
|
|
1029
|
-
&[data-line], &[data-no-newline] {
|
|
1030
|
-
&:before {
|
|
1031
|
-
content: "-";
|
|
1032
|
-
color: var(--diffs-deletion-base);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
[data-indicators="bars"] {
|
|
1039
|
-
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
1040
|
-
&[data-column-number] {
|
|
1041
|
-
&:before {
|
|
1042
|
-
content: "";
|
|
1043
|
-
user-select: none;
|
|
1044
|
-
contain: strict;
|
|
1045
|
-
width: 4px;
|
|
1046
|
-
height: 100%;
|
|
1047
|
-
display: block;
|
|
1048
|
-
position: absolute;
|
|
1049
|
-
top: 0;
|
|
1050
|
-
left: 0;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
& [data-line-type="change-deletion"] {
|
|
1056
|
-
&[data-column-number] {
|
|
1057
|
-
&:before {
|
|
1058
|
-
background-image: linear-gradient(0deg,
|
|
1059
|
-
var(--diffs-bg-deletion) 50%,
|
|
1060
|
-
var(--diffs-deletion-base) 50%);
|
|
1061
|
-
background-repeat: repeat;
|
|
1062
|
-
background-size: 2px 2px;
|
|
1063
|
-
background-size: calc(1lh / round(1lh / 2px))
|
|
1064
|
-
calc(1lh / round(1lh / 2px));
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
& [data-line-type="change-addition"] {
|
|
1070
|
-
&[data-column-number] {
|
|
1071
|
-
&:before {
|
|
1072
|
-
background-color: var(--diffs-addition-base);
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
[data-overflow="wrap"] {
|
|
1079
|
-
& [data-line] {
|
|
1080
|
-
white-space: pre-wrap;
|
|
1081
|
-
word-break: break-word;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
& [data-annotation-content] {
|
|
1085
|
-
word-break: break-word;
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
[data-overflow="scroll"] [data-line] {
|
|
1090
|
-
white-space: pre;
|
|
1091
|
-
min-height: 1lh;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
[data-column-number] {
|
|
1095
|
-
box-sizing: content-box;
|
|
1096
|
-
text-align: right;
|
|
1097
|
-
user-select: none;
|
|
1098
|
-
color: var(--diffs-fg-number);
|
|
1099
|
-
padding-left: 2ch;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
[data-line-number-content] {
|
|
1103
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1104
|
-
z-index: 1;
|
|
1105
|
-
display: inline-block;
|
|
1106
|
-
position: relative;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
[data-disable-line-numbers] {
|
|
1110
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1111
|
-
min-width: 4px;
|
|
1112
|
-
padding: 0;
|
|
1113
|
-
|
|
1114
|
-
&:before {
|
|
1115
|
-
min-width: 0;
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
& [data-line-number-content] {
|
|
1120
|
-
display: none;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
& [data-gutter-utility-slot] {
|
|
1124
|
-
right: unset;
|
|
1125
|
-
justify-content: flex-start;
|
|
1126
|
-
left: 0;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1130
|
-
left: 6px;
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
[data-file][data-disable-line-numbers] {
|
|
1135
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1136
|
-
border-right: 0;
|
|
1137
|
-
min-width: 0;
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
[data-diff-span] {
|
|
1142
|
-
box-decoration-break: clone;
|
|
1143
|
-
border-radius: 3px;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
[data-line-type="change-addition"] [data-diff-span] {
|
|
1147
|
-
background-color: var(--diffs-bg-addition-emphasis);
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1151
|
-
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1155
|
-
color: var(--diffs-fg);
|
|
1156
|
-
padding-left: 1ch;
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1160
|
-
align-items: center;
|
|
1161
|
-
display: flex;
|
|
1162
|
-
|
|
1163
|
-
&:after {
|
|
1164
|
-
color: var(--diffs-fg-conflict-marker);
|
|
1165
|
-
font-size: .75rem;
|
|
1166
|
-
font-style: normal;
|
|
1167
|
-
line-height: 1.25rem;
|
|
1168
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1169
|
-
padding-left: 1ch;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
[data-merge-conflict="marker-start"]:after {
|
|
1174
|
-
content: "(Current Change)";
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
[data-merge-conflict="marker-end"]:after {
|
|
1178
|
-
content: "(Incoming Change)";
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
[data-merge-conflict-actions-content] {
|
|
1182
|
-
min-height: 1.75rem;
|
|
1183
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1184
|
-
color: var(--diffs-fg);
|
|
1185
|
-
align-items: center;
|
|
1186
|
-
gap: .25rem;
|
|
1187
|
-
padding-inline: .5rem;
|
|
1188
|
-
font-size: .75rem;
|
|
1189
|
-
line-height: 1.2;
|
|
1190
|
-
display: flex;
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
[data-merge-conflict-action] {
|
|
1194
|
-
appearance: none;
|
|
1195
|
-
color: var(--diffs-fg-number);
|
|
1196
|
-
font: inherit;
|
|
1197
|
-
cursor: pointer;
|
|
1198
|
-
background: none;
|
|
1199
|
-
border: 0;
|
|
1200
|
-
padding: 0;
|
|
1201
|
-
font-style: normal;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
[data-merge-conflict-action]:hover {
|
|
1205
|
-
color: var(--diffs-fg);
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
[data-merge-conflict-action="current"]:hover {
|
|
1209
|
-
color: var(--diffs-addition-base);
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
[data-merge-conflict-action="incoming"]:hover {
|
|
1213
|
-
color: var(--diffs-modified-base);
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
[data-merge-conflict-action-separator] {
|
|
1217
|
-
color: var(--diffs-fg-number);
|
|
1218
|
-
opacity: .6;
|
|
1219
|
-
user-select: none;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
[data-diffs-header="default"] {
|
|
1223
|
-
background-color: var(--diffs-bg);
|
|
1224
|
-
justify-content: space-between;
|
|
1225
|
-
align-items: center;
|
|
1226
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1227
|
-
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1228
|
-
z-index: 2;
|
|
1229
|
-
flex-direction: row;
|
|
1230
|
-
padding-inline: 16px;
|
|
1231
|
-
display: flex;
|
|
1232
|
-
position: relative;
|
|
1233
|
-
top: 0;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
[data-header-content] {
|
|
1237
|
-
align-items: center;
|
|
1238
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1239
|
-
white-space: nowrap;
|
|
1240
|
-
flex-direction: row;
|
|
1241
|
-
min-width: 0;
|
|
1242
|
-
display: flex;
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1246
|
-
text-overflow: ellipsis;
|
|
1247
|
-
white-space: nowrap;
|
|
1248
|
-
direction: rtl;
|
|
1249
|
-
min-width: 0;
|
|
1250
|
-
overflow: hidden;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
[data-prev-name] {
|
|
1254
|
-
opacity: .7;
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
[data-rename-icon] {
|
|
1258
|
-
fill: currentColor;
|
|
1259
|
-
flex-grow: 0;
|
|
1260
|
-
flex-shrink: 0;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
[data-diffs-header="default"] [data-metadata] {
|
|
1264
|
-
white-space: nowrap;
|
|
1265
|
-
align-items: center;
|
|
1266
|
-
gap: 1ch;
|
|
1267
|
-
display: flex;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
[data-diffs-header="default"] [data-additions-count] {
|
|
1271
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1272
|
-
color: var(--diffs-addition-base);
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
[data-diffs-header="default"] [data-deletions-count] {
|
|
1276
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1277
|
-
color: var(--diffs-deletion-base);
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
[data-change-icon] {
|
|
1281
|
-
fill: currentColor;
|
|
1282
|
-
flex-shrink: 0;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1286
|
-
color: var(--diffs-modified-base);
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
[data-change-icon="new"] {
|
|
1290
|
-
color: var(--diffs-addition-base);
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
[data-change-icon="deleted"] {
|
|
1294
|
-
color: var(--diffs-deletion-base);
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
[data-change-icon="file"] {
|
|
1298
|
-
opacity: .6;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
[data-annotation-content] {
|
|
1302
|
-
z-index: 2;
|
|
1303
|
-
isolation: isolate;
|
|
1304
|
-
white-space: normal;
|
|
1305
|
-
align-self: flex-start;
|
|
1306
|
-
min-width: 0;
|
|
1307
|
-
display: flow-root;
|
|
1308
|
-
position: relative;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1312
|
-
width: var(--diffs-column-content-width, auto);
|
|
1313
|
-
left: var(--diffs-column-number-width, 0);
|
|
1314
|
-
position: sticky;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
[data-annotation-slot] {
|
|
1318
|
-
text-wrap-mode: wrap;
|
|
1319
|
-
word-break: normal;
|
|
1320
|
-
white-space-collapse: collapse;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
[data-gutter-utility-slot] {
|
|
1324
|
-
touch-action: none;
|
|
1325
|
-
justify-content: flex-end;
|
|
1326
|
-
display: flex;
|
|
1327
|
-
position: absolute;
|
|
1328
|
-
top: 0;
|
|
1329
|
-
bottom: 0;
|
|
1330
|
-
right: 0;
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
[data-utility-button] {
|
|
1334
|
-
appearance: none;
|
|
1335
|
-
cursor: pointer;
|
|
1336
|
-
width: 1lh;
|
|
1337
|
-
height: 1lh;
|
|
1338
|
-
font-size: var(--diffs-font-size, 13px);
|
|
1339
|
-
line-height: var(--diffs-line-height, 20px);
|
|
1340
|
-
background-color: var(--diffs-modified-base);
|
|
1341
|
-
color: var(--diffs-bg);
|
|
1342
|
-
fill: currentColor;
|
|
1343
|
-
z-index: 4;
|
|
1344
|
-
touch-action: none;
|
|
1345
|
-
border: none;
|
|
1346
|
-
border-radius: 4px;
|
|
1347
|
-
justify-content: center;
|
|
1348
|
-
align-items: center;
|
|
1349
|
-
margin-right: calc(-1lh + 1ch);
|
|
1350
|
-
padding: 0;
|
|
1351
|
-
display: flex;
|
|
1352
|
-
position: relative;
|
|
1353
|
-
|
|
1354
|
-
&:before {
|
|
1355
|
-
content: "";
|
|
1356
|
-
display: block;
|
|
1357
|
-
position: absolute;
|
|
1358
|
-
inset: 0 0 0 -4px;
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
[data-decoration-bar-stack] {
|
|
1363
|
-
pointer-events: none;
|
|
1364
|
-
isolation: isolate;
|
|
1365
|
-
z-index: 1;
|
|
1366
|
-
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1367
|
-
box-sizing: content-box;
|
|
1368
|
-
border-left: 2px solid var(--diffs-bg);
|
|
1369
|
-
border-right: 2px solid var(--diffs-bg);
|
|
1370
|
-
width: 6px;
|
|
1371
|
-
position: absolute;
|
|
1372
|
-
top: 0;
|
|
1373
|
-
bottom: 0;
|
|
1374
|
-
right: -2px;
|
|
1375
|
-
|
|
1376
|
-
[data-decoration-bar-depth="1"] & {
|
|
1377
|
-
background-color: color-mix(in lab,
|
|
1378
|
-
var(--diffs-bg) 20%,
|
|
1379
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
[data-decoration-bar-depth="2"] & {
|
|
1383
|
-
background-color: color-mix(in lab,
|
|
1384
|
-
var(--diffs-bg) 45%,
|
|
1385
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
[data-decoration-bar-depth="3"] & {
|
|
1389
|
-
background-color: color-mix(in lab,
|
|
1390
|
-
var(--diffs-bg) 65%,
|
|
1391
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
[data-decoration-bar-start] & {
|
|
1395
|
-
border-top-left-radius: 5px;
|
|
1396
|
-
border-top-right-radius: 5px;
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
[data-decoration-bar-end] & {
|
|
1400
|
-
z-index: 3;
|
|
1401
|
-
border-bottom-right-radius: 5px;
|
|
1402
|
-
border-bottom-left-radius: 5px;
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
[data-placeholder] {
|
|
1407
|
-
contain: strict;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
[data-error-wrapper] {
|
|
1411
|
-
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1412
|
-
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1413
|
-
scrollbar-width: none;
|
|
1414
|
-
max-height: 400px;
|
|
1415
|
-
overflow: auto;
|
|
1416
|
-
|
|
1417
|
-
& [data-error-message] {
|
|
1418
|
-
color: var(--diffs-deletion-base);
|
|
1419
|
-
font-size: 18px;
|
|
1420
|
-
font-weight: bold;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
& [data-error-stack] {
|
|
1424
|
-
color: var(--diffs-fg-number);
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
@layer theme, rendered, unsafe;
|
|
1430
|
-
`,Vl;function Hl(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return Vl??=(()=>{let e=new CSSStyleSheet;return e.replaceSync(Bl),e})(),t.adoptedStyleSheets.includes(Vl)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,Vl]),t}function Ul(e,t){return e.reviewed.has(t.sha)?`reviewed`:e.changedSinceReviewed.has(t.path)?`changed`:`unreviewed`}var Wl=R({__name:`ReviewCheckbox`,props:{status:{},ariaLabel:{}},emits:[`update`],setup(e,{emit:n}){let a=e,o=n,s=u(()=>a.status===`reviewed`||a.status!==`unreviewed`&&`indeterminate`),c=u(()=>a.status===`changed`?`data-[state=indeterminate]:border-orange-500 data-[state=indeterminate]:bg-orange-500 focus-visible:ring-orange-500/40`:`data-[state=checked]:border-primary-500 data-[state=indeterminate]:border-primary-500 data-[state=checked]:bg-primary-500 data-[state=indeterminate]:bg-primary-500 focus-visible:ring-primary-500/40`);return(n,a)=>(r(),x(D(Xe),{class:i([`h-4 w-4 flex shrink-0 items-center justify-center border border-base rounded bg-raised outline-none transition focus-visible:ring-2`,c.value]),"model-value":s.value,"aria-label":e.ariaLabel,"onUpdate:modelValue":a[0]||=e=>o(`update`,e===!0)},{default:z(()=>[t(D(Ie),{class:`text-white`},{default:z(()=>[b(`div`,{class:i([s.value===`indeterminate`?`i-ph:minus-bold`:`i-ph:check-bold`,`mt--1px text-micro`]),"aria-hidden":`true`},null,2)]),_:1})]),_:1},8,[`class`,`model-value`,`aria-label`]))}}),Gl={class:`flex flex-col gap-1.5 px-3 py-2 text-sm`},Kl={class:`flex items-center gap-2`},ql={class:`font-medium`},Jl={key:0,class:`flex flex-col gap-2`},Yl={class:`flex justify-end gap-2`},Xl=R({__name:`ReviewCommentCard`,props:{comment:{},isViewer:{type:Boolean},busy:{type:Boolean}},emits:[`edit`,`delete`],setup(e,{emit:n}){let i=e,o=n,s=S(!1),u=S(``);function d(){u.value=i.comment.body,s.value=!0}function f(){u.value.trim()&&(o(`edit`,u.value),s.value=!1)}return(n,i)=>(r(),m(`article`,Gl,[b(`header`,Kl,[e.comment.author?(r(),x(Ct,{key:0,login:e.comment.author.login,"avatar-url":e.comment.author.avatarUrl,size:18},null,8,[`login`,`avatar-url`])):l(``,!0),b(`span`,ql,a(e.comment.author?.login??`ghost`),1),t(qe,{date:e.comment.createdAt,class:`text-xs op-fade`},null,8,[`date`]),e.comment.pending?(r(),x(He,{key:1,text:n.$t(`review.pending`),class:`text-xs text-amber-700 dark:text-amber-400`},null,8,[`text`])):l(``,!0),i[3]||=b(`div`,{class:`flex-auto`},null,-1),e.isViewer&&!s.value?(r(),m(g,{key:2},[t(W,{compact:``,icon:`i-ph:pencil-simple-duotone`,label:n.$t(`review.editComment`),disabled:e.busy,onClick:d},null,8,[`label`,`disabled`]),t(W,{compact:``,icon:`i-ph:trash-duotone`,label:n.$t(`review.deleteComment`),disabled:e.busy,onClick:i[0]||=e=>o(`delete`)},null,8,[`label`,`disabled`])],64)):l(``,!0)]),s.value?(r(),m(`div`,Jl,[t(Al,{modelValue:u.value,"onUpdate:modelValue":i[1]||=e=>u.value=e,rows:3,disabled:e.busy,onKeydown:[B(V(f,[`meta`]),[`enter`]),B(V(f,[`ctrl`]),[`enter`])]},null,8,[`modelValue`,`disabled`,`onKeydown`]),b(`div`,Yl,[t(U,{size:`sm`,variant:`text`,disabled:e.busy,onClick:i[2]||=e=>s.value=!1},{default:z(()=>[v(a(n.$t(`common.cancel`)),1)]),_:1},8,[`disabled`]),t(U,{size:`sm`,variant:`primary`,disabled:e.busy||!u.value.trim(),onClick:f},{default:z(()=>[v(a(n.$t(`common.save`)),1)]),_:1},8,[`disabled`])])])):(r(),x(c,{key:1},{default:z(()=>[t(D(ct),{value:e.comment.body,class:`review-comment-markdown text-sm`},null,8,[`value`])]),_:1}))]))}}),Zl={class:`my-1 max-w-200 overflow-hidden border border-base rounded-lg bg-base text-left font-sans`},Ql={class:`divide-y divide-#9992`},$l={key:0,class:`px-3 pb-1 text-xs text-red-600 dark:text-red-400`},eu={key:1,class:`flex flex-col gap-2 border-t border-base bg-raised px-2 py-1.5`},tu={class:`flex justify-end gap-2`},nu={key:1,class:`flex items-center gap-2`},ru={key:1,class:`flex-1`},iu=R({__name:`ReviewThreadCard`,props:{thread:{},reviews:{}},setup(e){let n=e,i=S(!1),o=S(),s=S(!1),c=S(``),d=u(()=>n.reviews.canWrite),f=u(()=>d.value&&!!n.thread.threadId&&!n.thread.pending);async function p(e){i.value=!0,o.value=void 0;try{await e()}catch(e){o.value=e instanceof Error?e.message:String(e)}finally{i.value=!1}}async function _(){let e=c.value;e.trim()&&await p(async()=>{await n.reviews.reply(n.thread.rootId,e),c.value=``,s.value=!1})}return(n,u)=>(r(),m(`div`,Zl,[b(`div`,Ql,[(r(!0),m(g,null,h(e.thread.comments,t=>(r(),x(Xl,{key:t.id,comment:t,"is-viewer":!!t.author&&t.author.login===e.reviews.viewerLogin,busy:i.value,onEdit:n=>p(()=>e.reviews.editComment(t.id,n)),onDelete:n=>p(()=>e.reviews.deleteComment(t.id))},null,8,[`comment`,`is-viewer`,`busy`,`onEdit`,`onDelete`]))),128))]),o.value?(r(),m(`p`,$l,a(o.value),1)):l(``,!0),d.value?(r(),m(`footer`,eu,[s.value?(r(),m(g,{key:0},[t(Al,{modelValue:c.value,"onUpdate:modelValue":u[0]||=e=>c.value=e,rows:2,placeholder:n.$t(`review.replyPlaceholder`),disabled:i.value,onKeydown:[B(V(_,[`meta`]),[`enter`]),B(V(_,[`ctrl`]),[`enter`])]},null,8,[`modelValue`,`placeholder`,`disabled`,`onKeydown`]),b(`div`,tu,[t(U,{size:`sm`,variant:`text`,disabled:i.value,onClick:u[1]||=e=>s.value=!1},{default:z(()=>[v(a(n.$t(`common.cancel`)),1)]),_:1},8,[`disabled`]),t(U,{size:`sm`,variant:`primary`,loading:i.value,disabled:!c.value.trim(),onClick:_},{default:z(()=>[v(a(n.$t(`common.reply`)),1)]),_:1},8,[`loading`,`disabled`])])],64)):(r(),m(`div`,nu,[e.thread.pending?(r(),m(`div`,ru)):(r(),m(`button`,{key:0,type:`button`,class:`flex-1 border border-base rounded bg-base px-2 py-1 text-left text-sm color-base op-fade hover:op-100`,onClick:u[2]||=e=>s.value=!0},a(n.$t(`review.replyPlaceholder`)),1)),f.value?(r(),x(U,{key:2,size:`sm`,disabled:i.value,icon:`i-ph:check-circle-duotone`,onClick:u[3]||=t=>p(()=>e.reviews.resolveThread(e.thread.threadId))},{default:z(()=>[v(a(n.$t(`review.resolve`)),1)]),_:1},8,[`disabled`])):l(``,!0)]))])):l(``,!0)]))}}),au={class:`sticky top-[calc(var(--diffs-header-height)-1px)] z-file-diff-header mt-2 bg-base`},ou=[`id`],su={class:`min-w-0 flex items-center gap-2 text-sm`},cu={class:`flex shrink-0 items-center gap-2`},lu={key:0,class:`text-xs op-fade`},uu={key:2,class:`text-xs op-fade`},du=[`title`],fu={key:0,class:`overflow-hidden border-x border-b border-base rounded-b-xl`},pu={key:0,class:`flex flex-wrap items-center justify-between gap-2 border-b border-orange:20 bg-orange:10 px-3 py-1.5 text-sm text-orange-700 dark:text-orange-400`},mu={class:`flex items-center gap-1.5`},hu={key:1,class:`mb-2 flex flex-col border-b border-base`},gu={key:2,class:`p-4 text-sm op-fade`},_u={key:3,class:`p-4 text-sm op-fade`},vu=[`slot`],yu={key:0,class:`my-1 max-w-200 overflow-hidden border border-base rounded-lg bg-base`},bu=640,xu=R({__name:`FileDiff`,props:{store:{},file:{},notes:{}},setup(e,{expose:s}){let c=e,f=u(()=>Ul(c.store,c.file)),p=u(()=>f.value===`reviewed`),y=u(()=>qc(c.notes)),C=u(()=>c.notes?.filter(e=>!e.anchor)??[]),T=w(Ve,ze),E=w(Pc,void 0),D=te(`container`),O=w(Fl,()=>d(new Map),!0),k=u({get:()=>O.get(c.file.sha)??(p.value||zl(c.file.path)),set:e=>O.set(c.file.sha,e)}),A;function j(e){let t=e.previousPath??e.path,n=e.path,r=[`diff --git a/${t} b/${n}`];e.status===`added`?r.push(`new file mode 100644`):e.status===`removed`?r.push(`deleted file mode 100644`):e.status===`renamed`?r.push(`rename from ${t}`,`rename to ${n}`):e.status===`copied`&&r.push(`copy from ${t}`,`copy to ${n}`),r.push(`--- ${e.status===`added`?`/dev/null`:`a/${t}`}`),r.push(`+++ ${e.status===`removed`?`/dev/null`:`b/${n}`}`);for(let t of e.hunks)r.push(t.header,t.patch);return r.join(`
|
|
1431
|
-
`)}let M=S(),N=S(),F=S(!1),I=S(),L=u(()=>M.value!==void 0||N.value!==void 0),ee=u(()=>!!c.store.fileContent&&!c.file.isBinary&&!L.value);async function R(){let{fileContent:e}=c.store;if(!(!e||F.value||L.value)){F.value=!0,I.value=void 0;try{let t=await e.load(c.file);M.value=t.old,N.value=t.new}catch(e){I.value=e instanceof Error?e:Error(String(e))}finally{F.value=!1}}}function ne(e){for(let t of e.composedPath()){if(!(t instanceof HTMLElement)||!t.hasAttribute(`data-expand-button`)&&!t.hasAttribute(`data-unmodified-lines`))continue;let n=Number(t.getAttribute(`data-expand-index`));if(Number.isNaN(n))return;let r=t.hasAttribute(`data-expand-up`)?`up`:t.hasAttribute(`data-expand-down`)?`down`:`both`;return{index:n,direction:t.hasAttribute(`data-expand-all-button`)||e.shiftKey?`both`:r}}}async function re(e){if(!ee.value)return;let t=ne(e);t&&(await R(),L.value&&(await o(),A?.expandHunk(t.index,t.direction,t.direction===`both`?1/0:void 0)))}let B=u(()=>{if(k.value||c.file.isBinary)return;let e=c.file.previousPath??c.file.path;return Ta(j(c.file),L.value?{oldFile:M.value===void 0?void 0:{name:e,contents:M.value},newFile:N.value===void 0?void 0:{name:c.file.path,contents:N.value}}:void 0)}),ie=S(0),ae;P(D,(e,t)=>{t&&ae?.unobserve(t),e&&(ae??=new ResizeObserver(e=>{ie.value=e[0]?.contentRect.width??0}),ae.observe(e))},{immediate:!0}),n(()=>ae?.disconnect());let oe=u(()=>c.store.reviews),H=u(()=>{let e=oe.value;return e?e.threads.filter(t=>t.path===c.file.path&&t.line!==void 0&&!t.outdated&&t.resolved!==!0&&(e.showThreads||t.pending)):[]}),se=u(()=>oe.value?.threads.filter(e=>e.path===c.file.path&&e.resolved===!0).length??0),ce=S(),le=S(!1),ue=S(),de=u(()=>{let e=new Map;function t(t,n){let r=`${t}-${n}`,i=e.get(r);return i||(i={side:t,line:n,notes:[],threads:[],hasDraft:!1},e.set(r,i)),i}for(let e of c.notes??[])e.anchor&&t(e.anchor.side,e.anchor.line).notes.push(e);for(let e of H.value)t(e.side,e.line).threads.push(e);return ce.value&&(t(ce.value.side,ce.value.line).hasDraft=!0),[...e.values()]}),fe=u(()=>de.value.map(e=>({side:e.side,lineNumber:e.line}))),pe=u(()=>(oe.value?.canWrite??!1)&&!c.file.isBinary);function me(e){let t=e.endSide??e.side??`additions`,n=Math.max(e.start,e.end),r=Math.min(e.start,e.end);ce.value={path:c.file.path,side:t,line:n,...r<n?{startLine:r,startSide:e.side??t}:{}},ue.value=void 0}async function he(e,t){let n=ce.value,r=oe.value;if(n&&r){le.value=!0,ue.value=void 0;try{await r.addComment(n,e,t),ce.value=void 0}catch(e){ue.value=e instanceof Error?e.message:String(e)}finally{le.value=!1}}}let ge=u(()=>c.file.additions===0||c.file.deletions===0),_e=u(()=>c.store.ui.layout===`unified`||ge.value||ie.value>0&&ie.value<bu?`unified`:c.store.ui.layout),ve=u(()=>({diffStyle:_e.value,overflow:Ke.value?`wrap`:`scroll`,theme:{...nt.value},themeType:T.value?`dark`:`light`,disableErrorHandling:!1,disableFileHeader:!0,...pe.value?{enableGutterUtility:!0,enableLineSelection:!0,onGutterUtilityClick:me}:{}}));function ye(){A?.cleanUp(),D.value&&!c.file.isBinary&&!k.value&&B.value&&(Hl(D.value).addEventListener(`click`,re),A=E?new cc(ve.value,E,void 0,void 0,!0):new Js(ve.value,void 0,!0),A.render({fileDiff:B.value,fileContainer:D.value,lineAnnotations:fe.value.map(e=>({...e}))}))}return _(ye),n(()=>A?.cleanUp()),P(k,()=>ye(),{flush:`post`}),P(ve,e=>{A?.setOptions(e),A?.rerender()}),P([B,D],([e,t])=>{e&&t&&A?.render({fileDiff:e,fileContainer:t,lineAnnotations:fe.value.map(e=>({...e}))})}),P(fe,e=>{A?.setLineAnnotations(e.map(e=>({...e}))),A?.rerender()}),P(p,e=>{k.value=e}),s({expand:()=>{k.value=!1}}),(n,o)=>(r(),m(g,null,[b(`div`,au,[b(`header`,{id:`file-${e.file.sha}`,class:i([`relative flex items-center justify-between gap-2 overflow-hidden border border-base bg-base px-2 py-1.5`,k.value?`rounded-lg`:`rounded-t-lg`]),role:`button`,onClick:o[2]||=V(e=>k.value=!k.value,[`self`])},[b(`div`,su,[t(Wl,{status:f.value,"aria-label":n.$t(`file.markReviewed`),onUpdate:o[0]||=t=>e.store.setReviewed([e.file.sha],t)},null,8,[`status`,`aria-label`]),t(El,{path:e.file.path,class:`min-w-0`},null,8,[`path`]),y.value?(r(),x(Wc,{key:0})):l(``,!0)]),b(`div`,cu,[se.value?(r(),m(`span`,lu,a(n.$t(`file.resolved`,{n:se.value})),1)):l(``,!0),e.file.isBinary?(r(),m(`span`,uu,a(n.$t(`file.binary`)),1)):(r(),x(St,{key:1,additions:e.file.additions,deletions:e.file.deletions},null,8,[`additions`,`deletions`])),t(Ll,{status:e.file.status},null,8,[`status`]),I.value?(r(),m(`span`,{key:3,class:`text-xs text-red-500`,title:I.value.message},a(n.$t(`file.loadFailed`)),9,du)):l(``,!0),ee.value||F.value?(r(),x(W,{key:4,compact:``,icon:F.value?`i-ph:spinner-duotone animate-spin`:`i-ph:file-text-duotone`,disabled:F.value,label:n.$t(`file.loadFull`),tooltip:n.$t(`file.loadFull`),onClick:R},null,8,[`icon`,`disabled`,`label`,`tooltip`])):l(``,!0),t(W,{compact:``,icon:k.value?`i-ph:caret-right`:`i-ph:caret-down`,label:n.$t(k.value?`file.expand`:`file.collapse`),onClick:o[1]||=e=>k.value=!k.value},null,8,[`icon`,`label`])])],10,ou)]),k.value?l(``,!0):(r(),m(`div`,fu,[f.value===`changed`?(r(),m(`div`,pu,[b(`span`,mu,[o[5]||=b(`span`,{class:`i-ph:warning-circle-duotone shrink-0`,"aria-hidden":`true`},null,-1),v(` `+a(n.$t(`file.changedSinceReviewed`)),1)]),t(U,{size:`sm`,onClick:o[3]||=t=>e.store.setReviewed([e.file.sha],!0)},{default:z(()=>[v(a(n.$t(`file.markReviewed`)),1)]),_:1})])):l(``,!0),C.value.length?(r(),m(`div`,hu,[(r(!0),m(g,null,h(C.value,(e,t)=>(r(),x(Ol,{key:t,note:e,borderless:!0},null,8,[`note`]))),128))])):l(``,!0),e.file.isBinary?(r(),m(`div`,gu,a(n.$t(`file.binaryNotShown`)),1)):e.file.truncated&&!L.value?(r(),m(`div`,_u,a(n.$t(`file.tooLarge`)),1)):(r(),m(`div`,{key:4,ref:`container`,class:i(f.value===`changed`?`mb--2`:`my--2`)},[(r(!0),m(g,null,h(de.value,n=>(r(),m(`div`,{key:`${n.side}-${n.line}`,slot:`annotation-${n.side}-${n.line}`,"data-annotation-slot":``,class:`whitespace-normal px-2 text-left font-sans`},[(r(!0),m(g,null,h(n.notes,(e,t)=>(r(),x(Ol,{key:t,note:e},null,8,[`note`]))),128)),(r(!0),m(g,null,h(n.threads,t=>(r(),x(iu,{key:t.rootId,thread:t,reviews:e.store.reviews},null,8,[`thread`,`reviews`]))),128)),n.hasDraft?(r(),m(`div`,yu,[t(Pl,{"has-pending-review":!!e.store.reviews.pendingReview,busy:le.value,error:ue.value,onSubmit:he,onCancel:o[4]||=e=>ce.value=void 0},null,8,[`has-pending-review`,`busy`,`error`])])):l(``,!0)],8,vu))),128))],2))]))],64))}});function Su(e,t,n){let r=[...e.map(e=>({path:e.path,file:e})),...t.map(e=>({path:e,file:void 0}))];if(n===`list`)return r.map(({path:e,file:t})=>t?{key:`file:${e}`,depth:0,type:`file`,name:e,file:t}:{key:`missing:${e}`,depth:0,type:`missing`,name:e});let i={name:``,children:new Map};for(let{path:e,file:t}of r){let n=e.split(`/`),r=i;for(let e=0;e<n.length-1;e++){let t=n[e],i=r.children.get(t);i||(i={name:t,children:new Map},r.children.set(t,i)),r=i}r.children.set(`\0file:${e}`,{name:n[n.length-1],children:new Map,file:t,missing:!t})}function a(e){let t=[];for(let n of e.children.values())t.push(...n.file?[n.file]:a(n));return t}let o=[];function s(e,t,n){for(let[r,i]of e.children){if(i.file){o.push({key:`file:${i.file.path}`,depth:t,type:`file`,name:i.name,file:i.file});continue}if(i.missing){o.push({key:`missing:${n}${i.name}`,depth:t,type:`missing`,name:i.name});continue}let e=i.name,c=i,l=`${n}${r}/`;for(;c.children.size===1;){let[t,n]=[...c.children.entries()][0];if(n.file||n.missing)break;e+=`/${n.name}`,c=n,l+=`${t}/`}o.push({key:`folder:${l}`,depth:t,type:`folder`,name:e,files:a(c)}),s(c,t+1,l)}}return s(i,0,``),o}var Cu={ref:`scrollEl`,class:`overflow-auto`},wu={class:`truncate op-fade`},Tu=[`title`,`onClick`],Eu=[`title`],Du={class:`shrink-0 text-xs`},Ou=R({__name:`FileTree`,props:{store:{},files:{},notes:{},missing:{},filesVisible:{},layout:{}},emits:[`navigate`],setup(e,{emit:n}){let o=e,c=n,d=u(()=>Su(o.files,o.missing??[],o.layout));function f(e){let t=e.filter(e=>o.store.reviewed.has(e.sha)).length;return t===0?`unreviewed`:t===e.length?`reviewed`:`partial`}let p=te(`scrollEl`),_=he(u(()=>({count:d.value.length,getScrollElement:()=>p.value,estimateSize:()=>24,overscan:10})));return(n,o)=>(r(),m(`div`,Cu,[b(`div`,{style:s({height:`${D(_).getTotalSize()}px`,position:`relative`})},[(r(!0),m(g,null,h(D(_).getVirtualItems().map(e=>({item:e,row:d.value[e.index]})),u=>(r(),m(`div`,{key:u.row.key,class:i([`flex items-center gap-1.5 rounded text-sm`,u.row.file&&e.filesVisible.includes(u.row.file.sha)?`bg-active`:``]),style:s({position:`absolute`,top:0,left:0,width:`100%`,height:`${u.item.size}px`,transform:`translateY(${u.item.start}px)`,paddingLeft:`${.5+u.row.depth}em`})},[u.row.type===`folder`?(r(),m(g,{key:0},[t(Wl,{status:f(u.row.files),"aria-label":n.$t(`file.markFolderReviewed`,{name:u.row.name}),onUpdate:t=>e.store.setReviewed(u.row.files.map(e=>e.sha),t)},null,8,[`status`,`aria-label`,`onUpdate`]),t(yt,{directory:``,path:u.row.name,class:`op-fade`},null,8,[`path`]),b(`span`,wu,a(u.row.name),1)],64)):u.row.file?(r(),m(g,{key:1},[t(Wl,{status:D(Ul)(e.store,u.row.file),"aria-label":n.$t(`file.markReviewed`),onUpdate:t=>e.store.setReviewed([u.row.file.sha],t)},null,8,[`status`,`aria-label`,`onUpdate`]),b(`button`,{type:`button`,class:`min-w-0 flex flex-1 items-center gap-1.5 text-left`,title:D(Ul)(e.store,u.row.file)===`changed`?n.$t(`file.changedSinceReviewed`):void 0,onClick:e=>c(`navigate`,u.row.file.sha)},[t(El,{path:u.row.name,dim:e.layout===`list`,class:`min-w-0 flex-1`},null,8,[`path`,`dim`]),D(qc)(e.notes?.get(u.row.file.sha))?(r(),x(Wc,{key:0,class:`text-sm`})):l(``,!0),t(St,{additions:u.row.file.additions,deletions:u.row.file.deletions},null,8,[`additions`,`deletions`]),t(Ll,{status:u.row.file.status},null,8,[`status`])],8,Tu)],64)):u.row.type===`missing`?(r(),m(g,{key:2},[o[0]||=b(`span`,{class:`w-4 shrink-0`,"aria-hidden":`true`},null,-1),b(`span`,{class:`min-w-0 flex flex-1 items-center gap-1.5 op-50`,title:n.$t(`file.noLongerInDiff`)},[t(El,{path:u.row.name,dim:e.layout===`list`,class:`min-w-0 flex-1 line-through`},null,8,[`path`,`dim`]),b(`span`,Du,a(n.$t(`file.removed`)),1)],8,Eu)],64)):l(``,!0)],6))),128))],4)],512))}}),ku=[`id`],Au={key:0,class:`flex flex-col gap-2 border-b border-base p-3`},ju={class:`w-full flex items-center`},Mu=[`aria-expanded`],Nu={class:`min-w-0 flex flex-1 flex-col gap-1.5`},Pu={class:`flex items-center gap-2 leading-1em`},Fu=[`title`],Iu={class:`flex items-center gap-2 leading-1em`},Lu={class:`text-xs op-fade`},Ru={class:`text-xs op-fade`},zu={key:0,class:`flex shrink-0 items-center gap-1 px-2`},Bu={key:1,class:`flex flex-col gap-4 p-3 lg:grid lg:grid-cols-[1fr_4fr]`},Vu={class:`top-[calc(var(--diffs-header-height)+10px)] min-w-70 flex shrink-0 flex-col gap-3 lg:sticky lg:max-h-[calc(100vh-var(--diffs-header-height)-20px)] lg:self-start`},Hu={key:0,class:`w-full flex flex-col bg-base`},Uu={class:`w-full flex items-center`},Wu=[`aria-expanded`],Gu={class:`min-w-0 flex-1`},Ku={class:`flex items-center gap-2 leading-1em`},qu=[`title`],Ju=[`title`],Yu={class:`flex items-center gap-2 leading-1em`},Xu={class:`text-xs op-fade`},Zu={key:0,class:`flex shrink-0 items-center gap-1 px-2`},Qu={class:`min-w-0 flex flex-col`},$u=[`data-file-start`],ed={key:2,class:`flex flex-col gap-4`},td=R({__name:`DiffGroup`,props:{store:{},group:{},collapsed:{type:Boolean},parentLabel:{},parentKey:{},filesVisible:{}},emits:[`toggle`],setup(e,{emit:n}){let i=e,d=n,f=u(()=>Xc(i.group)),p=u(()=>Zc(i.group)),_=u(()=>$c(i.group)),v=u(()=>_.value.added),y=u(()=>_.value.deleted),C=u(()=>[...i.group.files,...i.group.children.flatMap(e=>e.files)].filter(e=>i.store.reviewed.has(e.sha)).length),w=S(new Set);function T(e){let t=new Set(w.value);t.has(e)?t.delete(e):t.add(e),w.value=t}let E=S(),O=S(),k=zc(E,O,()=>i.group.label,14,20),A=u(()=>!i.parentLabel&&i.group.children.length>0),j=new Map;function M(e,t){t?j.set(e,t.$el):j.delete(e)}function N(e){j.get(e)?.scrollIntoView({behavior:`smooth`,block:`start`})}function P(){i.parentKey&&document.getElementById(`group-${i.parentKey}`)?.scrollIntoView({behavior:`smooth`,block:`start`})}let F=u(()=>f.value===0?1:C.value/f.value),I=new Map;function ee(e,t){t?I.set(e,t):I.delete(e)}function R(e){I.get(e)?.expand(),o(()=>{Lc(document,e)})}return(n,i)=>(r(),m(`section`,{id:`group-${e.group.key}`,class:`scroll-mt-[var(--diffs-header-height)]`},[A.value?(r(),m(`header`,Au,[b(`div`,ju,[b(`button`,{type:`button`,class:`min-w-0 flex flex-1 items-start px-2 py-1 text-left`,"aria-expanded":!e.collapsed,onClick:i[0]||=e=>d(`toggle`)},[t(W,{compact:``,class:`ml--5 py2 op-mute hover:op-100`,icon:e.collapsed?`i-ph:caret-right`:`i-ph:caret-down`,label:n.$t(`group.toggle`),as:`span`},null,8,[`icon`,`label`]),b(`div`,Nu,[b(`div`,Pu,[t(_t,{category:e.group.category,class:`text-xl`},null,8,[`category`]),b(`span`,{class:`truncate text-2xl font-medium leading-1em`,title:e.group.label},a(e.group.label),9,Fu),p.value?(r(),x(Wc,{key:0,class:`text-xl`})):l(``,!0)]),b(`div`,Iu,[t(St,{additions:v.value,deletions:y.value},null,8,[`additions`,`deletions`]),b(`span`,Lu,a(n.$t(`common.files`,{n:f.value},f.value)),1),b(`span`,Ru,a(n.$t(`common.subgroups`,{n:e.group.children.length},e.group.children.length)),1),t(ut,{value:F.value,size:12,thickness:2.5},null,8,[`value`])])])],8,Mu),n.$slots.actions?(r(),m(`div`,zu,[L(n.$slots,`actions`)])):l(``,!0)]),e.collapsed?l(``,!0):(r(),m(g,{key:0},[e.group.summary?(r(),x(c,{key:0},{default:z(()=>[t(D(ct),{value:e.group.summary,class:`max-w-200 px-2 text-sm op-fade`},null,8,[`value`])]),_:1})):l(``,!0),D(Nc)?l(``,!0):(r(),x(fl,{key:1,class:`px-2`,groups:e.group.children.map(e=>({...e,children:[]})),"groups-visable":[],reviewed:e.store.reviewed,onSelect:N},null,8,[`groups`,`reviewed`]))],64))])):l(``,!0),!A.value||!e.collapsed&&e.group.files.length?(r(),m(`div`,Bu,[b(`aside`,Vu,[A.value?l(``,!0):(r(),m(`header`,Hu,[e.parentLabel?(r(),m(`button`,{key:0,type:`button`,class:`self-start truncate pb1 pl2 text-xs leading-1em op-fade hover:op-100`,onClick:P},a(e.parentLabel)+` › `,1)):l(``,!0),b(`div`,Uu,[b(`button`,{type:`button`,class:`min-w-0 flex flex-1 items-start px-2 py-1 text-left text-sm`,"aria-expanded":!e.collapsed,onClick:i[1]||=e=>d(`toggle`)},[t(W,{compact:``,class:`ml--5 py1.5 op-mute hover:op-100`,icon:e.collapsed?`i-ph:caret-right`:`i-ph:caret-down`,label:n.$t(`group.toggle`),as:`span`},null,8,[`icon`,`label`]),b(`div`,Gu,[b(`div`,Ku,[t(_t,{category:e.group.category,class:`text-base`},null,8,[`category`]),b(`span`,{ref_key:`labelBox`,ref:E,class:`min-w-0 flex-1 truncate text-xl font-medium`,style:s({fontSize:`${D(k)}px`}),title:e.group.label},[b(`span`,{ref_key:`labelText`,ref:O},a(e.group.label),513)],12,qu),p.value?(r(),x(Wc,{key:0,class:`text-base`})):l(``,!0),b(`div`,{class:`flex shrink-0 items-center`,title:n.$t(`group.filesReviewed`,{reviewed:C.value,total:f.value})},null,8,Ju)]),b(`div`,Yu,[t(St,{additions:v.value,deletions:y.value},null,8,[`additions`,`deletions`]),b(`span`,Xu,a(n.$t(`common.files`,{n:f.value},f.value)),1),t(ut,{value:F.value,size:12,thickness:2.5},null,8,[`value`])])])],8,Wu),n.$slots.actions?(r(),m(`div`,Zu,[L(n.$slots,`actions`)])):l(``,!0)])])),e.collapsed?l(``,!0):(r(),m(g,{key:1},[e.group.summary&&!A.value?(r(),x(c,{key:0},{default:z(()=>[t(D(ct),{value:e.group.summary,class:`border-b border-base pb-2 pl2 text-sm op-fade`},null,8,[`value`])]),_:1})):l(``,!0),t(Ou,{class:`min-h-0 flex-1`,store:e.store,files:e.group.files,notes:e.group.notes,missing:e.group.missing,"files-visible":e.filesVisible,layout:D(Bc),onNavigate:R},null,8,[`store`,`files`,`notes`,`missing`,`files-visible`,`layout`])],64))]),b(`div`,Qu,[e.collapsed?l(``,!0):(r(!0),m(g,{key:0},h(e.group.files,n=>(r(),m(g,{key:n.sha},[b(`div`,{"data-file-start":n.sha,class:`scroll-mt-[var(--diffs-header-height)]`},null,8,$u),t(xu,{ref_for:!0,ref:e=>ee(n.sha,e),store:e.store,file:n,notes:e.group.notes.get(n.sha)},null,8,[`store`,`file`,`notes`])],64))),128))])])):l(``,!0),A.value&&!e.collapsed?(r(),m(`div`,ed,[(r(!0),m(g,null,h(e.group.children,t=>(r(),x(td,{key:t.key,ref_for:!0,ref:e=>M(t.key,e),store:e.store,group:{...t,children:[]},collapsed:w.value.has(t.key),"parent-label":e.group.label,"parent-key":e.group.key,"files-visible":e.filesVisible,onToggle:e=>T(t.key)},null,8,[`store`,`group`,`collapsed`,`parent-label`,`parent-key`,`files-visible`,`onToggle`]))),128))])):l(``,!0)],8,ku))}}),nd={class:`flex flex-col gap-0.5 text-sm`},rd=[`onClick`],id={class:`w-full flex items-center gap-1.5`},ad=[`title`],od={class:`ml-6 flex items-center gap-1 text-xs`},sd={class:`op-mute`},cd=R({__name:`DiffGroupSidebar`,props:{groups:{},groupsVisable:{},reviewed:{}},emits:[`select`],setup(e){let n=e,o=S(new Set);function s(e){let t=new Set(o.value);t.has(e)?t.delete(e):t.add(e),o.value=t}let c=u(()=>n.groups.flatMap(e=>[{group:e,depth:0},...o.value.has(e.key)?[]:e.children.map(e=>({group:{...e,children:[]},depth:1}))]));return(n,u)=>(r(),m(`nav`,nd,[(r(!0),m(g,null,h(c.value,({group:c,depth:u})=>(r(),m(`div`,{key:c.key,class:i([`group flex items-center rounded pr-1 transition-colors`,[e.groupsVisable.includes(c.key)?`bg-active`:`hover:bg-hover`,u?`pl-4 border-base rounded-l-none`:`mt-1`]])},[b(`button`,{type:`button`,class:i([`min-w-0 flex flex-1 flex-col items-start px-2 py-1 text-left color-base`,e.groupsVisable.includes(c.key)?`op-100`:`op-fade hover:op-100`]),onClick:e=>n.$emit(`select`,c.key)},[b(`span`,id,[t(_t,{category:c.category,class:i([`text-sm group-hover:saturate-100`,e.groupsVisable.includes(c.key)?``:`saturate-0`])},null,8,[`category`,`class`]),b(`span`,{class:`truncate`,title:c.label},a(c.label),9,ad),D(Zc)(c)?(r(),x(Wc,{key:0,class:`text-sm`})):l(``,!0)]),b(`span`,od,[t(St,{additions:D($c)(c).added,deletions:D($c)(c).deleted},null,8,[`additions`,`deletions`]),b(`span`,sd,`・`+a(n.$t(`common.files`,{n:D(Xc)(c)},D(Xc)(c))),1)])],10,rd),D(Qc)(c,e.reviewed)?(r(),x(ut,{key:0,value:D(Qc)(c,e.reviewed),size:16,thickness:2,class:`shrink-0`},null,8,[`value`])):l(``,!0),c.children.length?(r(),x(W,{key:1,icon:o.value.has(c.key)?`i-ph:caret-right`:`i-ph:caret-down`,"aria-expanded":!o.value.has(c.key),label:n.$t(o.value.has(c.key)?`group.showSubgroups`:`group.hideSubgroups`),class:`shrink-0 text-xs`,onClick:e=>s(c.key)},null,8,[`icon`,`aria-expanded`,`label`,`onClick`])):l(``,!0)],2))),128))]))}}),ld={class:`max-h-[60vh] min-h-40 flex flex-col gap-3`},ud={key:0,class:`flex items-center gap-1.5 text-xs op-mute`,role:`status`},dd={key:0,class:`break-words text-sm text-red-600 dark:text-red-400`},fd=R({__name:`AnalyzeStatusModal`,props:{open:{type:Boolean},store:{},document:{}},emits:[`update:open`],setup(e,{emit:t}){let n=e,i=t,o=u(()=>n.store.llm),s=u(()=>o.value.transcript.filter(e=>e.role===`assistant`||e.role===`toolResult`)),c=te(`listEl`),d=te(`contentEl`),f=S(!0);function p(){let e=c.value;e&&(f.value=e.scrollHeight-e.scrollTop-e.clientHeight<40)}A(d,()=>{f.value&&c.value&&(c.value.scrollTop=c.value.scrollHeight)});function _(){f.value=!0,o.value.reanalyze()}return(t,n)=>(r(),x(Fe,{title:t.$t(`analyze.statusTitle`),open:e.open,document:e.document,"onUpdate:open":n[1]||=e=>i(`update:open`,e)},{footer:z(()=>[o.value.isAnalyzing?(r(),x(U,{key:0,size:`sm`,icon:`i-ph:stop-duotone`,onClick:n[0]||=e=>o.value.abort()},{default:z(()=>[v(a(t.$t(`common.abort`)),1)]),_:1})):(r(),x(U,{key:1,size:`sm`,variant:`primary`,icon:`i-ph:arrow-clockwise-duotone`,onClick:_},{default:z(()=>[v(a(t.$t(`common.rerun`)),1)]),_:1}))]),default:z(()=>[b(`div`,ld,[b(`div`,{ref_key:`listEl`,ref:c,class:`min-w-0 flex-auto overflow-y-auto overscroll-contain`,onScroll:p},[b(`div`,{ref_key:`contentEl`,ref:d,class:`flex flex-col gap-3`},[(r(!0),m(g,null,h(s.value,(e,t)=>(r(),x(lt,{key:t,message:e},null,8,[`message`]))),128)),o.value.isAnalyzing?(r(),m(`div`,ud,[n[2]||=b(`span`,{class:`i-ph:spinner-duotone animate-spin`,"aria-hidden":`true`},null,-1),v(` `+a(o.value.progress?.message??t.$t(`analyze.starting`)),1)])):l(``,!0)],512)],544),o.value.error?(r(),m(`p`,dd,a(o.value.error.message),1)):l(``,!0)])]),_:1},8,[`title`,`open`,`document`]))}}),pd=R({__name:`DiffAnalyzeButton`,props:{store:{},document:{}},setup(e){let n=e,{t:i}=F(),o=u(()=>n.store.llm),s=u(()=>n.store.aiResult!==void 0),c=u(()=>o.value.isAnalyzing||o.value.error!==void 0),d=S(!1),f=u(()=>o.value.isAnalyzing?`i-ph:spinner-duotone animate-spin`:o.value.error?`i-ph:warning-circle-duotone ${s.value?`text-red-500`:`text-red-100`}`:`i-ph:sparkle-duotone`),p=u(()=>o.value.isAnalyzing?i(`analyze.analyzing`):o.value.error?i(`analyze.failed`):s.value?i(`analyze.reanalyze`):i(`analyze.withAi`)),h=u(()=>{if(o.value.isAnalyzing)return o.value.progress?.message??i(`analyze.analyzing`);if(o.value.error)return i(`analyze.failedTitle`,{message:o.value.error.message})});function _(){c.value?d.value=!0:o.value.reanalyze()}return(n,i)=>(r(),m(g,null,[o.value.isSetup?!s.value||c.value||e.store.analyzeMode!==`rule-based`?(r(),x(U,{key:1,class:`shrink-0 text-xs`,variant:s.value?`text`:`primary`,icon:f.value,title:h.value,onClick:_},{default:z(()=>[v(a(p.value),1)]),_:1},8,[`variant`,`icon`,`title`])):l(``,!0):(r(),x(U,{key:0,class:`shrink-0 text-xs shadow`,size:`sm`,icon:`i-ph:key-duotone`,variant:`primary`,onClick:i[0]||=e=>D(et)(`ai`)},{default:z(()=>[v(a(n.$t(`analyze.setupKeys`)),1)]),_:1})),t(fd,{open:d.value&&c.value,store:e.store,document:e.document,"onUpdate:open":i[1]||=e=>d.value=e},null,8,[`open`,`store`,`document`])],64))}}),md={key:0,role:`menu`,class:`absolute right-0 top-full z-dropdown mt-1 min-w-48 flex flex-col overflow-hidden border border-base rounded-lg bg-base p-1 shadow-lg`},hd=[`onClick`],gd={class:`min-w-0 flex-1 whitespace-nowrap`},_d=R({__name:`DiffCollapseMenu`,props:{store:{}},setup(e){let n=e,o=w(Fl),s=S(!1),c=te(`root`);j(c,()=>s.value=!1);let u=[{label:`file.expandAll`,icon:`i-ph:arrows-out-line-vertical-duotone`,collapse:!1,applies:()=>!0},{label:`file.collapseAll`,icon:`i-ph:arrows-in-line-vertical-duotone`,collapse:!0,applies:()=>!0},{label:`file.collapseReviewed`,icon:`i-ph:check-square-duotone`,collapse:!0,applies:e=>Ul(n.store,e)===`reviewed`}];function d(e){for(let t of n.store.diff?.files??[])e.applies(t)&&o.set(t.sha,e.collapse);s.value=!1}return(e,n)=>(r(),m(`div`,{ref_key:`root`,ref:c,class:`relative`},[t(W,{icon:`i-ph:caret-up-down-duotone`,label:e.$t(`file.collapseMenu`),tooltip:e.$t(`file.collapseMenu`),active:s.value,"aria-expanded":s.value,"aria-haspopup":`menu`,onClick:n[0]||=e=>s.value=!s.value},null,8,[`label`,`tooltip`,`active`,`aria-expanded`]),s.value?(r(),m(`div`,md,[(r(),m(g,null,h(u,t=>b(`button`,{key:t.label,type:`button`,role:`menuitem`,class:`flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm color-base outline-none transition focus-visible:bg-hover hover:bg-hover`,onClick:e=>d(t)},[b(`span`,{class:i([t.icon,`shrink-0 op-fade`]),"aria-hidden":`true`},null,2),b(`span`,gd,a(e.$t(t.label)),1)],8,hd)),64))])):l(``,!0)],512))}}),vd=R({__name:`DiffGroupNavToggle`,setup(e){let t=u(()=>jc.value===`sidebar`);return(e,n)=>(r(),x(W,{icon:t.value?`i-ph:tabs-duotone`:`i-ph:sidebar-simple-duotone`,label:e.$t(t.value?`group.navTabs`:`group.navSidebar`),tooltip:e.$t(t.value?`group.navTabs`:`group.navSidebar`),onClick:n[0]||=e=>jc.value=t.value?`tabs`:`sidebar`},null,8,[`icon`,`label`,`tooltip`]))}}),yd={key:0,class:`op-fade`},bd={key:1,class:`text-xs ml-0.5 op-fade`},xd=R({__name:`DisplayNumber`,props:{value:{},prefix:{},suffix:{},options:{},mono:{type:Boolean,default:!0}},setup(e){let t=e,n=u(()=>Ue(t.value,t.options));return(t,o)=>(r(),m(`span`,{class:i({"font-mono tabular-nums":e.mono})},[e.prefix?(r(),m(`span`,yd,a(e.prefix),1)):l(``,!0),v(a(n.value),1),e.suffix?(r(),m(`span`,bd,a(e.suffix),1)):l(``,!0)],2))}}),Sd=R({__name:`DisplayNumberBadge`,props:{value:{},prefix:{},suffix:{},options:{},color:{type:[Boolean,Number,String],default:!1}},setup(e){return(n,i)=>(r(),x(He,{color:e.color,class:`text-micro`},{default:z(()=>[L(n.$slots,`default`,{},()=>[t(xd,{value:e.value,prefix:e.prefix,suffix:e.suffix,options:e.options},null,8,[`value`,`prefix`,`suffix`,`options`])])]),_:3},8,[`color`]))}}),Cd={class:`relative shrink-0`},wd=R({__name:`DiffReviewButton`,props:{pendingCommentCount:{}},emits:[`review`],setup(e){return(n,i)=>(r(),m(`div`,Cd,[t(U,{size:`sm`,variant:`action`,icon:`i-ph:chat-centered-text-duotone`,onClick:i[0]||=e=>n.$emit(`review`)},{default:z(()=>[v(a(n.$t(`review.addReview`)),1)]),_:1}),e.pendingCommentCount>0?(r(),x(Sd,{key:0,value:e.pendingCommentCount,class:`absolute right--2 top--2`},null,8,[`value`])):l(``,!0)]))}}),Td={class:`flex flex-col gap-3`},Ed={class:`flex flex-wrap gap-2`},Dd={class:`flex flex-col text-sm`},Od=[`onClick`],kd=R({__name:`ReviewProgressModal`,props:{open:{type:Boolean},store:{},document:{}},emits:[`update:open`],setup(e,{emit:n}){let o=e,s=n,c=u(()=>(o.store.diff?.files??[]).map(e=>({file:e,status:Ul(o.store,e)})).sort((e,t)=>e.file.path.localeCompare(t.file.path))),l=u(()=>c.value.filter(e=>e.status===`reviewed`).length);function d(e){return c.value.filter(t=>t.status===`reviewed`===e).map(e=>e.file.sha)}async function f(){let[e,t]=[d(!0),d(!1)];await o.store.setReviewed(e,!1),await o.store.setReviewed(t,!0)}function p(e){let t=o.document??document;s(`update:open`,!1),Lc(t,e)}return(n,o)=>(r(),x(Fe,{title:n.$t(`reviewProgress.title`),description:n.$t(`group.filesReviewed`,{reviewed:l.value,total:c.value.length}),open:e.open,document:e.document,"onUpdate:open":o[2]||=e=>s(`update:open`,e)},{default:z(()=>[b(`div`,Td,[b(`div`,Ed,[t(U,{size:`sm`,icon:`i-ph:checks`,disabled:l.value===c.value.length,onClick:o[0]||=t=>e.store.setReviewed(d(!1),!0)},{default:z(()=>[v(a(n.$t(`reviewProgress.markAll`)),1)]),_:1},8,[`disabled`]),t(U,{size:`sm`,icon:`i-ph:arrows-left-right`,disabled:c.value.length===0,onClick:f},{default:z(()=>[v(a(n.$t(`reviewProgress.invert`)),1)]),_:1},8,[`disabled`]),t(U,{size:`sm`,icon:`i-ph:arrow-counter-clockwise`,disabled:l.value===0&&e.store.changedSinceReviewed.size===0,onClick:o[1]||=t=>e.store.setReviewed(c.value.map(e=>e.file.sha),!1)},{default:z(()=>[v(a(n.$t(`reviewProgress.reset`)),1)]),_:1},8,[`disabled`])]),b(`ul`,Dd,[(r(!0),m(g,null,h(c.value,({file:o,status:s})=>(r(),m(`li`,{key:o.sha,class:`flex items-center gap-2 rounded-md px-1 py-1 hover:bg-hover`},[t(Wl,{status:s,"aria-label":n.$t(`file.markReviewed`),onUpdate:t=>e.store.setReviewed([o.sha],t)},null,8,[`status`,`aria-label`,`onUpdate`]),b(`button`,{type:`button`,class:`min-w-0 flex-1 text-left`,onClick:e=>p(o.sha)},[t(El,{path:o.path,class:`min-w-0`},null,8,[`path`])],8,Od),b(`span`,{class:i([`shrink-0 text-xs`,s===`changed`?`text-orange-700 dark:text-orange-400`:s===`reviewed`?`text-primary-600 dark:text-primary-400`:`op-fade`])},a(n.$t(`reviewProgress.status.${s}`)),3)]))),128))])])]),_:1},8,[`title`,`description`,`open`,`document`]))}}),Ad={class:`w-full flex flex-col gap-3 p-3`},jd={key:0,class:`text-sm op-fade`},Md={key:1,class:`text-sm text-red-600 dark:text-red-400`},Nd={class:`flex flex-wrap items-center justify-end gap-2`},Pd={key:2,class:`text-xs color-muted`},Fd=R({__name:`ReviewSubmitModal`,props:{open:{type:Boolean},reviews:{},authorLogin:{},document:{}},emits:[`update:open`],setup(e,{emit:n}){let i=e,o=n,s=S(``),c=S(`COMMENT`),d=S(!1),f=S(),{t:p}=F(),h=u(()=>!!i.authorLogin&&!!i.reviews.viewerLogin&&i.authorLogin.toLowerCase()===i.reviews.viewerLogin.toLowerCase());P(h,e=>{e&&(c.value=`COMMENT`)});let g=u(()=>[{value:`COMMENT`,label:p(`review.comment`),icon:`i-octicon-comment-16`},{value:`APPROVE`,label:p(`review.approve`),icon:`i-octicon-check-circle-16`,disabled:h.value},{value:`REQUEST_CHANGES`,label:p(`review.requestChanges`),icon:`i-octicon-code-review-16`,disabled:h.value}]);async function _(e){d.value=!0,f.value=void 0;try{await e(),s.value=``,c.value=`COMMENT`,o(`update:open`,!1)}catch(e){f.value=e instanceof Error?e.message:String(e)}finally{d.value=!1}}return(n,u)=>(r(),x(Fe,{title:n.$t(`review.reviewChanges`),open:e.open,document:e.document,"onUpdate:open":u[4]||=e=>o(`update:open`,e)},{default:z(()=>[b(`div`,Ad,[e.reviews.pendingCommentCount>0?(r(),m(`p`,jd,a(n.$t(`review.includesPending`,{n:e.reviews.pendingCommentCount},e.reviews.pendingCommentCount)),1)):l(``,!0),t(Al,{modelValue:s.value,"onUpdate:modelValue":u[0]||=e=>s.value=e,rows:4,placeholder:n.$t(`review.summaryPlaceholder`),disabled:d.value,invalid:!!f.value},null,8,[`modelValue`,`placeholder`,`disabled`,`invalid`]),f.value?(r(),m(`p`,Md,a(f.value),1)):l(``,!0),b(`div`,Nd,[t(Re,{"model-value":c.value,options:g.value,"onUpdate:modelValue":u[1]||=e=>{e&&(c.value=e)}},null,8,[`model-value`,`options`]),u[5]||=b(`div`,{class:`flex-auto`},null,-1),e.reviews.pendingReview?(r(),x(U,{key:0,variant:`text`,class:`text-red-600 dark:text-red-400`,disabled:d.value,onClick:u[2]||=e=>_(()=>i.reviews.discardPendingReview())},{default:z(()=>[v(a(n.$t(`review.discard`)),1)]),_:1},8,[`disabled`])):l(``,!0),u[6]||=b(`div`,{class:`flex-auto`},null,-1),t(U,{variant:`primary`,class:`px3`,loading:d.value,disabled:c.value!==`APPROVE`&&!s.value.trim()&&e.reviews.pendingCommentCount===0,onClick:u[3]||=e=>_(()=>i.reviews.submitReview(c.value,s.value))},{default:z(()=>[v(a(n.$t(`common.submit`)),1)]),_:1},8,[`loading`,`disabled`])]),h.value?(r(),m(`p`,Pd,a(n.$t(`review.ownPrCommentOnly`)),1)):l(``,!0)])]),_:1},8,[`title`,`open`,`document`]))}}),Id={class:`flex items-center gap-2 text-sm`},Ld=[`title`,`aria-expanded`],Rd={class:`text-xs opacity-50`},zd=R({__name:`DiffPrMeta`,props:{document:{},store:{}},setup(e){let n=e,i=u(()=>n.store.diff.files),o=u(()=>i.value.length),s=u(()=>i.value.filter(e=>n.store.reviewed.has(e.sha)).length),c=u(()=>i.value.reduce((e,t)=>e+t.additions,0)),d=u(()=>i.value.reduce((e,t)=>e+t.deletions,0)),f=u(()=>o.value===0?1:s.value/o.value),p=u(()=>n.store.reviews),h=S(!1),g=S(!1);return(n,i)=>(r(),m(`div`,Id,[t(St,{additions:c.value,deletions:d.value},null,8,[`additions`,`deletions`]),b(`button`,{type:`button`,class:`flex shrink-0 items-center gap-2 whitespace-nowrap rounded-md px-1.5 py-0.5 transition -mx-1.5 hover:bg-hover`,title:n.$t(`reviewProgress.title`),"aria-expanded":g.value,onClick:i[0]||=e=>g.value=!0},[t(ut,{value:f.value,size:18,thickness:3},null,8,[`value`]),b(`span`,null,[v(a(s.value)+` `,1),b(`span`,Rd,a(n.$t(`pr.reviewedOf`,{total:o.value})),1)])],8,Ld),p.value?.canWrite?(r(),x(wd,{key:0,"pending-comment-count":p.value.pendingCommentCount,onReview:i[1]||=e=>h.value=!0},null,8,[`pending-comment-count`])):l(``,!0),p.value?(r(),x(Fd,{key:1,open:h.value,"onUpdate:open":i[2]||=e=>h.value=e,reviews:p.value,"author-login":e.store.diff?.author?.name,document:e.document},null,8,[`open`,`reviews`,`author-login`,`document`])):l(``,!0),t(kd,{open:g.value,"onUpdate:open":i[3]||=e=>g.value=e,store:e.store,document:e.document},null,8,[`open`,`store`,`document`])]))}}),Bd=R({__name:`DiffReviewThreadsToggle`,props:{showThreads:{type:Boolean}},emits:[`update:showThreads`],setup(e){return(t,n)=>(r(),x(W,{class:i([`shrink-0`,e.showThreads?``:`op-fade`]),icon:e.showThreads?`i-ph:chats-duotone`:`i-ph:chats`,label:t.$t(e.showThreads?`review.hideComments`:`review.showComments`),tooltip:t.$t(e.showThreads?`review.hideComments`:`review.showComments`),onClick:n[0]||=n=>t.$emit(`update:showThreads`,!e.showThreads)},null,8,[`class`,`icon`,`label`,`tooltip`]))}}),Vd={class:`w-full flex flex-col gap-3 text-sm`},Hd=[`href`],Ud={key:0,class:`inline-flex items-center gap-1 align-middle`},Wd={class:`h-4 w-4 overflow-hidden rounded-full`},Gd={class:`flex flex-col gap-1`},Kd={class:`op-fade`},qd={class:`flex flex-col list-disc gap-0.5 pl-5`},Jd={class:`op-fade`},Yd={class:`op-fade`},Xd={key:0,class:`flex items-start gap-2 border border-amber:20 rounded-lg bg-amber:10 px-3 py-2 text-amber-700 dark:text-amber-400`},Zd={key:1,class:`text-red-600 dark:text-red-400`},Qd={class:`flex justify-end gap-2`},$d=R({__name:`ShareResultModal`,props:{open:{type:Boolean},store:{},document:{}},emits:[`update:open`],setup(e,{emit:n}){let i=e,o=n,{t:s}=F(),c=u(()=>i.store.shared),d=u(()=>{let e=i.store.aiResult?.locale;return e!==void 0&&e!==`en`}),f=u(()=>c.value.ownComment?d.value?s(`share.updateAnyway`):s(`share.update`):d.value?s(`share.shareAnyway`):s(`share.share`));async function h(){await c.value.share(),c.value.error||o(`update:open`,!1)}return(n,i)=>{let s=p(`i18n-t`);return r(),x(Fe,{title:n.$t(c.value.ownComment?`share.titleUpdate`:`share.titleShare`),open:e.open,document:e.document,"onUpdate:open":i[1]||=e=>o(`update:open`,e)},{default:z(()=>[b(`div`,Vd,[t(s,{keypath:c.value.ownComment?`share.willUpdate`:`share.willPost`,tag:`p`,scope:`global`},{comment:z(()=>[b(`a`,{href:c.value.ownComment?.url,target:`_blank`,rel:`noopener`,class:`underline`},a(n.$t(`share.commentLink`)),9,Hd)]),user:z(()=>[c.value.viewerLogin?(r(),m(`span`,Ud,[b(`span`,Wd,[t(Ct,{login:c.value.viewerLogin,size:16},null,8,[`login`])]),b(`strong`,null,a(c.value.viewerLogin),1)])):(r(),m(g,{key:1},[v(a(n.$t(`common.you`)),1)],64))]),_:1},8,[`keypath`]),b(`div`,Gd,[b(`p`,Kd,a(n.$t(`share.contains`)),1),b(`ul`,qd,[t(s,{keypath:`share.containsLink`,tag:`li`,scope:`global`},{site:z(()=>[...i[2]||=[b(`span`,{class:`text-primary font-bold`},`pulls.review`,-1)]]),_:1}),b(`li`,null,a(n.$t(`share.containsJson`)),1)]),b(`p`,Jd,a(n.$t(`share.excludes`)),1)]),b(`p`,Yd,a(n.$t(`share.anyoneCanLoad`)),1),d.value?(r(),m(`div`,Xd,[i[3]||=b(`span`,{class:`i-ph:globe-duotone mt-0.5 shrink-0`,"aria-hidden":`true`},null,-1),b(`span`,null,a(n.$t(`share.englishRecommended`)),1)])):l(``,!0),c.value.error?(r(),m(`p`,Zd,a(c.value.error.message),1)):l(``,!0),b(`div`,Qd,[t(U,{variant:`text`,disabled:c.value.isSharing,onClick:i[0]||=e=>o(`update:open`,!1)},{default:z(()=>[v(a(n.$t(`common.cancel`)),1)]),_:1},8,[`disabled`]),t(U,{variant:`primary`,icon:`i-ph:share-network-duotone`,loading:c.value.isSharing,onClick:h},{default:z(()=>[v(a(f.value),1)]),_:1},8,[`loading`])])])]),_:1},8,[`title`,`open`,`document`])}}}),ef=[`title`],tf=R({__name:`DiffShareButton`,props:{store:{},document:{}},setup(e){let n=e,i=u(()=>n.store.shared),o=S(!1);return(n,s)=>(r(),m(g,null,[t(U,{class:`shrink-0 text-xs`,variant:`text`,disabled:i.value.isSharing||!i.value.canShare,title:n.$t(i.value.canShare?`share.tooltip`:`share.needsToken`),icon:i.value.isSharing?`i-ph:spinner-duotone animate-spin`:`i-ph:share-network-duotone`,onClick:s[0]||=e=>o.value=!0},{default:z(()=>[v(a(n.$t(i.value.isSharing?`share.sharing`:i.value.ownComment?`share.updateButton`:`share.button`)),1)]),_:1},8,[`disabled`,`title`,`icon`]),i.value.error&&!o.value?(r(),m(`span`,{key:0,class:`max-w-80 self-center truncate text-xs text-red-500`,title:n.$t(`share.failed`,{message:i.value.error.message})},a(n.$t(`share.failed`,{message:i.value.error.message})),9,ef)):l(``,!0),t($d,{open:o.value,"onUpdate:open":s[1]||=e=>o.value=e,store:e.store,document:e.document},null,8,[`open`,`store`,`document`])],64))}}),nf=R({__name:`FileListLayoutToggle`,setup(e){let t=u(()=>Bc.value===`list`);return(e,n)=>(r(),x(W,{icon:t.value?`i-ph:tree-view-duotone`:`i-ph:list-bullets-duotone`,label:e.$t(t.value?`file.layoutTree`:`file.layoutList`),tooltip:e.$t(t.value?`file.layoutTree`:`file.layoutList`),onClick:n[0]||=e=>Bc.value=t.value?`tree`:`list`},null,8,[`icon`,`label`,`tooltip`]))}}),rf={class:`mxa max-w-500 w-full`},af={class:`flex flex-wrap items-center gap-2`},of={key:1,class:`i-ph-house-line-duotone`},sf={class:`flex flex-auto items-center gap-2 break-words text-lg font-semibold`},cf=[`href`],lf={key:0,class:`flex shrink-0 items-center gap-1.5 text-sm`},uf={class:`shrink-0`},df={class:`hidden lg:block`},ff={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-sm`},pf={key:1,class:`flex items-center gap-1.5`},mf={class:`op-fade`},hf={class:`op-fade`},gf={key:2,class:`flex items-center gap-1 font-mono`},_f={class:`border border-base rounded bg-code px-2 py-0.5 text-xs font-mono`},vf={class:`border border-base rounded bg-code px-2 py-0.5 text-xs font-mono`},yf=[`title`],bf={key:0,class:`flex items-center gap-2 pt-2 text-sm`},xf=R({__name:`DiffsHeader`,props:{document:{},store:{},groupsVisable:{},scrollY:{},hidden:{type:Boolean}},setup(e){let n=e,{t:o}=F(),s=u(()=>n.store.diff),c=u(()=>n.store.groups),d=u(()=>n.store.aiResult),f=u(()=>[{value:`rule-based`,label:o(`pr.rules`)},{value:d.value?.source??`llm`,label:o(`pr.ai`),icon:`i-ph-sparkle-duotone`}]),p=u(()=>n.store.shared&&n.store.llm&&d.value&&!d.value.sharedBy),h=u(()=>ot(s.value.ref)),_=u(()=>n.store.reviews);function y(e){(n.document??document).getElementById(`group-${e}`)?.scrollIntoView({behavior:`smooth`,block:`start`})}return(n,o)=>(r(),m(`header`,{class:i([`sticky left-0 right-0 top-0 z-nav flex flex-col gap-2 border-b bg-base px4 py2 transition-all`,e.hidden?`-translate-y-full border-transparent`:e.scrollY>20?`border-base shadow-sm`:`border-transparent`])},[b(`div`,rf,[b(`div`,af,[(r(),x(C(D(!1)?`div`:D(it)),{to:`/`,class:`flex`},{default:z(()=>[s.value.pullRequest?.state?(r(),x(Je,{key:0,state:s.value.pullRequest.state},null,8,[`state`])):(r(),m(`div`,of))]),_:1})),b(`h1`,sf,[v(a(s.value.title)+` `,1),s.value.label?(r(),m(`a`,{key:0,href:s.value.url,target:`_blank`,rel:`noopener`,class:`text-base font-normal op-fade hover:underline`},a(s.value.label),9,cf)):l(``,!0),e.store.canRefresh?(r(),x(W,{key:1,icon:`i-ph:arrows-clockwise-duotone`,label:n.$t(`common.refresh`),tooltip:n.$t(`common.refresh`),class:`shrink-0 text-sm`,onClick:o[0]||=t=>e.store.refresh()},null,8,[`label`,`tooltip`])):l(``,!0)]),d.value?(r(),m(`div`,lf,[t(Re,{"model-value":e.store.analyzeMode,options:f.value,"onUpdate:modelValue":o[1]||=t=>e.store.setAnalyzeMode(t)},null,8,[`model-value`,`options`])])):l(``,!0),_.value?(r(),x(Bd,{key:1,"show-threads":_.value.showThreads,"onUpdate:showThreads":o[2]||=e=>_.value.setShowThreads(e)},null,8,[`show-threads`])):l(``,!0),b(`div`,uf,[t(Qe,{document:e.document},{default:z(()=>[t(_d,{store:e.store},null,8,[`store`]),t(nf),b(`div`,df,[t(vd)])]),_:1},8,[`document`])])]),b(`div`,ff,[h.value&&!D(!1)?(r(),x(D(it),{key:0,to:h.value.route,class:`flex items-center gap-1.5 op-fade hover:underline`},{default:z(()=>[b(`span`,null,a(h.value.label),1)]),_:1},8,[`to`])):l(``,!0),s.value.author?(r(),m(`span`,pf,[b(`span`,mf,a(n.$t(`pr.by`)),1),t(Ct,{login:s.value.author.name,"avatar-url":s.value.author.avatarUrl,size:16},null,8,[`login`,`avatar-url`]),b(`span`,hf,a(s.value.author.name),1)])):l(``,!0),s.value.base&&s.value.head&&!D(!1)?(r(),m(`span`,gf,[b(`span`,_f,a(s.value.base.ref),1),o[3]||=v(` ← `,-1),b(`span`,vf,a(s.value.head.ref),1)])):l(``,!0),d.value?.sharedBy&&e.store.analyzeMode!==`rule-based`?(r(),m(`span`,{key:3,class:`flex items-center gap-1.5 border border-base rounded px2`,title:d.value.model},[d.value.sharedBy===D(`github-actions[bot]`)?(r(),m(g,{key:0},[v(a(n.$t(`pr.sharedAnalysis`)),1)],64)):(r(),m(g,{key:1},[v(a(n.$t(`pr.sharedBy`))+` `,1),t(Ct,{login:d.value.sharedBy,size:16},null,8,[`login`]),v(` `+a(d.value.sharedBy),1)],64))],8,yf)):l(``,!0),e.store.llm?(r(),x(pd,{key:4,store:e.store,document:e.document},null,8,[`store`,`document`])):l(``,!0),p.value?(r(),x(tf,{key:5,store:e.store,document:e.document},null,8,[`store`,`document`])):l(``,!0),D(Nc)?(r(),x(zd,{key:6,class:`ml-auto`,store:e.store,document:e.document},null,8,[`store`,`document`])):l(``,!0)]),D(Nc)?l(``,!0):(r(),m(`div`,bf,[t(fl,{class:`flex-auto`,groups:c.value,"groups-visable":e.groupsVisable,reviewed:e.store.reviewed,onSelect:y},{default:z(()=>[t(zd,{class:`ml-auto self-end pt-2`,store:e.store,document:e.document},null,8,[`store`,`document`])]),_:1},8,[`groups`,`groups-visable`,`reviewed`])]))])],2))}}),Sf={key:0,class:`border border-base rounded-lg`},Cf=[`aria-expanded`],wf={class:`font-medium`},Tf={class:`font-mono op-mute`},Ef={key:0,class:`border-t border-base divide-y divide-#9992`},Df={class:`flex items-center gap-2`},Of={class:`font-medium`},kf={class:`op-fade`},Af=R({__name:`ReviewSummaries`,props:{summaries:{}},setup(e){let n=S(!1),o={approved:{label:`review.approved`,icon:`i-ph:check-circle-duotone text-green-600 dark:text-green-400`},changes_requested:{label:`review.changesRequested`,icon:`i-ph:x-circle-duotone text-red-600 dark:text-red-400`},commented:{label:`review.commented`,icon:`i-ph:chat-circle-dots-duotone op-fade`},dismissed:{label:`review.dismissed`,icon:`i-ph:prohibit op-mute`}};return(s,u)=>e.summaries.length?(r(),m(`section`,Sf,[b(`button`,{type:`button`,class:`w-full flex items-center gap-1.5 px-3 py-2 text-sm`,"aria-expanded":n.value,onClick:u[0]||=e=>n.value=!n.value},[b(`span`,{class:i(n.value?`i-ph:caret-down`:`i-ph:caret-right`),"aria-hidden":`true`},null,2),b(`span`,wf,a(s.$t(`review.reviews`)),1),b(`span`,Tf,a(e.summaries.length),1)],8,Cf),n.value?(r(),m(`ul`,Ef,[(r(!0),m(g,null,h(e.summaries,e=>(r(),m(`li`,{key:e.id,class:`flex flex-col gap-1 px-3 py-2 text-sm`},[b(`div`,Df,[b(`span`,{class:i(o[e.state].icon),"aria-hidden":`true`},null,2),e.author?(r(),x(Ct,{key:0,login:e.author.login,"avatar-url":e.author.avatarUrl,size:16},null,8,[`login`,`avatar-url`])):l(``,!0),b(`span`,Of,a(e.author?.login??`ghost`),1),b(`span`,kf,a(s.$t(o[e.state].label)),1),e.submittedAt?(r(),x(qe,{key:1,date:e.submittedAt,class:`text-xs op-fade`},null,8,[`date`])):l(``,!0)]),e.body?(r(),x(c,{key:0},{default:z(()=>[t(D(ct),{value:e.body,class:`pl-6 text-sm op-fade`},null,8,[`value`])]),_:2},1024)):l(``,!0)]))),128))])):l(``,!0)])):l(``,!0)}}),jf={key:0,class:`flex flex-wrap items-center gap-x-3 gap-y-2 border border-base rounded-lg bg-raised px-3 py-2 text-sm`},Mf={key:0,class:`text-xs op-fade`},Nf={key:1,class:`text-xs op-fade`},Pf={key:1,class:`op-fade`},Ff=R({__name:`SharedAnalysisBanner`,props:{store:{}},setup(e){let n=e,{t:i,locale:o}=F(),s=u(()=>n.store.shared),c=u(()=>n.store.aiResult!==void 0&&n.store.aiResult.sharedBy===void 0);function d(e){let t=e.result.locale;return t!==void 0&&t!==o.value?be(t):void 0}function f(e){let t=d(e);return e.stale?i(`share.staleTitle`):t?i(`share.inLanguage`,{language:t}):e.result.model}return(e,n)=>s.value.candidates.length||s.value.notice?(r(),m(`div`,jf,[n[1]||=b(`span`,{class:`i-ph-sparkle-duotone shrink-0 op-fade`,"aria-hidden":`true`},null,-1),s.value.candidates.length?(r(),m(g,{key:0},[b(`span`,null,a(e.$t(c.value?`share.loadReplaces`:`share.available`)),1),(r(!0),m(g,null,h(s.value.candidates,n=>(r(),x(U,{key:n.login,size:`sm`,class:`rounded-full`,title:f(n),onClick:e=>s.value.load(n.login)},{default:z(()=>[t(Ct,{login:n.login,size:16},null,8,[`login`]),v(` `+a(n.own?e.$t(`common.you`):n.login)+` `,1),n.stale?(r(),m(`span`,Mf,a(e.$t(`share.outdated`)),1)):d(n)?(r(),m(`span`,Nf,`(`+a(d(n))+`)`,1)):l(``,!0)]),_:2},1032,[`title`,`onClick`]))),128))],64)):(r(),m(`span`,Pf,a(s.value.notice),1)),n[2]||=b(`div`,{class:`flex-auto`},null,-1),t(W,{icon:`i-ph:x`,label:e.$t(`common.dismiss`),tooltip:e.$t(`common.dismiss`),class:`text-sm`,onClick:n[0]||=e=>s.value.dismiss()},null,8,[`label`,`tooltip`])])):l(``,!0)}}),If={key:0,class:`mxa max-w-500 w-full px-4 py-12`},Lf={key:1,class:`mxa max-w-500 w-full flex flex-col gap-8 px-4 py-12`},Rf={class:`flex`},zf={key:0,class:`w-64 shrink-0 border-r border-base`},Bf={class:`sticky top-[calc(var(--diffs-header-height)+10px)] max-h-[calc(100vh-var(--diffs-header-height)-20px)] overflow-auto py-3 pl-3 pr-2`},Vf={class:`mxa max-w-500 min-w-0 flex flex-auto flex-col gap-4`},Hf={key:0,class:`mb-4 flex flex-wrap items-center justify-between gap-3 border border-amber:20 rounded-lg bg-amber:10 bg-raised px-3 py-2 text-sm text-amber-700 dark:text-amber-400`},Uf={class:`flex items-center gap-3`},Wf={class:`mt-200 p2 text-center text-xs italic op50`},Gf={key:3,class:`mxa max-w-500 w-full px-4 py-12`},Kf=R({__name:`DiffsPage`,props:{document:{},store:{}},setup(e){let i=e,p=O(()=>xe(()=>import(`./ChatWidget-BFjNWi3R.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),y=u(()=>i.store?.diff),C=u(()=>i.store?.grouped),w=u(()=>i.store?.isLoading??!1),E=u(()=>i.store?.error),k=u(()=>i.store?.isStale??!1),A=u(()=>i.store?.groups??[]),j=new kc;f(Pc,j),f(Fl,d(new Map));let M=te(`root`);_(()=>{j.setup(i.document&&!(i.document instanceof Document)?M.value:document)}),n(()=>j.cleanUp());let F=S(new Set);function I(e){let t=new Set(F.value);t.has(e)?t.delete(e):t.add(e),F.value=t}let ee=S(0),R=0,ne=S(0);N(()=>i.document??document,`scroll`,e=>{let t=e.target instanceof Element?e.target.scrollTop:window.scrollY;t<ee.value&&(R=t),ne.value=t-R,ee.value=t,oe(),se()},{capture:!0});let re=te(`header`),{height:B}=T(()=>re.value?.$el),V=u(()=>!Mc.value&&ne.value>300),ie=u(()=>V.value?0:B.value),ae=S([]);function oe(){let e=i.document??document,t=window.innerHeight,n=A.value.flatMap(e=>[e.key,...e.children.map(e=>e.key)]);ae.value=n.filter(n=>{let r=e.getElementById(`group-${n}`);if(!r)return!1;let i=r.getBoundingClientRect();return i.bottom>ie.value&&i.top<t})}let H=S([]);function se(){let e=i.document??document,t=window.innerHeight,n=[...e.querySelectorAll(`[data-file-start]`)];H.value=n.filter((e,r)=>{let i=n[r+1],a=e.getBoundingClientRect().top;return(i&&i.parentElement===e.parentElement?i.getBoundingClientRect().top:e.parentElement.getBoundingClientRect().bottom)>ie.value&&a<t}).map(e=>e.dataset.fileStart)}P([A,ie],()=>o(()=>{oe(),se()}),{immediate:!0});function ce(e){(i.document??document).getElementById(`group-${e}`)?.scrollIntoView({behavior:`smooth`,block:`start`})}let le=u(()=>({"--diffs-header-height":B.value?`${ie.value}px`:void 0})),ue=S(!0);function de(){Le.value=ue.value,i.store?.refresh()}return(n,i)=>(r(),m(`div`,{ref:`root`,class:`diffs-page bg-base color-base`,style:s(le.value)},[b(`div`,null,[w.value&&!y.value?(r(),m(`div`,If,[L(n.$slots,`loading`,{},()=>[t(pe,{text:n.$t(`common.loading`)},null,8,[`text`])])])):E.value?(r(),m(`div`,Lf,[L(n.$slots,`error`,{error:E.value,retry:()=>e.store?.load()},()=>[t(fe,{icon:`i-ph:warning-duotone`,title:n.$t(`pr.somethingWrong`)},{hint:z(()=>[v(a(E.value.message),1)]),actions:z(()=>[t(U,{variant:`primary`,onClick:i[0]||=t=>e.store?.load()},{default:z(()=>[v(a(n.$t(`common.retry`)),1)]),_:1})]),_:1},8,[`title`])]),e.store?.auth===`github-token`?(r(),x(ge,{key:0,class:`mxa max-w-200 border border-base border-rounded p4`,onSaved:i[1]||=t=>e.store?.load()})):l(``,!0)])):y.value&&C.value?(r(),m(g,{key:2},[t(xf,{ref:`header`,document:e.document,store:e.store,"groups-visable":ae.value,"scroll-y":ee.value,hidden:V.value},null,8,[`document`,`store`,`groups-visable`,`scroll-y`,`hidden`]),b(`div`,Rf,[D(Nc)?(r(),m(`aside`,zf,[b(`div`,Bf,[t(cd,{groups:A.value,"groups-visable":ae.value,reviewed:e.store.reviewed,onSelect:ce},null,8,[`groups`,`groups-visable`,`reviewed`])])])):l(``,!0),b(`div`,Vf,[L(n.$slots,`stale`,{refresh:()=>e.store?.refresh()},()=>[k.value?(r(),m(`div`,Hf,[b(`span`,null,a(n.$t(`pr.newCommits`)),1),b(`div`,Uf,[t(Ge,{modelValue:ue.value,"onUpdate:modelValue":i[2]||=e=>ue.value=e,label:n.$t(`pr.autoRefreshNextTime`)},null,8,[`modelValue`,`label`]),t(U,{size:`sm`,onClick:de},{default:z(()=>[v(a(n.$t(`common.refresh`)),1)]),_:1})])])):l(``,!0)]),e.store?.shared?(r(),x(Ff,{key:0,store:e.store},null,8,[`store`])):l(``,!0),e.store?.reviews?(r(),x(Af,{key:1,summaries:e.store.reviews.summaries},null,8,[`summaries`])):l(``,!0),C.value?.overallSummary?(r(),x(c,{key:2},{default:z(()=>[t(D(ct),{value:C.value?.overallSummary,class:`border-b border-base px-4 pb-2 text-sm op-fade`},null,8,[`value`])]),_:1})):l(``,!0),(r(!0),m(g,null,h(A.value,t=>(r(),x(td,{key:t.key,store:e.store,group:t,collapsed:F.value.has(t.key),"files-visible":H.value,onToggle:e=>I(t.key)},null,8,[`store`,`group`,`collapsed`,`files-visible`,`onToggle`]))),128)),b(`div`,Wf,a(n.$t(`pr.endOfDiff`)),1)])]),D(p)&&e.store?.llm&&e.store.aiResult?(r(),x(D(p),{key:0,store:e.store},null,8,[`store`])):l(``,!0)],64)):(r(),m(`div`,Gf,[L(n.$slots,`empty`)]))])],4))}}),qf=E(`diffs:show-review-comments`,!0);function Jf(e,t){let{write:n}=t.access,r=S({threads:[],summaries:[],pendingReview:void 0}),i=S(!1),a=u(()=>r.value.threads.reduce((e,t)=>e+t.comments.filter(e=>e.pending).length,0));async function o(){let n=await e.fetch();r.value=n;let i=t.getCacheKey();i&&await t.cache.diffs.setReviewData(i,n)}async function s(){let e=t.cachedData?.();e&&(r.value=e),i.value=!e;try{await t.access.resolve(),await o()}catch{}finally{i.value=!1}}async function c(e){await n(e),await o()}async function l(n,i,a){let o=t.getHeadSha();if(!o)throw Error(H(`errors.diffNotLoaded`));await c(()=>e.addComment({target:n,body:i,mode:a,headSha:o,pendingReview:r.value.pendingReview}))}async function f(){let t=r.value.pendingReview;t&&await c(()=>e.discardPendingReview(t))}return d({threads:u(()=>r.value.threads),summaries:u(()=>r.value.summaries),pendingReview:u(()=>r.value.pendingReview),pendingCommentCount:a,isLoading:i,viewerLogin:t.access.viewerLogin,canWrite:t.access.canWrite,writeBlockedReason:t.access.writeBlockedReason,showThreads:qf,setShowThreads:e=>{qf.value=e},load:s,addComment:l,reply:(t,n)=>c(()=>e.reply(t,n)),editComment:(t,n)=>c(()=>e.editComment(t,n)),deleteComment:t=>c(()=>e.deleteComment(t)),resolveThread:t=>c(()=>e.resolveThread(t)),submitReview:(t,n)=>c(()=>e.submitReview(t,n,r.value.pendingReview)),discardPendingReview:f})}function Yf(e,t){let{access:n}=t,r=S([]),i=S(),a=S(!1),o=S(),s=S();async function c(e){await t.applyResult({...e.result,sharedBy:e.login}),r.value=[],i.value=void 0}async function l(a){await n.resolve(),s.value??=t.cachedComment();let o=t.getAiResult();if(!a&&o)return;let l;try{l=await e.list()}catch{return}let u=n.viewerLogin.value,d=l.find(e=>e.login===u);d&&(s.value={id:d.id,url:d.url});let f=t.getDiff()?.head?.sha,p=e=>({login:e.login,url:e.url,result:e.analysis.result,own:e.login===u,stale:e.analysis.headSha!==f}),m=l.find(e=>e.login===(a??`github-actions[bot]`));if(m){o!==void 0&&o.sharedBy===void 0?r.value=[p(m)]:await c(p(m));return}a&&(i.value=H(`share.notShared`,{login:a})),o||(r.value=l.map(p))}async function u(e){let t=r.value.find(t=>t.login===e);t?await c(t):await l(e)}function f(){r.value=[],i.value=void 0}async function p(){let r=t.getDiff(),i=t.getAiResult();if(r&&i&&!i.sharedBy){a.value=!0,o.value=void 0;try{let a=await n.write(()=>{let t=n.viewerLogin.value;if(!t)throw Error(H(`errors.noViewer`));return e.upsert(t,{headSha:r.head?.sha??``,result:i},s.value)});s.value=a;let o=t.getCacheKey();o&&await t.cache.diffs.setSharedComment(o,a)}catch(e){o.value=xt(e)}finally{a.value=!1}}}return{store:d({candidates:r,notice:i,viewerLogin:n.viewerLogin,canShare:n.canWrite,isSharing:a,error:o,ownComment:s,dismiss:f,load:u,share:p}),discover:l}}var Xf=`This token cannot write to this repository. It needs the "repo" scope (classic token) or "Pull requests: Read and write" permission (fine-grained token).`;function Zf(e){let t=S(),n=S(),r=u(()=>t.value?.login),i=u(()=>!!t.value?.canWrite&&!n.value);async function a(){t.value=await e()}async function o(e){if(t.value||await a(),!t.value)throw Error(H(`errors.tokenRequired`));try{return await e()}catch(e){throw e instanceof oe&&e.name===`writeForbidden`&&(n.value=Xf),e}}return{viewerLogin:r,canWrite:i,writeBlockedReason:n,resolve:a,write:o}}function Qf(e,t){let{cache:n}=t,r=S(),i=S({}),a=S(!1),o=S(),s=S(!1),c=S(`llm`),l=S(),f=S(new Set),p=S(new Set),m=I(),h=I();M()&&re(()=>h.value?.abort());let g,_,v=Zf(e.viewer??(async()=>void 0)),y=e.reviews?Jf(e.reviews,{cache:n,access:v,getHeadSha:()=>r.value?.head?.sha,getCacheKey:()=>l.value,cachedData:()=>g}):void 0,b=u(()=>i.value[c.value]??i.value[`rule-based`]),x=u(()=>i.value.llm??i.value[`web-llm`]),C=u(()=>r.value&&b.value?Yc(b.value.groups,r.value.files):[]),w=t.llm,T=w?xe(async()=>{let{createLlmStore:e}=await import(`./llm-store-CzMnTJNa.js`);return{createLlmStore:e}},__vite__mapDeps([8,1,9,10,11,12,7,13]),import.meta.url).then(({createLlmStore:e})=>{h.value=e({cache:n,runner:w,diff:r,session:m,getCacheKey:()=>l.value,setResult:e=>i.value={...i.value,llm:e},showLlmResult:()=>k(`llm`)})}):void 0;async function E(){r.value&&(f.value=await n.reviewMarks.get(r.value.files.map(e=>e.sha)))}async function D(e,t){await n.reviewMarks.set(e,t);let i=new Set(f.value);for(let n of e)t?i.add(n):i.delete(n);f.value=i;let a=new Set(e),o=r.value?.files.filter(e=>a.has(e.sha)).map(e=>e.path)??[];if(!o.some(e=>p.value.has(e)))return;let s=new Set(p.value);for(let e of o)s.delete(e);p.value=s,l.value&&await n.diffs.setChangedSinceReviewed(l.value,[...s])}async function O(e){if(!r.value)return;let t=await _e(e).analyze(r.value);i.value={...i.value,[e]:t}}P(se.global.locale,()=>{for(let e of[`rule-based`,`none`])i.value[e]&&O(e)});async function k(e){c.value=e,e!==`llm`&&i.value[e]===void 0&&await O(e)}async function A(e){let t=e.source;(t===`llm`||t===`web-llm`)&&(h.value?.abort(),i.value={...i.value,[t]:e},m.value=void 0,c.value=t,l.value&&(await n.diffs.setAnalyzedResult(l.value,t,e),await n.diffs.setLlmSession(l.value,void 0)))}let j=e.sharing?Yf(e.sharing,{cache:n,access:v,getDiff:()=>r.value,getCacheKey:()=>l.value,getAiResult:()=>x.value,cachedComment:()=>_,applyResult:A}):void 0;async function N(e,t){r.value=t.diff,l.value=e,p.value=new Set(t.changedSinceReviewed),i.value={...t.analyzedBy,"rule-based":await me.analyze(t.diff)},m.value=t.llmSession,await E()}async function F(e,t){h.value?.abort(),await N(e,await n.diffs.putDiff(e,t,t.head?.sha??``));let r=c.value;r!==`rule-based`&&r!==`llm`&&await O(r)}async function L(){await F(await e.key(),await e.fetch())}async function ee(t){if(e.fingerprint)try{if(await e.fingerprint()===t)return;Le.value?await te():s.value=!0}catch{}}async function R(){a.value=!0,o.value=void 0,s.value=!1;try{let r=await e.key(),i=await n.diffs.get(r);i?(g=i.reviews,_=i.sharedComment,await n.diffs.touch(r),await N(r,i),ee(i.headSha)):await L(),y?.load(),j?.discover(t.from),await T}catch(e){o.value=e instanceof Error?e:Error(String(e))}finally{a.value=!1}}async function te(){a.value=!0,o.value=void 0;try{await L(),s.value=!1,y?.load(),j?.discover()}catch(e){o.value=e instanceof Error?e:Error(String(e))}finally{a.value=!1}}let{loadFile:ne}=e,z=ne&&{async load(e){let t=r.value,i=l.value;if(!t?.base||!t.head||!i)throw Error(H(`errors.diffNotLoaded`));let a=async(e,t)=>{let r=await n.fileContents.get(i,t,e);if(r!==void 0)return r;let a=await ne(e,t);return a!==void 0&&await n.fileContents.set(i,t,e,a),a},[o,s]=await Promise.all([e.status===`added`?void 0:a(e.previousPath??e.path,t.base.sha),e.status===`removed`?void 0:a(e.path,t.head.sha)]);return{old:o,new:s}}},B=d({layout:We,setLayout:e=>{We.value=e}});return d({diff:r,grouped:b,isLoading:a,error:o,isStale:s,reviewed:f,changedSinceReviewed:p,groups:C,aiResult:x,analyzeMode:c,setAnalyzeMode:k,ui:B,llm:h,reviews:y,shared:j?.store,fileContent:z,canRefresh:!!e.fingerprint,auth:e.auth,load:R,refresh:te,setReviewed:D})}export{gn as a,vn as i,Kf as n,bn as o,yn as r,en as s,Qf as t};
|