@openclaw/diffs-language-pack 2026.5.28 → 2026.5.31-beta.1
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.
|
@@ -231,7 +231,7 @@ ${t}`,a=e.startsWith(t)?0:vk(e,n,0);if(a===-1)return[e];let i=[];a>0&&i.push(e.s
|
|
|
231
231
|
`}function Is(e,t,n,a,i,r,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){let{callback:c}=o;Es(e,t,n,a,i,r,Object.assign(Object.assign({},o),{callback:s=>{c(s?Pi(s,o.headerOptions):void 0)}}))}else{let c=Es(e,t,n,a,i,r,o);return c?Pi(c,o?.headerOptions):void 0}}function E9(e){let t=e.endsWith(`
|
|
232
232
|
`),n=e.split(`
|
|
233
233
|
`).map(a=>a+`
|
|
234
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Qs(e,t,n,a=!1){let i=Ik(Is(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:a});if(i==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return t.lang!=null&&(i.lang=t.lang),i}var jk=class{constructor(){f(this,"isDeletionsScrolling",!1);f(this,"isAdditionsScrolling",!1);f(this,"timeoutId",-1);f(this,"codeDeletions");f(this,"codeAdditions");f(this,"enabled",!1);f(this,"handleDeletionsScroll",()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))});f(this,"handleAdditionsScroll",()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))})}cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){if(t==null||n==null)for(let a of e.children??[])a instanceof HTMLElement&&("deletions"in a.dataset?t=a:"additions"in a.dataset&&(n=a));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}};function hn(e,t){return Qa(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function fa(e){return $({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ha(e){return $({tagName:"div",children:[$({tagName:"span",children:[he("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function Ds(e){return $({tagName:"div",children:[Dt({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 Yt({type:e,content:t,expandIndex:n,chunked:a=!1,slotName:i,isFirstHunk:r,isLastHunk:o}){let c=0,s=[];if(e==="metadata"&&t!=null&&s.push($({tagName:"div",children:[he(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){let l=[];n!=null&&(a?(r||(l.push(Ds("up")),c++),o||(l.push(Ds("down")),c++)):(l.push(Ds(!r&&!o?"both":r?"down":"up")),c++)),l.push($({tagName:"div",children:[$({tagName:"span",children:[he(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),a&&n!=null&&l.push($({tagName:"div",children:[he("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),s.push($({tagName:"div",children:l,properties:{"data-separator-wrapper":"","data-separator-multi-button":c>1?"":void 0}}))}return e==="custom"&&i!=null&&s.push($({tagName:"slot",properties:{name:i}})),$({tagName:"div",children:s,properties:{"data-separator":s.length===0?"simple":e,"data-expand-index":n,"data-separator-first":r?"":void 0,"data-separator-last":o?"":void 0}})}function Lk(e,t){return`hunk-separator-${e}-${t}`}function Nk(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Rk(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Fs({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 ya({item:e,arr:t,enableJoin:n,isNeutral:a=!1,isLastItem:i=!1}){let r=t[t.length-1];if(r==null||i||!n){t.push([a?0:1,e.value]);return}let o=r[0]===0;if(a===o||a&&e.value.length===1&&!o){r[1]+=e.value;return}t.push([a?0:1,e.value])}function wa({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:a,collapsedContextThreshold:i}){let r=Math.max(t,0);if(r===0||e)return{fromStart:0,fromEnd:0,rangeSize:r,collapsedLines:r,renderAll:!1};if(n===!0||r<=i)return{fromStart:r,fromEnd:0,rangeSize:r,collapsedLines:0,renderAll:!0};let o=n?.get(a),c=Math.min(Math.max(o?.fromStart??0,0),r),s=Math.min(Math.max(o?.fromEnd??0,0),r),l=c+s,p=l>=r;return{fromStart:p?r:c,fromEnd:p?0:s,rangeSize:r,collapsedLines:Math.max(r-l,0),renderAll:p}}function Ui({diff:e,diffStyle:t,startingLine:n=0,totalLines:a=1/0,expandedHunks:i,collapsedContextThreshold:r=Xt,callback:o}){let c=I9({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}),s={finalHunk:e.hunks.at(-1),viewportStart:n,viewportEnd:n+a,isWindowedHighlight:n>0||a<1/0,splitCount:c.splitCount,unifiedCount:c.unifiedCount,shouldBreak(){if(!s.isWindowedHighlight)return!1;let l=s.unifiedCount>=n+a,p=s.splitCount>=n+a;return t==="unified"?l:(t==="split"||l)&&p},shouldSkip(l,p){if(!s.isWindowedHighlight)return!1;let d=s.unifiedCount+l<n,m=s.splitCount+p<n;return t==="unified"?d:(t==="split"||d)&&m},incrementCounts(l,p){(t==="unified"||t==="both")&&(s.unifiedCount+=l),(t==="split"||t==="both")&&(s.splitCount+=p)},isInWindow(l,p){if(!s.isWindowedHighlight)return!0;let d=s.isInUnifiedWindow(l),m=s.isInSplitWindow(p);return t==="unified"?d:t==="split"?m:d||m},isInUnifiedWindow(l){return!s.isWindowedHighlight||s.unifiedCount>=n-l&&s.unifiedCount<n+a},isInSplitWindow(l){return!s.isWindowedHighlight||s.splitCount>=n-l&&s.splitCount<n+a},emit(l,p=!1){return p||(t==="unified"?s.incrementCounts(1,0):t==="split"?s.incrementCounts(0,1):s.incrementCounts(1,1)),o(l)??!1}};e:for(let l=c.hunkIndex;l<e.hunks.length;l++){let b=function(x,j){return m==null||m.collapsedLines<=0||m.fromStart+m.fromEnd>0?0:t==="unified"?x===p.unifiedLineStart+p.unifiedLineCount-1?m.collapsedLines:0:j===p.splitLineStart+p.splitLineCount-1?m.collapsedLines:0},w=function(){if(d.collapsedLines===0)return 0;let x=d.collapsedLines;return d.collapsedLines=0,x},p=e.hunks[l];if(p==null)throw new Error("iterateOverDiff: invalid hunk index");if(s.shouldBreak())break;let d=wa({isPartial:e.isPartial,rangeSize:p.collapsedBefore,expandedHunks:i,hunkIndex:l,collapsedContextThreshold:r}),m=(()=>{if(p!==s.finalHunk||!qk(e))return;let x=e.additionLines.length-(p.additionLineIndex+p.additionCount),j=e.deletionLines.length-(p.deletionLineIndex+p.deletionCount);if(x!==j)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${x}, deletions=${j}) for ${e.name}`);let I=Math.min(x,j);return wa({isPartial:e.isPartial,rangeSize:I,expandedHunks:i,hunkIndex:e.hunks.length,collapsedContextThreshold:r})})(),g=d.fromStart+d.fromEnd;if(s.shouldSkip(g,g))s.incrementCounts(g,g),w();else{let x=p.unifiedLineStart-d.rangeSize,j=p.splitLineStart-d.rangeSize,I=p.deletionLineIndex-d.rangeSize,M=p.additionLineIndex-d.rangeSize,F=p.deletionStart-d.rangeSize,T=p.additionStart-d.rangeSize,[Q,G]=zi(s,d.fromStart,t);Q>0&&s.incrementCounts(Q,Q);let q=Q;for(;q<d.fromStart;){if(q>=G){s.incrementCounts(d.fromStart-q,d.fromStart-q);break}if(s.isInWindow(0,0)){if(s.emit({hunkIndex:l,hunk:p,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:F+q,lineIndex:I+q,noEOFCR:!1,unifiedLineIndex:x+q,splitLineIndex:j+q},additionLine:{unifiedLineIndex:x+q,splitLineIndex:j+q,lineIndex:M+q,lineNumber:T+q,noEOFCR:!1}}))break e}else s.incrementCounts(1,1);q++}x=p.unifiedLineStart-d.fromEnd,j=p.splitLineStart-d.fromEnd,I=p.deletionLineIndex-d.fromEnd,M=p.additionLineIndex-d.fromEnd,F=p.deletionStart-d.fromEnd,T=p.additionStart-d.fromEnd;let[ke,Y]=zi(s,d.fromEnd,t);for(ke>0&&s.incrementCounts(ke,ke),q=ke;q<d.fromEnd;){if(q>=Y){s.incrementCounts(d.fromEnd-q,d.fromEnd-q);break}if(s.isInWindow(0,0)){if(s.emit({hunkIndex:l,hunk:p,collapsedBefore:w(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:F+q,lineIndex:I+q,noEOFCR:!1,unifiedLineIndex:x+q,splitLineIndex:j+q},additionLine:{unifiedLineIndex:x+q,splitLineIndex:j+q,lineIndex:M+q,lineNumber:T+q,noEOFCR:!1}}))break e}else s.incrementCounts(1,1);q++}}let C=p.unifiedLineStart,_=p.splitLineStart,h=p.deletionLineIndex,y=p.additionLineIndex,k=p.deletionStart,B=p.additionStart,E=p.hunkContent.at(-1);for(let x of p.hunkContent){if(s.shouldBreak())break e;let j=x===E;if(x.type==="context"){if(s.shouldSkip(x.lines,x.lines))s.incrementCounts(x.lines,x.lines),w();else{let[I,M]=zi(s,x.lines,t);I>0&&s.incrementCounts(I,I);let F=I;for(;F<x.lines;){if(F>=M){s.incrementCounts(x.lines-F,x.lines-F);break}if(s.isInWindow(0,0)){let T=j&&F===x.lines-1,Q=C+F,G=_+F;if(s.emit({hunkIndex:l,hunk:p,collapsedBefore:w(),collapsedAfter:b(Q,G),type:"context",deletionLine:{lineNumber:k+F,lineIndex:h+F,noEOFCR:T&&p.noEOFCRDeletions,unifiedLineIndex:Q,splitLineIndex:G},additionLine:{unifiedLineIndex:Q,splitLineIndex:G,lineIndex:y+F,lineNumber:B+F,noEOFCR:T&&p.noEOFCRAdditions}}))break e}else s.incrementCounts(1,1);F++}}C+=x.lines,_+=x.lines,h+=x.lines,y+=x.lines,k+=x.lines,B+=x.lines}else{let I=Math.max(x.deletions,x.additions),M=x.deletions+x.additions;if(!s.shouldSkip(M,I)){let F=F9(s,x,t);for(let[T,Q]of F)for(let G=T;G<Q;G++){let q=b(C+G,t==="unified"?_+(G<x.deletions?G:G-x.deletions):_+G);if(s.emit($9({hunkIndex:l,hunk:p,collapsedBefore:w(),collapsedAfter:q,diffStyle:t,index:G,unifiedLineIndex:C,splitLineIndex:_,additionLineIndex:y,deletionLineIndex:h,additionLineNumber:B,deletionLineNumber:k,content:x,isLastContent:j,unifiedCount:M,splitCount:I}),!0))break e}}w(),s.incrementCounts(M,I),C+=M,_+=I,h+=x.deletions,y+=x.additions,k+=x.deletions,B+=x.additions}}if(m!=null){let{collapsedLines:x,fromStart:j,fromEnd:I}=m,M=j+I,[F,T]=zi(s,M,t);F>0&&s.incrementCounts(F,F);let Q=F;for(;Q<M;){if(s.shouldBreak())break e;if(Q>=T){s.incrementCounts(M-Q,M-Q);break}if(s.isInWindow(0,0)){let G=Q===M-1;if(s.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:G?x:0,type:"context-expanded",deletionLine:{lineNumber:k+Q,lineIndex:h+Q,noEOFCR:!1,unifiedLineIndex:C+Q,splitLineIndex:_+Q},additionLine:{unifiedLineIndex:C+Q,splitLineIndex:_+Q,lineIndex:y+Q,lineNumber:B+Q,noEOFCR:!1}}))break e}else s.incrementCounts(1,1);Q++}}}}function I9({diff:e,diffStyle:t,startingLine:n,expandedHunks:a,collapsedContextThreshold:i}){if(n<=0||t==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};let r=Q9({diff:e,expandedHunks:a,collapsedContextThreshold:i}),o=0,c=e.hunks.length-1,s=e.hunks.length;for(;o<=c;){let p=o+c>>1,d=r[p+1];if(d==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(t==="unified"?d.unifiedCount:d.splitCount)>n?(s=p,c=p-1):o=p+1}if(s>=e.hunks.length){let p=r[e.hunks.length];if(p==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:p.splitCount,unifiedCount:p.unifiedCount}}let l=r[s];if(l==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:s,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Q9({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let a=0,i=0,r=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let c=0;c<e.hunks.length;c++){let s=e.hunks[c];if(s==null)throw new Error("iterateOverDiff: invalid hunk summary index");let l=wa({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:c,collapsedContextThreshold:n}),p=l.fromStart+l.fromEnd;if(a+=p+s.splitLineCount,i+=p+s.unifiedLineCount,c===r&&qk(e)){let d=D9(e,s),m=wa({isPartial:e.isPartial,rangeSize:d,expandedHunks:t,hunkIndex:e.hunks.length,collapsedContextThreshold:n}),g=m.fromStart+m.fromEnd;a+=g,i+=g}o.push({splitCount:a,unifiedCount:i})}return o}function zi(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let a=[];function i(c){let s=Math.max(0,e.viewportStart-c),l=Math.min(t,e.viewportEnd-c);l>s&&a.push([s,l])}if(n!=="split"&&i(e.unifiedCount),n!=="unified"&&i(e.splitCount),a.length===0)return[0,0];let r=a[0][0],o=a[0][1];for(let c=1;c<a.length;c++){let s=a[c];r=Math.min(r,s[0]),o=Math.max(o,s[1])}return[r,o]}function D9(e,t){let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),a=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==a)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${n}, deletions=${a}) for ${e.name}`);return Math.min(n,a)}function qk(e){let t=e.hunks.at(-1);return t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0?!1:t.additionLineIndex+t.additionCount<e.additionLines.length||t.deletionLineIndex+t.deletionCount<e.deletionLines.length}function F9(e,t,n){if(!e.isWindowedHighlight)return[[0,n==="unified"?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let a=n!=="split",i=n!=="unified",r=n==="unified"?"unified":"split",o=[];function c(d,m){if(d+m<=e.viewportStart||d>=e.viewportEnd)return;let g=Math.max(0,e.viewportStart-d),b=Math.min(m,e.viewportEnd-d);return b>g?[g,b]:void 0}function s(d,m){return r==="split"?d:m==="additions"?[d[0]+t.deletions,d[1]+t.deletions]:d}function l(d,m){if(d==null)return;let[g,b]=s(d,m);b>g&&o.push([g,b])}if(a&&(l(c(e.unifiedCount,t.deletions),"deletions"),l(c(e.unifiedCount+t.deletions,t.additions),"additions")),i&&(l(c(e.splitCount,t.deletions),"deletions"),l(c(e.splitCount,t.additions),"additions")),o.length===0)return o;o.sort((d,m)=>d[0]-m[0]);let p=[o[0]];for(let[d,m]of o.slice(1)){let g=p[p.length-1];d<=g[1]?g[1]=Math.max(g[1],m):p.push([d,m])}return p}function $9({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,diffStyle:i,index:r,unifiedLineIndex:o,splitLineIndex:c,additionLineIndex:s,deletionLineIndex:l,additionLineNumber:p,deletionLineNumber:d,content:m,isLastContent:g,unifiedCount:b,splitCount:w}){let C=r<m.deletions?o+r:void 0,_=i==="unified"?r>=m.deletions?o+r:void 0:r<m.additions?o+m.deletions+r:void 0,h=i==="unified"?c+(r<m.deletions?r:r-m.deletions):c+r,y=r<m.deletions?l+r:void 0,k=r<m.deletions?d+r:void 0,B=i==="unified"?r>=m.deletions?s+(r-m.deletions):void 0:r<m.additions?s+r:void 0,E=i==="unified"?r>=m.deletions?p+(r-m.deletions):void 0:r<m.additions?p+r:void 0,x=i==="unified"?g&&r===m.deletions-1&&t.noEOFCRDeletions:g&&r===w-1&&t.noEOFCRDeletions,j=i==="unified"?g&&r===b-1&&t.noEOFCRAdditions:g&&r===w-1&&t.noEOFCRAdditions,I=y!=null&&k!=null&&C!=null?{lineNumber:k,lineIndex:y,noEOFCR:x,unifiedLineIndex:C,splitLineIndex:h}:void 0,M=B!=null&&E!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:h,lineIndex:B,lineNumber:E,noEOFCR:j}:void 0;if(I==null&&M!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,deletionLine:void 0,additionLine:M};if(I!=null&&M==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,deletionLine:I,additionLine:void 0};if(I==null||M==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,deletionLine:I,additionLine:M}}var S9={forcePlainText:!1};function Mk(e,t,n,{forcePlainText:a,startingLine:i,totalLines:r,expandedHunks:o,collapsedContextThreshold:c=Xt}=S9){a?(i??(i=0),r??(r=1/0)):(i=0,r=1/0);let s=i>0||r<1/0,l=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,p=ok({theme:n.theme,highlighter:t}),d=a&&!s&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,m={deletionLines:[],additionLines:[]},{maxLineDiffLength:g}=n,b=!a&&!e.isPartial,w=a?o:void 0,C=new Map;function _(y){let k=b?0:y,B=C.get(k)??L9();return C.set(k,B),B}function h(y,k,B,E){if(s){let x=B.at(-1);(x==null||x.targetIndex+x.count!==k)&&(x={targetIndex:k,originalOffset:E.length,count:0},B.push(x)),x.count++}E.push(y)}Ui({diff:e,diffStyle:"both",startingLine:i,totalLines:r,expandedHunks:s?w:!0,collapsedContextThreshold:c,callback:({hunkIndex:y,additionLine:k,deletionLine:B,type:E})=>{let x=_(y),j=k!=null?k.splitLineIndex:B.splitLineIndex;E==="change"&&k!=null&&B!=null&&j9({additionLine:e.additionLines[k.lineIndex],deletionLine:e.deletionLines[B.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:d,maxLineDiffLength:g}),B!=null&&(h(e.deletionLines[B.lineIndex],B.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:E==="change"?"change-deletion":E,lineNumber:B.lineNumber,altLineNumber:E==="change"?void 0:k.lineNumber??void 0,lineIndex:`${B.unifiedLineIndex},${j}`})),k!=null&&(h(e.additionLines[k.lineIndex],k.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:E==="change"?"change-addition":E,lineNumber:k.lineNumber,altLineNumber:E==="change"?void 0:B.lineNumber??void 0,lineIndex:`${k.unifiedLineIndex},${j}`}))}});for(let y of C.values()){if(y.deletionContent.length===0&&y.additionContent.length===0)continue;let k={name:e.prevName??e.name,contents:y.deletionContent.value},B={name:e.name,contents:y.additionContent.value},{deletionLines:E,additionLines:x}=N9({deletionFile:k,deletionInfo:y.deletionInfo,deletionDecorations:y.deletionDecorations,additionFile:B,additionInfo:y.additionInfo,additionDecorations:y.additionDecorations,highlighter:t,options:n,languageOverride:a?"text":e.lang});if(b){m.deletionLines=E,m.additionLines=x;continue}if(y.deletionSegments.length>0)for(let j of y.deletionSegments)for(let I=0;I<j.count;I++)m.deletionLines[j.targetIndex+I]=E[j.originalOffset+I];else m.deletionLines.push(...E);if(y.additionSegments.length>0)for(let j of y.additionSegments)for(let I=0;I<j.count;I++)m.additionLines[j.targetIndex+I]=x[j.originalOffset+I];else m.additionLines.push(...x)}return{code:m,themeStyles:p,baseThemeType:l}}function j9({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:a,deletionDecorations:i,additionDecorations:r,lineDiffType:o,maxLineDiffLength:c}){if(e==null||t==null||o==="none"||(e=It(e),t=It(t),e.length>c||t.length>c))return;let s=o==="char"?hs(e,t):Bs(e,t),l=[],p=[],d=o==="word-alt",m=s.at(-1);for(let b of s){let w=b===m;!b.added&&!b.removed?(ya({item:b,arr:l,enableJoin:d,isNeutral:!0,isLastItem:w}),ya({item:b,arr:p,enableJoin:d,isNeutral:!0,isLastItem:w})):b.removed?ya({item:b,arr:l,enableJoin:d,isLastItem:w}):ya({item:b,arr:p,enableJoin:d,isLastItem:w})}let g=0;for(let b of l)b[0]===1&&i.push(Fs({line:n,spanStart:g,spanLength:b[1].length})),g+=b[1].length;g=0;for(let b of p)b[0]===1&&r.push(Fs({line:a,spanStart:g,spanLength:b[1].length})),g+=b[1].length}function L9(){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 N9({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:a,highlighter:i,deletionDecorations:r,additionDecorations:o,languageOverride:c,options:{theme:s=Ae,...l}}){let p=c??Ze(e.name),d=c??Ze(t.name),{state:m,transformers:g}=rk(l.useTokenTransformer),b=typeof s=="string"?{...l,lang:"text",theme:s,transformers:g,decorations:void 0,defaultColor:!1,cssVariablePrefix:Be("token")}:{...l,lang:"text",themes:s,transformers:g,decorations:void 0,defaultColor:!1,cssVariablePrefix:Be("token")};return{deletionLines:e.contents===""?[]:(b.lang=p,m.lineInfo=n,b.decorations=r,ds(i.codeToHast(It(e.contents),b))),additionLines:t.contents===""?[]:(b.lang=d,b.decorations=o,m.lineInfo=a,ds(i.codeToHast(It(t.contents),b)))}}function _a(e){let t=e.lang??Ze(e.name),n=e.lang??(e.prevName!=null?Ze(e.prevName):"text");return t==="text"&&n==="text"}var R9=-1,Uk=class{constructor(e={theme:Ae},t,n){f(this,"__id",`diff-hunks-renderer:${++R9}`);f(this,"highlighter");f(this,"diff");f(this,"expandedHunks",new Map);f(this,"deletionAnnotations",{});f(this,"additionAnnotations",{});f(this,"computedLang","text");f(this,"renderCache");this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=$i(e.theme??Ae)?rs():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let a={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(a.fromStart+=n),(t==="down"||t==="both")&&(a.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,a)}getExpandedHunk(e){return this.expandedHunks.get(e)??bc}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let n=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),a=n[t.lineNumber]??[];n[t.lineNumber]=a,a.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t!=="change"?{gutterLineType:t}:{gutterLineType:e==="deletions"?"change-deletion":"change-addition"}}createAnnotationElement(e){return J_(e)}getOptionsWithDefaults(){let{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:a=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:r=!1,collapsed:o=!1,expandUnchanged:c=!1,collapsedContextThreshold:s=Xt,expansionLineCount:l=100,hunkSeparators:p="line-info",lineDiffType:d="word-alt",maxLineDiffLength:m=1e3,overflow:g="scroll",stickyHeader:b=!1,theme:w=Ae,headerRenderMode:C="default",tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:h=vn,useTokenTransformer:y=!1,useCSSClasses:k=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:a,disableLineNumbers:i,disableVirtualizationBuffers:r,collapsed:o,expandUnchanged:c,collapsedContextThreshold:s,expansionLineCount:l,hunkSeparators:p,lineDiffType:d,maxLineDiffLength:m,overflow:g,stickyHeader:b,theme:this.workerManager?.getDiffRenderOptions().theme??w,headerRenderMode:C,tokenizeMaxLineLength:_,tokenizeMaxLength:h,useTokenTransformer:y,useCSSClasses:k}}async initializeHighlighter(){return this.highlighter=await Di(tk(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Ss(e,this.getTokenizeMaxLength()),a=this.workerManager?.getDiffResultCache(e);a!=null&&!hn(t,a.options)&&(a=void 0),this.renderCache??(this.renderCache={diff:e,highlighted:!n&&!_a(e),options:t,result:n?void 0:a?.result,renderRange:void 0}),this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter==null&&(this.computedLang=e.lang??Ze(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:a,tokenizeMaxLineLength:i,lineDiffType:r,maxLineDiffLength:o}=this.getOptionsWithDefaults();return{theme:a,useTokenTransformer:ck(this.options),tokenizeMaxLineLength:i,lineDiffType:r,maxLineDiffLength:o}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!ga(e,n.diff)||!hn(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=sr){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:a}=this.getOptionsWithDefaults(),{options:i,forceHighlight:r}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},r=!1),this.renderCache??(this.renderCache={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0});let c=e.additionLines.length>0||e.deletionLines.length>0,s=!c||_a(e)||Ss(e,this.getTokenizeMaxLength()),l=!ga(e,this.renderCache.diff),p=!Si(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||p))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||p||r)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Rk(t)||n?!0:this.expandedHunks,a)),this.renderCache.renderRange=t),!s&&c&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??Ze(e.name);let d=this.highlighter!=null&&$i(i.theme),m=this.highlighter!=null&&kr(this.computedLang),g=!s&&m;if(this.highlighter!=null&&d&&(r||s||!this.renderCache.highlighted&&g||this.renderCache.result==null)){let{result:b,options:w}=this.renderDiffWithHighlighter(e,this.highlighter,s||!m);this.renderCache={diff:e,options:w,highlighted:g,result:b,renderRange:void 0}}(!d||!s&&!m)&&this.asyncHighlight(e).then(({result:b,options:w})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,b,w,!s)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=sr){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:a,disableBackground:i,disableLineNumbers:r,overflow:o}=this.getOptionsWithDefaults();return ek({type:"diff",diffIndicators:a,disableBackground:i,disableLineNumbers:r,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Ss(e,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??Ze(e.name);let n=this.highlighter!=null&&$i(this.options.theme??Ae),a=t||this.highlighter!=null&&kr(this.computedLang);return(this.highlighter==null||!n||!a)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:a}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:Mk(e,t,a,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:a}}onHighlightSuccess(e,t,n,a=!0){if(this.renderCache==null)return;let i=!this.renderCache.highlighted||!hn(this.renderCache.options,n)||!ga(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:a,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!hn(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&ga(e,n.diff)&&hn(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??vn}processDiffResult(e,t,{code:n,themeStyles:a,baseThemeType:i}){let{diffStyle:r,disableFileHeader:o,expandUnchanged:c,expansionLineCount:s,collapsedContextThreshold:l,hunkSeparators:p}=this.getOptionsWithDefaults();this.diff=e;let d=r==="unified",m=[],g=[],b=[],w=[],{additionLines:C,deletionLines:_}=n,h={rowCount:0,hunkSeparators:p,additionsContentAST:m,deletionsContentAST:g,unifiedContentAST:b,unifiedGutterAST:En(),deletionsGutterAST:En(),additionsGutterAST:En(),expansionLineCount:s,hunkData:w,incrementRowCount(Q=1){h.rowCount+=Q},pushToGutter(Q,G){switch(Q){case"unified":h.unifiedGutterAST.children.push(G);break;case"deletions":h.deletionsGutterAST.children.push(G);break;case"additions":h.additionsGutterAST.children.push(G);break}}},y=q9(e),k={size:0,side:void 0,increment(){this.size+=1},flush(){if(r!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(h.pushToGutter("additions",xe(void 0,"buffer",this.size)),m?.push(fa(this.size))):(h.pushToGutter("deletions",xe(void 0,"buffer",this.size)),g?.push(fa(this.size))),this.size=0,this.side=void 0}}},B=(Q,G,q,ke,Y)=>{h.pushToGutter(Q,yc(G,q,ke,Y))};function E(Q){k.flush(),r==="unified"?$s("unified",Q,h):($s("deletions",Q,h),$s("additions",Q,h))}Ui({diff:e,diffStyle:r,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:c?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:Q,hunk:G,collapsedBefore:q,collapsedAfter:ke,additionLine:Y,deletionLine:ce,type:le})=>{let Vt=ce!=null?ce.splitLineIndex:Y.splitLineIndex,tr=Y!=null?Y.unifiedLineIndex:ce.unifiedLineIndex;r==="split"&&le!=="change"&&k.flush(),q>0&&E({hunkIndex:Q,collapsedLines:q,rangeSize:Math.max(G?.collapsedBefore??0,0),hunkSpecs:G?.hunkSpecs,isFirstHunk:Q===0,isLastHunk:!1,isExpandable:!e.isPartial});let nr=r==="unified"?tr:Vt,ic={type:le,hunkIndex:Q,lineIndex:nr,unifiedLineIndex:tr,splitLineIndex:Vt,deletionLine:ce,additionLine:Y};if(r==="unified"){let ne=this.getUnifiedInjectedRowsForLine?.(ic);ne?.before!=null&&Tk(ne.before,h);let Fe=ce!=null?_[ce.lineIndex]:void 0,$e=Y!=null?C[Y.lineIndex]:void 0;if(Fe==null&&$e==null){let gt="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(gt,{file:e.name}),new Error(gt)}let kn=le==="change"?Y!=null?"change-addition":"change-deletion":le,At=this.getUnifiedLineDecoration({type:le,lineType:kn,additionLineIndex:Y?.lineIndex,deletionLineIndex:ce?.lineIndex});B("unified",At.gutterLineType,Y!=null?Y.lineNumber:ce.lineNumber,`${tr},${Vt}`,At.gutterProperties),$e!=null?$e=Oi($e,At.contentProperties):Fe!=null&&(Fe=Oi(Fe,At.contentProperties)),zk({diffStyle:"unified",type:le,deletionLine:Fe,additionLine:$e,unifiedSpan:this.getAnnotations("unified",ce?.lineNumber,Y?.lineNumber,Q,nr),createAnnotationElement:gt=>this.createAnnotationElement(gt),context:h}),ne?.after!=null&&Tk(ne.after,h)}else{let ne=this.getSplitInjectedRowsForLine?.(ic);ne?.before!=null&&Pk(ne.before,h,k);let Fe=ce!=null?_[ce.lineIndex]:void 0,$e=Y!=null?C[Y.lineIndex]:void 0,kn=this.getSplitLineDecoration({side:"deletions",type:le,lineIndex:ce?.lineIndex}),At=this.getSplitLineDecoration({side:"additions",type:le,lineIndex:Y?.lineIndex});if(Fe==null&&$e==null){let Te="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(Te,{file:e.name}),new Error(Te)}let gt=(()=>{if(le==="change"){if($e==null)return"additions";if(Fe==null)return"deletions"}})();if(gt!=null){if(k.side!=null&&k.side!==gt)throw new Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");k.side=gt,k.increment()}let oc=this.getAnnotations("split",ce?.lineNumber,Y?.lineNumber,Q,nr);if(oc!=null&&k.size>0&&k.flush(),ce!=null){let Te=Oi(Fe,kn.contentProperties);B("deletions",kn.gutterLineType,ce.lineNumber,`${ce.unifiedLineIndex},${Vt}`,kn.gutterProperties),Te!=null&&(Fe=Te)}if(Y!=null){let Te=Oi($e,At.contentProperties);B("additions",At.gutterLineType,Y.lineNumber,`${Y.unifiedLineIndex},${Vt}`,At.gutterProperties),Te!=null&&($e=Te)}zk({diffStyle:"split",type:le,additionLine:$e,deletionLine:Fe,...oc,createAnnotationElement:Te=>this.createAnnotationElement(Te),context:h}),ne?.after!=null&&Pk(ne.after,h,k)}let rc=r==="split"&&G!=null&&Vt===G.splitLineStart+G.splitLineCount-1,nB=rc?G.noEOFCRDeletions:!1,aB=rc?G.noEOFCRAdditions:!1,ar=(ce?.noEOFCR??!1)||nB,ir=(Y?.noEOFCR??!1)||aB;if(ir||ar){if(r==="split"&&k.flush(),ar){let ne=le==="context"||le==="context-expanded"?le:"change-deletion";r==="unified"?(h.unifiedContentAST.push(ha(ne)),h.pushToGutter("unified",xe(ne,"metadata",1))):(h.deletionsContentAST.push(ha(ne)),h.pushToGutter("deletions",xe(ne,"metadata",1)),ir||(h.pushToGutter("additions",xe(void 0,"buffer",1)),h.additionsContentAST.push(fa(1))))}if(ir){let ne=le==="context"||le==="context-expanded"?le:"change-addition";r==="unified"?(h.unifiedContentAST.push(ha(ne)),h.pushToGutter("unified",xe(ne,"metadata",1))):(h.additionsContentAST.push(ha(ne)),h.pushToGutter("additions",xe(ne,"metadata",1)),ar||(h.pushToGutter("deletions",xe(void 0,"buffer",1)),h.deletionsContentAST.push(fa(1))))}h.incrementRowCount(1)}ke>0&&p!=="simple"&&E({hunkIndex:le==="context-expanded"?Q:Q+1,collapsedLines:ke,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),h.incrementRowCount(1)}}),r==="split"&&k.flush();let x=Math.max(Nk(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),j=t.bufferBefore>0||t.bufferAfter>0,I=!d&&e.type!=="deleted",M=!d&&e.type!=="new",F=h.rowCount>0||j;m=I&&F?m:void 0,g=M&&F?g:void 0,b=d&&F?b:void 0;let T=this.createPreElement(g!=null&&m!=null,x);return{unifiedGutterAST:d&&F?h.unifiedGutterAST.children:void 0,unifiedContentAST:b,deletionsGutterAST:M&&F?h.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:I&&F?h.additionsGutterAST.children:void 0,additionsContentAST:m,hunkData:w,preNode:T,themeStyles:a,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:x,rowCount:h.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){let n=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,a=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(n==null||a==null)return;let i=En(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,sk(a,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators==="line-info",a=this.renderCodeAST("unified",e);if(a!=null)return t.push($({tagName:"code",children:a,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($({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));let r=this.renderCodeAST("additions",e);return r!=null&&t.push($({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return je(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?je(e):je($({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}getAnnotations(e,t,n,a,i){let r={type:"annotation",hunkIndex:a,lineIndex:i,annotations:[]};if(t!=null)for(let c of this.deletionAnnotations[t]??[])r.annotations.push(An(c));let o={type:"annotation",hunkIndex:a,lineIndex:i,annotations:[]};if(n!=null)for(let c of this.additionAnnotations[n]??[])(e==="unified"?r:o).annotations.push(An(c));if(e==="unified")return r.annotations.length>0?r:void 0;if(!(o.annotations.length===0&&r.annotations.length===0))return{deletionSpan:r,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return X_({fileOrDiff:e,mode:t,stickyHeader:n})}};function Gk(e){return`${e} unmodified line${e>1?"s":""}`}function Tk(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function Pk(e,t,n){for(let{deletion:a,addition:i}of e){if(a==null&&i==null)continue;let r=a!=null&&i!=null?void 0:a==null?"deletions":"additions";(r==null||n.side!==r)&&n.flush(),a!=null&&(t.deletionsContentAST.push(a.content),t.pushToGutter("deletions",a.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter("additions",i.gutter)),r!=null&&(n.side=r,n.increment()),t.incrementRowCount(1)}}function zk({diffStyle:e,type:t,deletionLine:n,additionLine:a,unifiedSpan:i,deletionSpan:r,additionSpan:o,createAnnotationElement:c,context:s}){let l=!1;if(e==="unified"){if(a!=null?s.unifiedContentAST.push(a):n!=null&&s.unifiedContentAST.push(n),i!=null){let p=t==="change"?n!=null?"change-deletion":"change-addition":t;s.unifiedContentAST.push(c(i)),s.pushToGutter("unified",xe(p,"annotation",1)),l=!0}}else if(e==="split"){if(n!=null&&s.deletionsContentAST.push(n),a!=null&&s.additionsContentAST.push(a),r!=null){let p=t==="change"?n!=null?"change-deletion":"context":t;s.deletionsContentAST.push(c(r)),s.pushToGutter("deletions",xe(p,"annotation",1)),l=!0}if(o!=null){let p=t==="change"?a!=null?"change-addition":"context":t;s.additionsContentAST.push(c(o)),s.pushToGutter("additions",xe(p,"annotation",1)),l=!0}}l&&s.incrementRowCount(1)}function $s(e,{hunkIndex:t,collapsedLines:n,rangeSize:a,hunkSpecs:i,isFirstHunk:r,isLastHunk:o,isExpandable:c},s){if(n<=0)return;let l=e==="unified"?s.unifiedContentAST:e==="deletions"?s.deletionsContentAST:s.additionsContentAST;if(s.hunkSeparators==="metadata"){i!=null&&(s.pushToGutter(e,Yt({type:"metadata",content:i,isFirstHunk:r,isLastHunk:o})),l.push(Yt({type:"metadata",content:i,isFirstHunk:r,isLastHunk:o})),e!=="additions"&&s.incrementRowCount(1));return}if(s.hunkSeparators==="simple"){t>0&&(s.pushToGutter(e,Yt({type:"simple",isFirstHunk:r,isLastHunk:!1})),l.push(Yt({type:"simple",isFirstHunk:r,isLastHunk:!1})),e!=="additions"&&s.incrementRowCount(1));return}let p=Lk(e,t),d=a>s.expansionLineCount,m=c?t:void 0;s.pushToGutter(e,Yt({type:s.hunkSeparators,content:Gk(n),expandIndex:m,chunked:d,slotName:p,isFirstHunk:r,isLastHunk:o})),l.push(Yt({type:s.hunkSeparators,content:Gk(n),expandIndex:m,chunked:d,slotName:p,isFirstHunk:r,isLastHunk:o})),e!=="additions"&&s.incrementRowCount(1),s.hunkData.push({slotName:p,hunkIndex:t,lines:n,type:e,expandable:c?{up:!r,down:!o,chunked:d}:void 0})}function Oi(e,t){return e==null||e.type!=="element"||t==null?e:{...e,properties:{...e.properties,...t}}}function Ss(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function q9(e){let t=e.hunks.at(-1);if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),a=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==a)throw new Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${a}) for ${e.name}`);return Math.min(n,a)}function Ok(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Hk(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Zk(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}var M9=-1,js,Ls=(js=class{constructor(e={theme:Ae},t,n=!1){f(this,"__id",`file-diff:${++M9}`);f(this,"fileContainer");f(this,"spriteSVG");f(this,"pre");f(this,"codeUnified");f(this,"codeDeletions");f(this,"codeAdditions");f(this,"bufferBefore");f(this,"bufferAfter");f(this,"themeCSSStyle");f(this,"appliedThemeCSS");f(this,"hasAdoptedThemeCSS",!1);f(this,"unsafeCSSStyle");f(this,"appliedUnsafeCSS");f(this,"gutterUtilityContent");f(this,"headerElement");f(this,"headerPrefix");f(this,"headerMetadata");f(this,"headerCustom");f(this,"separatorCache",new Map);f(this,"errorWrapper");f(this,"placeHolder");f(this,"hunksRenderer");f(this,"resizeManager");f(this,"scrollSyncManager");f(this,"interactionManager");f(this,"annotationCache",new Map);f(this,"lineAnnotations",[]);f(this,"managersDirty",!1);f(this,"deletionFile");f(this,"additionFile");f(this,"fileDiff");f(this,"renderRange");f(this,"appliedPreAttributes");f(this,"lastRenderedHeaderHTML");f(this,"cachedHeaderHTML");f(this,"lastRowCount");f(this,"enabled",!0);f(this,"handleHighlightRender",()=>{this.rerender()});f(this,"getLineIndex",(e,t="additions")=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),a,i;e:for(let r of this.fileDiff.hunks){let o=t==="deletions"?r.deletionStart:r.additionStart,c=t==="deletions"?r.deletionCount:r.additionCount,s=r.splitLineStart,l=r.unifiedLineStart;if(e<o){let p=o-e;a=Math.max(l-p,0),i=Math.max(s-p,0);break e}if(e>=o+c){if(r===n){let p=e-(o+c);a=l+r.unifiedLineCount+p,i=s+r.splitLineCount+p;break e}continue}for(let p of r.hunkContent)if(p.type==="context")if(e<o+p.lines){let d=e-o;i=s+d,a=l+d;break e}else o+=p.lines,s+=p.lines,l+=p.lines;else{let d=t==="deletions"?p.deletions:p.additions;if(e<o+d){let m=e-o;a=l+(t==="additions"?p.deletions:0)+m,i=s+m;break e}else o+=d,s+=Math.max(p.deletions,p.additions),l+=p.deletions+p.additions}break e}if(!(a==null||i==null))return[a,i]});f(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine());f(this,"handleExpandHunk",(e,t,n)=>{this.expandHunk(e,t,n)});f(this,"expandHunk",(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()});this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new al,this.scrollSyncManager=new jk,this.interactionManager=new nl("diff",_r(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}getHunksRendererOptions(e){return Zk(e)}createHunksRenderer(e){return new Uk(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(_r(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?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Qa(this.appliedThemeCSS.theme,this.options.theme??Ae)}setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators=="function")}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,t==="wrap"),t==="scroll"&&e==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.lineAnnotations=[],this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:a=!1,lineAnnotations:i,oldFile:r,newFile:o,fileDiff:c}=e;this.hydrateElements(t,n),P9(this.pre,G9({fileDiff:c,oldFile:r,newFile:o}),this.options.collapsed)||z9(this.headerElement,T9({fileDiff:c,oldFile:r,newFile:o}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:c,oldFile:r,newFile:o,lineAnnotations:i}),a||this.emitPostRender()}hydrateElements(e,t){wk(e,t);for(let n of e.shadowRoot?.children??[]){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n;for(let a of n.children)!(a instanceof HTMLElement)||a.tagName.toLowerCase()!=="code"||("deletions"in a.dataset&&(this.codeDeletions=a),"additions"in a.dataset&&(this.codeAdditions=a),"unified"in a.dataset&&(this.codeUnified=a));continue}if("diffsHeader"in n.dataset){this.headerElement=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(Bn)){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(xn)){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:a}){this.lineAnnotations=a??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?Qs(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}render({oldFile:e,newFile:t,fileDiff:n,deferManagers:a=!1,forceRender:i=!1,preventEmit:r=!1,lineAnnotations:o,fileContainer:c,containerWrapper:s,renderRange:l}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");let{collapsed:p=!1,themeType:d="system"}=this.options,m=p?void 0:l,g=this.hasThemeChanged(),b=e!=null&&t!=null&&(!ss(e,this.deletionFile)||!ss(t,this.additionFile)),w=n!=null&&n!==this.fileDiff,C=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1;if(!p&&Si(m,this.renderRange)&&!i&&!C&&!g&&(n!=null&&n===this.fileDiff||n==null&&!b))return this.applyCachedThemeState(d);let{renderRange:_}=this;if(this.renderRange=m,this.deletionFile=e,this.additionFile=t,n!=null?this.fileDiff=n:e!=null&&t!=null&&b&&(w=!0,this.fileDiff=Qs(e,t,this.options.parseDiffOptions)),w&&(this.cachedHeaderHTML=void 0),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),c=this.getOrCreateFileContainer(c,s),this.applyCachedThemeState(d),p){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let k=this.hunksRenderer.renderDiff(this.fileDiff,fc);k!=null&&this.applyThemeState(c,k.themeStyles,d,k.baseThemeType),k?.headerElement!=null&&this.applyHeaderToDOM(k.headerElement,c),this.renderSeparators([]),this.injectUnsafeCSS()}catch(k){if(h)throw k;console.error(k),k instanceof Error&&this.applyErrorToDOM(k,c)}return r||this.emitPostRender(),!0}try{let k=this.getOrCreatePreNode(c);if(!(this.canPartiallyRender(i,C,b||w||g)&&this.applyPartialRender({previousRenderRange:_,renderRange:m}))){let B=this.hunksRenderer.renderDiff(this.fileDiff,m);if(B==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(c,B.themeStyles,d,B.baseThemeType),B.headerElement!=null&&this.applyHeaderToDOM(B.headerElement,c),B.additionsContentAST!=null||B.deletionsContentAST!=null||B.unifiedContentAST!=null?this.applyHunksToDOM(k,B):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(B.hunkData)}this.applyBuffers(k,m),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers()}catch(k){if(h)throw k;console.error(k),k instanceof Error&&this.applyErrorToDOM(k,c)}return r||this.emitPostRender(),!0}emitPostRender(){this.fileContainer!=null&&this.options.onPostRender?.(this.fileContainer,this)}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.cleanChildNodes(),this.placeHolder==null){let t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){let{fileDiff:e,workerManager:t}=this;if(e==null||t==null||_a(e))return;let n=this.options.tokenizeMaxLength??vn;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!="function"){for(let{element:a}of this.separatorCache.values())a.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let a of e){let i=a.slotName,r=this.separatorCache.get(i);if(r==null||!Hk(a,r.hunkData)){r?.element.remove();let o=document.createElement("div");o.style.display="contents",o.slot=a.slotName;let c=t(a,this);c!=null&&o.appendChild(c),this.fileContainer.appendChild(o),r={element:o,hunkData:a},this.separatorCache.set(i,r)}n.delete(i)}for(let[a,{element:i}]of n.entries())this.separatorCache.delete(a),i.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,a]of this.lineAnnotations.entries()){let i=`${n}-${An(a)}`,r=this.annotationCache.get(i);if(r==null||!Ok(a,r.annotation)){r?.element.remove();let o=t(a);if(o==null)continue;r={element:uk(An(a)),annotation:a},r.element.appendChild(o),this.fileContainer.appendChild(r.element),this.annotationCache.set(i,r)}e.delete(i)}for(let[n,{element:a}]of e.entries())this.annotationCache.delete(n),a.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=mk();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let n=this.fileContainer;this.fileContainer=e??this.fileContainer??document.createElement(Cn);let a=n!==this.fileContainer;return n!=null&&a&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),a&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let n of t.children)n instanceof SVGElement?this.spriteSVG??(this.spriteSVG=n):ms(n)&&n.hasAttribute(Bn)?(this.themeCSSStyle??(this.themeCSSStyle=n),this.hasAdoptedThemeCSS=!0):ms(n)&&n.hasAttribute(xn)&&(this.unsafeCSSStyle??(this.unsafeCSSStyle=n),this.appliedUnsafeCSS??(this.appliedUnsafeCSS=this.options.unsafeCSS??void 0))}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){let n=document.createElement("div");n.innerHTML=lk;let a=n.firstChild;a instanceof SVGElement&&(this.spriteSVG=a)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,a=this.cachedHeaderHTML??je(e);if(this.cachedHeaderHTML=a,a!==this.lastRenderedHeaderHTML){let l=document.createElement("div");l.innerHTML=a;let p=l.firstElementChild;if(!(p instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(p,this.headerElement):t.shadowRoot?.prepend(p),this.headerElement=p,this.lastRenderedHeaderHTML=a}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:r,renderHeaderMetadata:o}=this.options;if(i!=null){let l=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Ea,l),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let c=r?.(n)??void 0,s=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,xa,c),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,va,s),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,a){if(a==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t==null&&e.appendChild(i),this.replaceHeaderSlotContent(i,a),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??(this.unsafeCSSStyle=Ak()),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=fk(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,a){let i=e.shadowRoot??e.attachShadow({mode:"open"}),r=a??n,o=this.options.theme??Ae,c=typeof o=="string"?o:{...o},s=Aa(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===r&&this.appliedThemeCSS.scrollbarGutter===s){this.appliedThemeCSS.theme=c;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:c,themeStyles:t,themeType:r,baseThemeType:a,scrollbarGutter:s};return}this.themeCSSStyle=kk({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:hk(t,r,s)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:c,themeStyles:t,themeType:r,baseThemeType:a,scrollbarGutter:s}:void 0}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=yk(this.themeCSSStyle.textContent??"",Aa(e)))}applyHunksToDOM(e,t){let{overflow:n="scroll"}=this.options,a=(this.options.hunkSeparators??"line-info")==="line-info",i=n==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let r=!1,o=[],c=this.hunksRenderer.renderCodeAST("unified",t),s=this.hunksRenderer.renderCodeAST("deletions",t),l=this.hunksRenderer.renderCodeAST("additions",t);c!=null?(r=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=Ri({code:this.codeUnified,columnType:"unified",rowSpan:i,containerSize:a}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(c),o.push(this.codeUnified)):s!=null||l!=null?(s!=null?(r=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ri({code:this.codeDeletions,columnType:"deletions",rowSpan:i,containerSize:a}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(s),o.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),l!=null?(r=r||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ri({code:this.codeAdditions,columnType:"additions",rowSpan:i,containerSize:a}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l),o.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),o.length===0?e.textContent="":r&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:a,codeAdditions:i,codeDeletions:r,options:{diffStyle:o="split"}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(o,a,r,i);if(c==null)return!1;let s=e.startingLine,l=t.startingLine,p=s+e.totalLines,d=l+t.totalLines,m=Math.max(s,l),g=Math.min(p,d);if(g<=m)return!1;let b=Math.max(0,m-s),w=Math.max(0,p-g),C=this.trimColumns({columns:c,trimStart:b,trimEnd:w,previousStart:s,overlapStart:m,overlapEnd:g,diffStyle:o});if(C<0)throw new Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<C)throw new Error("applyPartialRender: trimmed beyond DOM row count");let _=this.lastRowCount-C,h=(E,x)=>{if(!(x<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:E,totalLines:x,bufferBefore:0,bufferAfter:0})},y=h(l,Math.max(m-l,0));if(y==null&&l<m)return!1;let k=h(g,Math.max(d-g,0));if(k==null&&d>g)return!1;let B=(E,x)=>{if(E!=null){if(o==="unified"&&!Array.isArray(c))this.insertPartialHTML(o,c,E,x);else if(o==="split"&&Array.isArray(c))this.insertPartialHTML(o,c,E,x);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");_+=E.rowCount}};return this.cleanupErrorWrapper(),B(y,"afterbegin"),B(k,"beforeend"),this.lastRowCount!==_&&(this.applyRowSpan(o,c,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,a){if(e==="unified"&&!Array.isArray(t)){let i=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,i,a)}else if(e==="split"&&Array.isArray(t)){let i=this.hunksRenderer.renderCodeAST("deletions",n),r=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],i,a),this.renderPartialColumn(t[1],r,a)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}renderPartialColumn(e,t,n){if(e==null||t==null)return;let a=Wk(t[0]),i=Wk(t[1]);if(a==null||i==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");let r=i.at(0);n==="beforeend"&&r?.type==="element"&&typeof r.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(r.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],a,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],a,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(a)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,a,i,r){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(r?(a.shift(),i.shift()):(a.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let a=i=>{i!=null&&(i.gutter.style.setProperty("grid-row",`span ${n}`),i.content.style.setProperty("grid-row",`span ${n}`))};if(e==="unified"&&!Array.isArray(t))a(t);else if(e==="split"&&Array.isArray(t))a(t[0]),a(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,n){let a=0,i=0,r=0,o=!1,c=n>=0;if(e==null)return 0;let s=Array.from(e.content.children),l=Array.from(e.gutter.children);if(s.length!==l.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;r<s.length&&!(t<=0&&!c&&!o);){let p=l[r],d=s[r];if(r++,!(p instanceof HTMLElement)||!(d instanceof HTMLElement))throw console.error({gutterElement:p,contentElement:d}),new Error("FileDiff.trimColumnRows: invalid row elements");if(o&&(o=!1,p.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in d.dataset||p.dataset.gutterBuffer==="metadata"&&"noNewline"in d.dataset)){p.remove(),d.remove(),i++;continue}if("lineIndex"in p.dataset&&"lineIndex"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),t>0&&(t--,t===0&&(o=!0)),i++),a++;continue}if("separator"in p.dataset&&"separator"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),i++);continue}if(p.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),i++);continue}if(p.dataset.gutterBuffer==="metadata"&&"noNewline"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),i++);continue}if(p.dataset.gutterBuffer==="buffer"&&"contentBuffer"in d.dataset){let m=this.getBufferSize(d.dataset);if(m==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){let g=Math.min(t,m),b=m-g;b>0?(this.updateBufferSize(p,b),this.updateBufferSize(d,b),i+=g):(p.remove(),d.remove(),i+=m),t-=g,t===0&&b===0&&(o=!0)}else if(c){let g=a,b=a+m-1;if(n<=g)p.remove(),d.remove(),i+=m;else if(n<=b){let w=b-n+1,C=m-w;this.updateBufferSize(p,C),this.updateBufferSize(d,C),i+=w}}a+=m;continue}throw console.error({gutterElement:p,contentElement:d}),new Error("FileDiff.trimColumnRows: unknown row elements")}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:a,previousStart:i,trimEnd:r,trimStart:o}){let c=Math.max(0,a-i),s=n-i;if(s<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");let l=o>0,p=r>0;if(!l&&!p)return 0;let d=l?c:0,m=p?s:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,d,m);if(t==="split"&&Array.isArray(e)){let g=this.trimColumnRows(e[0],d,m),b=this.trimColumnRows(e[1],d,m);if(e[0]!=null&&e[1]!=null&&g!==b)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?g:b}else throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,a){function i(r){if(r==null)return;let o=r.children[0],c=r.children[1];if(!(!(o instanceof HTMLElement)||!(c instanceof HTMLElement)||o.dataset.gutter==null||c.dataset.content==null))return{gutter:o,content:c}}if(e==="unified")return i(t);{let r=i(n),o=i(a);return r!=null||o!=null?[r,o]:void 0}}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:a},i){let{diffIndicators:r="bars",disableBackground:o=!1,disableLineNumbers:c=!1,overflow:s="scroll",diffStyle:l="split"}=this.options,p={type:"diff",diffIndicators:r,disableBackground:o,disableLineNumbers:c,overflow:s,split:l==="unified"?!1:t!=null&&n!=null,totalLines:a,customProperties:i};dk(p,this.appliedPreAttributes)||(_k(e,p),this.appliedPreAttributes=p)}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??(this.errorWrapper=document.createElement("div")),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);let a=document.createElement("div");a.dataset.errorMessage="",a.innerText=e.message,this.errorWrapper.appendChild(a);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}},f(js,"LoadedCustomComponent",Ck),js);function G9({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function T9({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function P9(e,t,n=!1){return!n&&e==null&&t}function z9(e,t,n=!1){return e==null&&t&&!n}function Wk(e){if(!(e==null||e.type!=="element"))return e.children??[]}var qj=()=>Promise.resolve().then(()=>(Kt(),Yk)),Mj=()=>Promise.resolve().then(()=>(Rs(),Kk)),Gj=()=>Promise.resolve().then(()=>(Ms(),Jk)),Tj=()=>Promise.resolve().then(()=>(Ts(),Vk)),Pj=()=>Promise.resolve().then(()=>(zs(),Xk)),zj=()=>Promise.resolve().then(()=>(tC(),eC)),Uj=()=>Promise.resolve().then(()=>(Os(),nC)),Oj=()=>Promise.resolve().then(()=>(yn(),aC)),Hj=()=>Promise.resolve().then(()=>(Hi(),iC)),Zj=()=>Promise.resolve().then(()=>(oC(),rC)),Wj=()=>Promise.resolve().then(()=>(cC(),sC)),Yj=()=>Promise.resolve().then(()=>(pC(),lC)),Kj=()=>Promise.resolve().then(()=>(uC(),dC)),Jj=()=>Promise.resolve().then(()=>(Ws(),mC)),Vj=()=>Promise.resolve().then(()=>(Ca(),AC)),Xj=()=>Promise.resolve().then(()=>(Vs(),hC)),e3=()=>Promise.resolve().then(()=>(wC(),yC)),t3=()=>Promise.resolve().then(()=>(CC(),kC)),n3=()=>Promise.resolve().then(()=>(wn(),gC)),a3=()=>Promise.resolve().then(()=>(xC(),BC)),i3=()=>Promise.resolve().then(()=>($C(),FC)),r3=()=>Promise.resolve().then(()=>(jC(),SC)),o3=()=>Promise.resolve().then(()=>(NC(),LC)),s3=()=>Promise.resolve().then(()=>(qC(),RC)),c3=()=>Promise.resolve().then(()=>(GC(),MC)),l3=()=>Promise.resolve().then(()=>(ec(),DC)),p3=()=>Promise.resolve().then(()=>(PC(),TC)),d3=()=>Promise.resolve().then(()=>(Ki(),_C)),u3=()=>Promise.resolve().then(()=>(UC(),zC)),Ji=[{id:"javascript",name:"JavaScript",aliases:["js","mjs","cjs"],import:qj},{id:"typescript",name:"TypeScript",aliases:["ts","mts","cts"],import:Mj},{id:"tsx",name:"TSX",import:Gj},{id:"jsx",name:"JSX",import:Tj},{id:"json",name:"JSON",aliases:["jsonc","json5","jsonl"],import:Pj},{id:"markdown",name:"Markdown",aliases:["md"],import:zj},{id:"yaml",name:"YAML",aliases:["yml"],import:Uj},{id:"css",name:"CSS",import:Oj},{id:"html",name:"HTML",import:Hj},{id:"sh",name:"Shell",aliases:["bash","shell","shellscript","zsh"],import:Zj},{id:"python",name:"Python",aliases:["py"],import:Wj},{id:"go",name:"Go",import:Yj},{id:"rust",name:"Rust",aliases:["rs"],import:Kj},{id:"java",name:"Java",import:Jj},{id:"c",name:"C",import:Vj},{id:"cpp",name:"C++",aliases:["c++"],import:Xj},{id:"csharp",name:"C#",aliases:["c#","cs"],import:e3},{id:"php",name:"PHP",import:t3},{id:"sql",name:"SQL",import:n3},{id:"docker",name:"Docker",aliases:["dockerfile"],import:a3},{id:"ruby",name:"Ruby",aliases:["rb"],import:i3},{id:"swift",name:"Swift",import:r3},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:o3},{id:"r",name:"R",import:s3},{id:"dart",name:"Dart",import:c3},{id:"lua",name:"Lua",import:l3},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:p3},{id:"xml",name:"XML",import:d3},{id:"toml",name:"TOML",import:u3}],tc=Object.fromEntries(Ji.map(e=>[e.id,e.import]));function nc(e){return"aliases"in e?e.aliases:[]}var m3=Object.fromEntries(Ji.flatMap(e=>nc(e).map(t=>[t,e.import]))),jU={...tc,...m3};var A3=[...Object.keys(tc),"text","ansi"],g3=new Set(A3),b3=new Map(Ji.flatMap(e=>nc(e).map(t=>[t,e.id])));function f3(e){if(typeof e!="string")return;let t=e.trim();return t||void 0}async function OC(e,t={}){let n=f3(e);if(!n)return;let a=b3.get(n);if(a)return a;if(g3.has(n))return n;if(t.languagePackAvailable)try{return await la(n),n}catch{return}}async function h3(e,t){let n=new Set;for(let a of e){let i=await OC(a,t);i&&n.add(i)}return t.fallbackToText&&n.size===0&&n.add("text"),[...n]}function y3(e){let t=new Set;return e.fileDiff?.lang&&t.add(e.fileDiff.lang),e.oldFile?.lang&&t.add(e.oldFile.lang),e.newFile?.lang&&t.add(e.newFile.lang),[...t]}async function ac(e,t){if(!e)return;if(typeof e.lang!="string")return e;let n=await OC(e.lang,t);return e.lang===n?e:n?{...e,lang:n}:{...e,lang:"text"}}async function HC(e,t={}){let[n,a,i,r]=await Promise.all([ac(e.fileDiff,t),ac(e.oldFile,t),ac(e.newFile,t),h3(e.langs,{fallbackToText:!1,...t})]),o=new Set(r);for(let c of y3({fileDiff:n,oldFile:a,newFile:i}))o.add(c);return o.size===0&&o.add("text"),{...e,fileDiff:n,oldFile:a,newFile:i,langs:[...o]}}var ZC=["unified","split"];var WC=["light","dark"],YC=["bars","classic","none"];var w3=["scroll","wrap"];function _n(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function KC(e){let t;try{t=JSON.parse(e)}catch{throw new Error("Diff payload is not valid JSON.")}if(!_3(t))throw new Error("Diff payload has invalid shape.");return t}function _3(e){if(!_n(e)||typeof e.prerenderedHTML!="string"||!Array.isArray(e.langs)||!e.langs.every(a=>typeof a=="string")||!k3(e.options))return!1;let t=_n(e.fileDiff),n=_n(e.oldFile)&&_n(e.newFile);return!(!t&&!n)}function k3(e){return!(!_n(e)||!_n(e.theme)||e.theme.light!=="pierre-light"||e.theme.dark!=="pierre-dark"||!Vi(ZC,e.diffStyle)||!Vi(YC,e.diffIndicators)||!Vi(WC,e.themeType)||!Vi(w3,e.overflow)||typeof e.disableLineNumbers!="boolean"||typeof e.expandUnchanged!="boolean"||typeof e.backgroundEnabled!="boolean"||typeof e.unsafeCSS!="string")}function Vi(e,t){return typeof t=="string"&&e.includes(t)}var VC=[],z={theme:"dark",layout:"unified",backgroundEnabled:!0,wrapEnabled:!0};function C3(e){let t=e.textContent?.trim();if(!t)throw new Error("Diff payload was empty.");return KC(t)}function B3(){let e=[];for(let t of document.querySelectorAll(".oc-diff-card")){let n=t.querySelector("[data-openclaw-diff-host]"),a=t.querySelector("[data-openclaw-diff-payload]");if(!(!n||!a))try{e.push({host:n,payload:C3(a)})}catch(i){console.warn("Skipping invalid diff payload",i)}}return e}function x3(e){if(e.shadowRoot)return;let t=e.querySelector(":scope > template[shadowrootmode='open']");if(!t)return;e.attachShadow({mode:"open"}).append(t.content.cloneNode(!0)),t.remove()}function v3(e){return e.fileDiff?{fileDiff:e.fileDiff}:{oldFile:e.oldFile,newFile:e.newFile}}var E3={split:`<svg viewBox="0 0 16 16" aria-hidden="true">
|
|
234
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Qs(e,t,n,a=!1){let i=Ik(Is(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:a});if(i==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return t.lang!=null&&(i.lang=t.lang),i}var jk=class{constructor(){f(this,"isDeletionsScrolling",!1);f(this,"isAdditionsScrolling",!1);f(this,"timeoutId",-1);f(this,"codeDeletions");f(this,"codeAdditions");f(this,"enabled",!1);f(this,"handleDeletionsScroll",()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))});f(this,"handleAdditionsScroll",()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))})}cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){if(t==null||n==null)for(let a of e.children??[])a instanceof HTMLElement&&("deletions"in a.dataset?t=a:"additions"in a.dataset&&(n=a));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}};function hn(e,t){return Qa(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function fa(e){return $({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ha(e){return $({tagName:"div",children:[$({tagName:"span",children:[he("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function Ds(e){return $({tagName:"div",children:[Dt({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 Yt({type:e,content:t,expandIndex:n,chunked:a=!1,slotName:i,isFirstHunk:r,isLastHunk:o}){let c=0,s=[];if(e==="metadata"&&t!=null&&s.push($({tagName:"div",children:[he(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){let l=[];n!=null&&(a?(r||(l.push(Ds("up")),c++),o||(l.push(Ds("down")),c++)):(l.push(Ds(!r&&!o?"both":r?"down":"up")),c++)),l.push($({tagName:"div",children:[$({tagName:"span",children:[he(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),a&&n!=null&&l.push($({tagName:"div",children:[he("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),s.push($({tagName:"div",children:l,properties:{"data-separator-wrapper":"","data-separator-multi-button":c>1?"":void 0}}))}return e==="custom"&&i!=null&&s.push($({tagName:"slot",properties:{name:i}})),$({tagName:"div",children:s,properties:{"data-separator":s.length===0?"simple":e,"data-expand-index":n,"data-separator-first":r?"":void 0,"data-separator-last":o?"":void 0}})}function Lk(e,t){return`hunk-separator-${e}-${t}`}function Nk(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Rk(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function Fs({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 ya({item:e,arr:t,enableJoin:n,isNeutral:a=!1,isLastItem:i=!1}){let r=t[t.length-1];if(r==null||i||!n){t.push([a?0:1,e.value]);return}let o=r[0]===0;if(a===o||a&&e.value.length===1&&!o){r[1]+=e.value;return}t.push([a?0:1,e.value])}function wa({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:a,collapsedContextThreshold:i}){let r=Math.max(t,0);if(r===0||e)return{fromStart:0,fromEnd:0,rangeSize:r,collapsedLines:r,renderAll:!1};if(n===!0||r<=i)return{fromStart:r,fromEnd:0,rangeSize:r,collapsedLines:0,renderAll:!0};let o=n?.get(a),c=Math.min(Math.max(o?.fromStart??0,0),r),s=Math.min(Math.max(o?.fromEnd??0,0),r),l=c+s,p=l>=r;return{fromStart:p?r:c,fromEnd:p?0:s,rangeSize:r,collapsedLines:Math.max(r-l,0),renderAll:p}}function Ui({diff:e,diffStyle:t,startingLine:n=0,totalLines:a=1/0,expandedHunks:i,collapsedContextThreshold:r=Xt,callback:o}){let c=I9({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:r}),s={finalHunk:e.hunks.at(-1),viewportStart:n,viewportEnd:n+a,isWindowedHighlight:n>0||a<1/0,splitCount:c.splitCount,unifiedCount:c.unifiedCount,shouldBreak(){if(!s.isWindowedHighlight)return!1;let l=s.unifiedCount>=n+a,p=s.splitCount>=n+a;return t==="unified"?l:(t==="split"||l)&&p},shouldSkip(l,p){if(!s.isWindowedHighlight)return!1;let d=s.unifiedCount+l<n,m=s.splitCount+p<n;return t==="unified"?d:(t==="split"||d)&&m},incrementCounts(l,p){(t==="unified"||t==="both")&&(s.unifiedCount+=l),(t==="split"||t==="both")&&(s.splitCount+=p)},isInWindow(l,p){if(!s.isWindowedHighlight)return!0;let d=s.isInUnifiedWindow(l),m=s.isInSplitWindow(p);return t==="unified"?d:t==="split"?m:d||m},isInUnifiedWindow(l){return!s.isWindowedHighlight||s.unifiedCount>=n-l&&s.unifiedCount<n+a},isInSplitWindow(l){return!s.isWindowedHighlight||s.splitCount>=n-l&&s.splitCount<n+a},emit(l,p=!1){return p||(t==="unified"?s.incrementCounts(1,0):t==="split"?s.incrementCounts(0,1):s.incrementCounts(1,1)),o(l)??!1}};e:for(let l=c.hunkIndex;l<e.hunks.length;l++){let b=function(x,j){return m==null||m.collapsedLines<=0||m.fromStart+m.fromEnd>0?0:t==="unified"?x===p.unifiedLineStart+p.unifiedLineCount-1?m.collapsedLines:0:j===p.splitLineStart+p.splitLineCount-1?m.collapsedLines:0},w=function(){if(d.collapsedLines===0)return 0;let x=d.collapsedLines;return d.collapsedLines=0,x},p=e.hunks[l];if(p==null)throw new Error("iterateOverDiff: invalid hunk index");if(s.shouldBreak())break;let d=wa({isPartial:e.isPartial,rangeSize:p.collapsedBefore,expandedHunks:i,hunkIndex:l,collapsedContextThreshold:r}),m=(()=>{if(p!==s.finalHunk||!qk(e))return;let x=e.additionLines.length-(p.additionLineIndex+p.additionCount),j=e.deletionLines.length-(p.deletionLineIndex+p.deletionCount);if(x!==j)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${x}, deletions=${j}) for ${e.name}`);let I=Math.min(x,j);return wa({isPartial:e.isPartial,rangeSize:I,expandedHunks:i,hunkIndex:e.hunks.length,collapsedContextThreshold:r})})(),g=d.fromStart+d.fromEnd;if(s.shouldSkip(g,g))s.incrementCounts(g,g),w();else{let x=p.unifiedLineStart-d.rangeSize,j=p.splitLineStart-d.rangeSize,I=p.deletionLineIndex-d.rangeSize,M=p.additionLineIndex-d.rangeSize,F=p.deletionStart-d.rangeSize,T=p.additionStart-d.rangeSize,[Q,G]=zi(s,d.fromStart,t);Q>0&&s.incrementCounts(Q,Q);let q=Q;for(;q<d.fromStart;){if(q>=G){s.incrementCounts(d.fromStart-q,d.fromStart-q);break}if(s.isInWindow(0,0)){if(s.emit({hunkIndex:l,hunk:p,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:F+q,lineIndex:I+q,noEOFCR:!1,unifiedLineIndex:x+q,splitLineIndex:j+q},additionLine:{unifiedLineIndex:x+q,splitLineIndex:j+q,lineIndex:M+q,lineNumber:T+q,noEOFCR:!1}}))break e}else s.incrementCounts(1,1);q++}x=p.unifiedLineStart-d.fromEnd,j=p.splitLineStart-d.fromEnd,I=p.deletionLineIndex-d.fromEnd,M=p.additionLineIndex-d.fromEnd,F=p.deletionStart-d.fromEnd,T=p.additionStart-d.fromEnd;let[ke,Y]=zi(s,d.fromEnd,t);for(ke>0&&s.incrementCounts(ke,ke),q=ke;q<d.fromEnd;){if(q>=Y){s.incrementCounts(d.fromEnd-q,d.fromEnd-q);break}if(s.isInWindow(0,0)){if(s.emit({hunkIndex:l,hunk:p,collapsedBefore:w(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:F+q,lineIndex:I+q,noEOFCR:!1,unifiedLineIndex:x+q,splitLineIndex:j+q},additionLine:{unifiedLineIndex:x+q,splitLineIndex:j+q,lineIndex:M+q,lineNumber:T+q,noEOFCR:!1}}))break e}else s.incrementCounts(1,1);q++}}let C=p.unifiedLineStart,_=p.splitLineStart,h=p.deletionLineIndex,y=p.additionLineIndex,k=p.deletionStart,B=p.additionStart,E=p.hunkContent.at(-1);for(let x of p.hunkContent){if(s.shouldBreak())break e;let j=x===E;if(x.type==="context"){if(s.shouldSkip(x.lines,x.lines))s.incrementCounts(x.lines,x.lines),w();else{let[I,M]=zi(s,x.lines,t);I>0&&s.incrementCounts(I,I);let F=I;for(;F<x.lines;){if(F>=M){s.incrementCounts(x.lines-F,x.lines-F);break}if(s.isInWindow(0,0)){let T=j&&F===x.lines-1,Q=C+F,G=_+F;if(s.emit({hunkIndex:l,hunk:p,collapsedBefore:w(),collapsedAfter:b(Q,G),type:"context",deletionLine:{lineNumber:k+F,lineIndex:h+F,noEOFCR:T&&p.noEOFCRDeletions,unifiedLineIndex:Q,splitLineIndex:G},additionLine:{unifiedLineIndex:Q,splitLineIndex:G,lineIndex:y+F,lineNumber:B+F,noEOFCR:T&&p.noEOFCRAdditions}}))break e}else s.incrementCounts(1,1);F++}}C+=x.lines,_+=x.lines,h+=x.lines,y+=x.lines,k+=x.lines,B+=x.lines}else{let I=Math.max(x.deletions,x.additions),M=x.deletions+x.additions;if(!s.shouldSkip(M,I)){let F=F9(s,x,t);for(let[T,Q]of F)for(let G=T;G<Q;G++){let q=b(C+G,t==="unified"?_+(G<x.deletions?G:G-x.deletions):_+G);if(s.emit($9({hunkIndex:l,hunk:p,collapsedBefore:w(),collapsedAfter:q,diffStyle:t,index:G,unifiedLineIndex:C,splitLineIndex:_,additionLineIndex:y,deletionLineIndex:h,additionLineNumber:B,deletionLineNumber:k,content:x,isLastContent:j,unifiedCount:M,splitCount:I}),!0))break e}}w(),s.incrementCounts(M,I),C+=M,_+=I,h+=x.deletions,y+=x.additions,k+=x.deletions,B+=x.additions}}if(m!=null){let{collapsedLines:x,fromStart:j,fromEnd:I}=m,M=j+I,[F,T]=zi(s,M,t);F>0&&s.incrementCounts(F,F);let Q=F;for(;Q<M;){if(s.shouldBreak())break e;if(Q>=T){s.incrementCounts(M-Q,M-Q);break}if(s.isInWindow(0,0)){let G=Q===M-1;if(s.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:G?x:0,type:"context-expanded",deletionLine:{lineNumber:k+Q,lineIndex:h+Q,noEOFCR:!1,unifiedLineIndex:C+Q,splitLineIndex:_+Q},additionLine:{unifiedLineIndex:C+Q,splitLineIndex:_+Q,lineIndex:y+Q,lineNumber:B+Q,noEOFCR:!1}}))break e}else s.incrementCounts(1,1);Q++}}}}function I9({diff:e,diffStyle:t,startingLine:n,expandedHunks:a,collapsedContextThreshold:i}){if(n<=0||t==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};let r=Q9({diff:e,expandedHunks:a,collapsedContextThreshold:i}),o=0,c=e.hunks.length-1,s=e.hunks.length;for(;o<=c;){let p=o+c>>1,d=r[p+1];if(d==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(t==="unified"?d.unifiedCount:d.splitCount)>n?(s=p,c=p-1):o=p+1}if(s>=e.hunks.length){let p=r[e.hunks.length];if(p==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:p.splitCount,unifiedCount:p.unifiedCount}}let l=r[s];if(l==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:s,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Q9({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let a=0,i=0,r=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let c=0;c<e.hunks.length;c++){let s=e.hunks[c];if(s==null)throw new Error("iterateOverDiff: invalid hunk summary index");let l=wa({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:c,collapsedContextThreshold:n}),p=l.fromStart+l.fromEnd;if(a+=p+s.splitLineCount,i+=p+s.unifiedLineCount,c===r&&qk(e)){let d=D9(e,s),m=wa({isPartial:e.isPartial,rangeSize:d,expandedHunks:t,hunkIndex:e.hunks.length,collapsedContextThreshold:n}),g=m.fromStart+m.fromEnd;a+=g,i+=g}o.push({splitCount:a,unifiedCount:i})}return o}function zi(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let a=[];function i(c){let s=Math.max(0,e.viewportStart-c),l=Math.min(t,e.viewportEnd-c);l>s&&a.push([s,l])}if(n!=="split"&&i(e.unifiedCount),n!=="unified"&&i(e.splitCount),a.length===0)return[0,0];let r=a[0][0],o=a[0][1];for(let c=1;c<a.length;c++){let s=a[c];r=Math.min(r,s[0]),o=Math.max(o,s[1])}return[r,o]}function D9(e,t){let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),a=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==a)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${n}, deletions=${a}) for ${e.name}`);return Math.min(n,a)}function qk(e){let t=e.hunks.at(-1);return t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0?!1:t.additionLineIndex+t.additionCount<e.additionLines.length||t.deletionLineIndex+t.deletionCount<e.deletionLines.length}function F9(e,t,n){if(!e.isWindowedHighlight)return[[0,n==="unified"?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let a=n!=="split",i=n!=="unified",r=n==="unified"?"unified":"split",o=[];function c(d,m){if(d+m<=e.viewportStart||d>=e.viewportEnd)return;let g=Math.max(0,e.viewportStart-d),b=Math.min(m,e.viewportEnd-d);return b>g?[g,b]:void 0}function s(d,m){return r==="split"?d:m==="additions"?[d[0]+t.deletions,d[1]+t.deletions]:d}function l(d,m){if(d==null)return;let[g,b]=s(d,m);b>g&&o.push([g,b])}if(a&&(l(c(e.unifiedCount,t.deletions),"deletions"),l(c(e.unifiedCount+t.deletions,t.additions),"additions")),i&&(l(c(e.splitCount,t.deletions),"deletions"),l(c(e.splitCount,t.additions),"additions")),o.length===0)return o;o.sort((d,m)=>d[0]-m[0]);let p=[o[0]];for(let[d,m]of o.slice(1)){let g=p[p.length-1];d<=g[1]?g[1]=Math.max(g[1],m):p.push([d,m])}return p}function $9({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,diffStyle:i,index:r,unifiedLineIndex:o,splitLineIndex:c,additionLineIndex:s,deletionLineIndex:l,additionLineNumber:p,deletionLineNumber:d,content:m,isLastContent:g,unifiedCount:b,splitCount:w}){let C=r<m.deletions?o+r:void 0,_=i==="unified"?r>=m.deletions?o+r:void 0:r<m.additions?o+m.deletions+r:void 0,h=i==="unified"?c+(r<m.deletions?r:r-m.deletions):c+r,y=r<m.deletions?l+r:void 0,k=r<m.deletions?d+r:void 0,B=i==="unified"?r>=m.deletions?s+(r-m.deletions):void 0:r<m.additions?s+r:void 0,E=i==="unified"?r>=m.deletions?p+(r-m.deletions):void 0:r<m.additions?p+r:void 0,x=i==="unified"?g&&r===m.deletions-1&&t.noEOFCRDeletions:g&&r===w-1&&t.noEOFCRDeletions,j=i==="unified"?g&&r===b-1&&t.noEOFCRAdditions:g&&r===w-1&&t.noEOFCRAdditions,I=y!=null&&k!=null&&C!=null?{lineNumber:k,lineIndex:y,noEOFCR:x,unifiedLineIndex:C,splitLineIndex:h}:void 0,M=B!=null&&E!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:h,lineIndex:B,lineNumber:E,noEOFCR:j}:void 0;if(I==null&&M!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,deletionLine:void 0,additionLine:M};if(I!=null&&M==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,deletionLine:I,additionLine:void 0};if(I==null||M==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:a,deletionLine:I,additionLine:M}}var S9={forcePlainText:!1};function Mk(e,t,n,{forcePlainText:a,startingLine:i,totalLines:r,expandedHunks:o,collapsedContextThreshold:c=Xt}=S9){a?(i??(i=0),r??(r=1/0)):(i=0,r=1/0);let s=i>0||r<1/0,l=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,p=ok({theme:n.theme,highlighter:t}),d=a&&!s&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,m={deletionLines:[],additionLines:[]},{maxLineDiffLength:g}=n,b=!a&&!e.isPartial,w=a?o:void 0,C=new Map;function _(y){let k=b?0:y,B=C.get(k)??L9();return C.set(k,B),B}function h(y,k,B,E){if(s){let x=B.at(-1);(x==null||x.targetIndex+x.count!==k)&&(x={targetIndex:k,originalOffset:E.length,count:0},B.push(x)),x.count++}E.push(y)}Ui({diff:e,diffStyle:"both",startingLine:i,totalLines:r,expandedHunks:s?w:!0,collapsedContextThreshold:c,callback:({hunkIndex:y,additionLine:k,deletionLine:B,type:E})=>{let x=_(y),j=k!=null?k.splitLineIndex:B.splitLineIndex;E==="change"&&k!=null&&B!=null&&j9({additionLine:e.additionLines[k.lineIndex],deletionLine:e.deletionLines[B.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:d,maxLineDiffLength:g}),B!=null&&(h(e.deletionLines[B.lineIndex],B.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:E==="change"?"change-deletion":E,lineNumber:B.lineNumber,altLineNumber:E==="change"?void 0:k.lineNumber??void 0,lineIndex:`${B.unifiedLineIndex},${j}`})),k!=null&&(h(e.additionLines[k.lineIndex],k.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:E==="change"?"change-addition":E,lineNumber:k.lineNumber,altLineNumber:E==="change"?void 0:B.lineNumber??void 0,lineIndex:`${k.unifiedLineIndex},${j}`}))}});for(let y of C.values()){if(y.deletionContent.length===0&&y.additionContent.length===0)continue;let k={name:e.prevName??e.name,contents:y.deletionContent.value},B={name:e.name,contents:y.additionContent.value},{deletionLines:E,additionLines:x}=N9({deletionFile:k,deletionInfo:y.deletionInfo,deletionDecorations:y.deletionDecorations,additionFile:B,additionInfo:y.additionInfo,additionDecorations:y.additionDecorations,highlighter:t,options:n,languageOverride:a?"text":e.lang});if(b){m.deletionLines=E,m.additionLines=x;continue}if(y.deletionSegments.length>0)for(let j of y.deletionSegments)for(let I=0;I<j.count;I++)m.deletionLines[j.targetIndex+I]=E[j.originalOffset+I];else m.deletionLines.push(...E);if(y.additionSegments.length>0)for(let j of y.additionSegments)for(let I=0;I<j.count;I++)m.additionLines[j.targetIndex+I]=x[j.originalOffset+I];else m.additionLines.push(...x)}return{code:m,themeStyles:p,baseThemeType:l}}function j9({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:a,deletionDecorations:i,additionDecorations:r,lineDiffType:o,maxLineDiffLength:c}){if(e==null||t==null||o==="none"||(e=It(e),t=It(t),e.length>c||t.length>c))return;let s=o==="char"?hs(e,t):Bs(e,t),l=[],p=[],d=o==="word-alt",m=s.at(-1);for(let b of s){let w=b===m;!b.added&&!b.removed?(ya({item:b,arr:l,enableJoin:d,isNeutral:!0,isLastItem:w}),ya({item:b,arr:p,enableJoin:d,isNeutral:!0,isLastItem:w})):b.removed?ya({item:b,arr:l,enableJoin:d,isLastItem:w}):ya({item:b,arr:p,enableJoin:d,isLastItem:w})}let g=0;for(let b of l)b[0]===1&&i.push(Fs({line:n,spanStart:g,spanLength:b[1].length})),g+=b[1].length;g=0;for(let b of p)b[0]===1&&r.push(Fs({line:a,spanStart:g,spanLength:b[1].length})),g+=b[1].length}function L9(){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 N9({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:a,highlighter:i,deletionDecorations:r,additionDecorations:o,languageOverride:c,options:{theme:s=Ae,...l}}){let p=c??Ze(e.name),d=c??Ze(t.name),{state:m,transformers:g}=rk(l.useTokenTransformer),b=typeof s=="string"?{...l,lang:"text",theme:s,transformers:g,decorations:void 0,defaultColor:!1,cssVariablePrefix:Be("token")}:{...l,lang:"text",themes:s,transformers:g,decorations:void 0,defaultColor:!1,cssVariablePrefix:Be("token")};return{deletionLines:e.contents===""?[]:(b.lang=p,m.lineInfo=n,b.decorations=r,ds(i.codeToHast(It(e.contents),b))),additionLines:t.contents===""?[]:(b.lang=d,b.decorations=o,m.lineInfo=a,ds(i.codeToHast(It(t.contents),b)))}}function _a(e){let t=e.lang??Ze(e.name),n=e.lang??(e.prevName!=null?Ze(e.prevName):"text");return t==="text"&&n==="text"}var R9=-1,Uk=class{constructor(e={theme:Ae},t,n){f(this,"__id",`diff-hunks-renderer:${++R9}`);f(this,"highlighter");f(this,"diff");f(this,"expandedHunks",new Map);f(this,"deletionAnnotations",{});f(this,"additionAnnotations",{});f(this,"computedLang","text");f(this,"renderCache");this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=$i(e.theme??Ae)?rs():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let a={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(a.fromStart+=n),(t==="down"||t==="both")&&(a.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,a)}getExpandedHunk(e){return this.expandedHunks.get(e)??bc}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let n=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),a=n[t.lineNumber]??[];n[t.lineNumber]=a,a.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t!=="change"?{gutterLineType:t}:{gutterLineType:e==="deletions"?"change-deletion":"change-addition"}}createAnnotationElement(e){return J_(e)}getOptionsWithDefaults(){let{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:a=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:r=!1,collapsed:o=!1,expandUnchanged:c=!1,collapsedContextThreshold:s=Xt,expansionLineCount:l=100,hunkSeparators:p="line-info",lineDiffType:d="word-alt",maxLineDiffLength:m=1e3,overflow:g="scroll",stickyHeader:b=!1,theme:w=Ae,headerRenderMode:C="default",tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:h=vn,useTokenTransformer:y=!1,useCSSClasses:k=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:a,disableLineNumbers:i,disableVirtualizationBuffers:r,collapsed:o,expandUnchanged:c,collapsedContextThreshold:s,expansionLineCount:l,hunkSeparators:p,lineDiffType:d,maxLineDiffLength:m,overflow:g,stickyHeader:b,theme:this.workerManager?.getDiffRenderOptions().theme??w,headerRenderMode:C,tokenizeMaxLineLength:_,tokenizeMaxLength:h,useTokenTransformer:y,useCSSClasses:k}}async initializeHighlighter(){return this.highlighter=await Di(tk(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Ss(e,this.getTokenizeMaxLength()),a=this.workerManager?.getDiffResultCache(e);a!=null&&!hn(t,a.options)&&(a=void 0),this.renderCache??(this.renderCache={diff:e,highlighted:!n&&!_a(e),options:t,result:n?void 0:a?.result,renderRange:void 0}),this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter==null&&(this.computedLang=e.lang??Ze(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:a,tokenizeMaxLineLength:i,lineDiffType:r,maxLineDiffLength:o}=this.getOptionsWithDefaults();return{theme:a,useTokenTransformer:ck(this.options),tokenizeMaxLineLength:i,lineDiffType:r,maxLineDiffLength:o}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!ga(e,n.diff)||!hn(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=sr){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:a}=this.getOptionsWithDefaults(),{options:i,forceHighlight:r}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},r=!1),this.renderCache??(this.renderCache={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0});let c=e.additionLines.length>0||e.deletionLines.length>0,s=!c||_a(e)||Ss(e,this.getTokenizeMaxLength()),l=!ga(e,this.renderCache.diff),p=!Si(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(l||p))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||p||r)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Rk(t)||n?!0:this.expandedHunks,a)),this.renderCache.renderRange=t),!s&&c&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??Ze(e.name);let d=this.highlighter!=null&&$i(i.theme),m=this.highlighter!=null&&kr(this.computedLang),g=!s&&m;if(this.highlighter!=null&&d&&(r||s||!this.renderCache.highlighted&&g||this.renderCache.result==null)){let{result:b,options:w}=this.renderDiffWithHighlighter(e,this.highlighter,s||!m);this.renderCache={diff:e,options:w,highlighted:g,result:b,renderRange:void 0}}(!d||!s&&!m)&&this.asyncHighlight(e).then(({result:b,options:w})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,b,w,!s)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=sr){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:a,disableBackground:i,disableLineNumbers:r,overflow:o}=this.getOptionsWithDefaults();return ek({type:"diff",diffIndicators:a,disableBackground:i,disableLineNumbers:r,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Ss(e,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??Ze(e.name);let n=this.highlighter!=null&&$i(this.options.theme??Ae),a=t||this.highlighter!=null&&kr(this.computedLang);return(this.highlighter==null||!n||!a)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:a}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:Mk(e,t,a,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:a}}onHighlightSuccess(e,t,n,a=!0){if(this.renderCache==null)return;let i=!this.renderCache.highlighted||!hn(this.renderCache.options,n)||!ga(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:a,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!hn(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&ga(e,n.diff)&&hn(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??vn}processDiffResult(e,t,{code:n,themeStyles:a,baseThemeType:i}){let{diffStyle:r,disableFileHeader:o,expandUnchanged:c,expansionLineCount:s,collapsedContextThreshold:l,hunkSeparators:p}=this.getOptionsWithDefaults();this.diff=e;let d=r==="unified",m=[],g=[],b=[],w=[],{additionLines:C,deletionLines:_}=n,h={rowCount:0,hunkSeparators:p,additionsContentAST:m,deletionsContentAST:g,unifiedContentAST:b,unifiedGutterAST:En(),deletionsGutterAST:En(),additionsGutterAST:En(),expansionLineCount:s,hunkData:w,incrementRowCount(Q=1){h.rowCount+=Q},pushToGutter(Q,G){switch(Q){case"unified":h.unifiedGutterAST.children.push(G);break;case"deletions":h.deletionsGutterAST.children.push(G);break;case"additions":h.additionsGutterAST.children.push(G);break}}},y=q9(e),k={size:0,side:void 0,increment(){this.size+=1},flush(){if(r!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(h.pushToGutter("additions",xe(void 0,"buffer",this.size)),m?.push(fa(this.size))):(h.pushToGutter("deletions",xe(void 0,"buffer",this.size)),g?.push(fa(this.size))),this.size=0,this.side=void 0}}},B=(Q,G,q,ke,Y)=>{h.pushToGutter(Q,yc(G,q,ke,Y))};function E(Q){k.flush(),r==="unified"?$s("unified",Q,h):($s("deletions",Q,h),$s("additions",Q,h))}Ui({diff:e,diffStyle:r,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:c?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:Q,hunk:G,collapsedBefore:q,collapsedAfter:ke,additionLine:Y,deletionLine:ce,type:le})=>{let Vt=ce!=null?ce.splitLineIndex:Y.splitLineIndex,tr=Y!=null?Y.unifiedLineIndex:ce.unifiedLineIndex;r==="split"&&le!=="change"&&k.flush(),q>0&&E({hunkIndex:Q,collapsedLines:q,rangeSize:Math.max(G?.collapsedBefore??0,0),hunkSpecs:G?.hunkSpecs,isFirstHunk:Q===0,isLastHunk:!1,isExpandable:!e.isPartial});let nr=r==="unified"?tr:Vt,ic={type:le,hunkIndex:Q,lineIndex:nr,unifiedLineIndex:tr,splitLineIndex:Vt,deletionLine:ce,additionLine:Y};if(r==="unified"){let ne=this.getUnifiedInjectedRowsForLine?.(ic);ne?.before!=null&&Tk(ne.before,h);let Fe=ce!=null?_[ce.lineIndex]:void 0,$e=Y!=null?C[Y.lineIndex]:void 0;if(Fe==null&&$e==null){let gt="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(gt,{file:e.name}),new Error(gt)}let kn=le==="change"?Y!=null?"change-addition":"change-deletion":le,At=this.getUnifiedLineDecoration({type:le,lineType:kn,additionLineIndex:Y?.lineIndex,deletionLineIndex:ce?.lineIndex});B("unified",At.gutterLineType,Y!=null?Y.lineNumber:ce.lineNumber,`${tr},${Vt}`,At.gutterProperties),$e!=null?$e=Oi($e,At.contentProperties):Fe!=null&&(Fe=Oi(Fe,At.contentProperties)),zk({diffStyle:"unified",type:le,deletionLine:Fe,additionLine:$e,unifiedSpan:this.getAnnotations("unified",ce?.lineNumber,Y?.lineNumber,Q,nr),createAnnotationElement:gt=>this.createAnnotationElement(gt),context:h}),ne?.after!=null&&Tk(ne.after,h)}else{let ne=this.getSplitInjectedRowsForLine?.(ic);ne?.before!=null&&Pk(ne.before,h,k);let Fe=ce!=null?_[ce.lineIndex]:void 0,$e=Y!=null?C[Y.lineIndex]:void 0,kn=this.getSplitLineDecoration({side:"deletions",type:le,lineIndex:ce?.lineIndex}),At=this.getSplitLineDecoration({side:"additions",type:le,lineIndex:Y?.lineIndex});if(Fe==null&&$e==null){let Te="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(Te,{file:e.name}),new Error(Te)}let gt=(()=>{if(le==="change"){if($e==null)return"additions";if(Fe==null)return"deletions"}})();if(gt!=null){if(k.side!=null&&k.side!==gt)throw new Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");k.side=gt,k.increment()}let oc=this.getAnnotations("split",ce?.lineNumber,Y?.lineNumber,Q,nr);if(oc!=null&&k.size>0&&k.flush(),ce!=null){let Te=Oi(Fe,kn.contentProperties);B("deletions",kn.gutterLineType,ce.lineNumber,`${ce.unifiedLineIndex},${Vt}`,kn.gutterProperties),Te!=null&&(Fe=Te)}if(Y!=null){let Te=Oi($e,At.contentProperties);B("additions",At.gutterLineType,Y.lineNumber,`${Y.unifiedLineIndex},${Vt}`,At.gutterProperties),Te!=null&&($e=Te)}zk({diffStyle:"split",type:le,additionLine:$e,deletionLine:Fe,...oc,createAnnotationElement:Te=>this.createAnnotationElement(Te),context:h}),ne?.after!=null&&Pk(ne.after,h,k)}let rc=r==="split"&&G!=null&&Vt===G.splitLineStart+G.splitLineCount-1,nB=rc?G.noEOFCRDeletions:!1,aB=rc?G.noEOFCRAdditions:!1,ar=(ce?.noEOFCR??!1)||nB,ir=(Y?.noEOFCR??!1)||aB;if(ir||ar){if(r==="split"&&k.flush(),ar){let ne=le==="context"||le==="context-expanded"?le:"change-deletion";r==="unified"?(h.unifiedContentAST.push(ha(ne)),h.pushToGutter("unified",xe(ne,"metadata",1))):(h.deletionsContentAST.push(ha(ne)),h.pushToGutter("deletions",xe(ne,"metadata",1)),ir||(h.pushToGutter("additions",xe(void 0,"buffer",1)),h.additionsContentAST.push(fa(1))))}if(ir){let ne=le==="context"||le==="context-expanded"?le:"change-addition";r==="unified"?(h.unifiedContentAST.push(ha(ne)),h.pushToGutter("unified",xe(ne,"metadata",1))):(h.additionsContentAST.push(ha(ne)),h.pushToGutter("additions",xe(ne,"metadata",1)),ar||(h.pushToGutter("deletions",xe(void 0,"buffer",1)),h.deletionsContentAST.push(fa(1))))}h.incrementRowCount(1)}ke>0&&p!=="simple"&&E({hunkIndex:le==="context-expanded"?Q:Q+1,collapsedLines:ke,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),h.incrementRowCount(1)}}),r==="split"&&k.flush();let x=Math.max(Nk(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),j=t.bufferBefore>0||t.bufferAfter>0,I=!d&&e.type!=="deleted",M=!d&&e.type!=="new",F=h.rowCount>0||j;m=I&&F?m:void 0,g=M&&F?g:void 0,b=d&&F?b:void 0;let T=this.createPreElement(g!=null&&m!=null,x);return{unifiedGutterAST:d&&F?h.unifiedGutterAST.children:void 0,unifiedContentAST:b,deletionsGutterAST:M&&F?h.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:I&&F?h.additionsGutterAST.children:void 0,additionsContentAST:m,hunkData:w,preNode:T,themeStyles:a,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:x,rowCount:h.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){let n=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,a=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(n==null||a==null)return;let i=En(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,sk(a,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators==="line-info",a=this.renderCodeAST("unified",e);if(a!=null)return t.push($({tagName:"code",children:a,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($({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));let r=this.renderCodeAST("additions",e);return r!=null&&t.push($({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return je(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?je(e):je($({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}getAnnotations(e,t,n,a,i){let r={type:"annotation",hunkIndex:a,lineIndex:i,annotations:[]};if(t!=null)for(let c of this.deletionAnnotations[t]??[])r.annotations.push(An(c));let o={type:"annotation",hunkIndex:a,lineIndex:i,annotations:[]};if(n!=null)for(let c of this.additionAnnotations[n]??[])(e==="unified"?r:o).annotations.push(An(c));if(e==="unified")return r.annotations.length>0?r:void 0;if(!(o.annotations.length===0&&r.annotations.length===0))return{deletionSpan:r,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return X_({fileOrDiff:e,mode:t,stickyHeader:n})}};function Gk(e){return`${e} unmodified line${e>1?"s":""}`}function Tk(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function Pk(e,t,n){for(let{deletion:a,addition:i}of e){if(a==null&&i==null)continue;let r=a!=null&&i!=null?void 0:a==null?"deletions":"additions";(r==null||n.side!==r)&&n.flush(),a!=null&&(t.deletionsContentAST.push(a.content),t.pushToGutter("deletions",a.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter("additions",i.gutter)),r!=null&&(n.side=r,n.increment()),t.incrementRowCount(1)}}function zk({diffStyle:e,type:t,deletionLine:n,additionLine:a,unifiedSpan:i,deletionSpan:r,additionSpan:o,createAnnotationElement:c,context:s}){let l=!1;if(e==="unified"){if(a!=null?s.unifiedContentAST.push(a):n!=null&&s.unifiedContentAST.push(n),i!=null){let p=t==="change"?n!=null?"change-deletion":"change-addition":t;s.unifiedContentAST.push(c(i)),s.pushToGutter("unified",xe(p,"annotation",1)),l=!0}}else if(e==="split"){if(n!=null&&s.deletionsContentAST.push(n),a!=null&&s.additionsContentAST.push(a),r!=null){let p=t==="change"?n!=null?"change-deletion":"context":t;s.deletionsContentAST.push(c(r)),s.pushToGutter("deletions",xe(p,"annotation",1)),l=!0}if(o!=null){let p=t==="change"?a!=null?"change-addition":"context":t;s.additionsContentAST.push(c(o)),s.pushToGutter("additions",xe(p,"annotation",1)),l=!0}}l&&s.incrementRowCount(1)}function $s(e,{hunkIndex:t,collapsedLines:n,rangeSize:a,hunkSpecs:i,isFirstHunk:r,isLastHunk:o,isExpandable:c},s){if(n<=0)return;let l=e==="unified"?s.unifiedContentAST:e==="deletions"?s.deletionsContentAST:s.additionsContentAST;if(s.hunkSeparators==="metadata"){i!=null&&(s.pushToGutter(e,Yt({type:"metadata",content:i,isFirstHunk:r,isLastHunk:o})),l.push(Yt({type:"metadata",content:i,isFirstHunk:r,isLastHunk:o})),e!=="additions"&&s.incrementRowCount(1));return}if(s.hunkSeparators==="simple"){t>0&&(s.pushToGutter(e,Yt({type:"simple",isFirstHunk:r,isLastHunk:!1})),l.push(Yt({type:"simple",isFirstHunk:r,isLastHunk:!1})),e!=="additions"&&s.incrementRowCount(1));return}let p=Lk(e,t),d=a>s.expansionLineCount,m=c?t:void 0;s.pushToGutter(e,Yt({type:s.hunkSeparators,content:Gk(n),expandIndex:m,chunked:d,slotName:p,isFirstHunk:r,isLastHunk:o})),l.push(Yt({type:s.hunkSeparators,content:Gk(n),expandIndex:m,chunked:d,slotName:p,isFirstHunk:r,isLastHunk:o})),e!=="additions"&&s.incrementRowCount(1),s.hunkData.push({slotName:p,hunkIndex:t,lines:n,type:e,expandable:c?{up:!r,down:!o,chunked:d}:void 0})}function Oi(e,t){return e==null||e.type!=="element"||t==null?e:{...e,properties:{...e.properties,...t}}}function Ss(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function q9(e){let t=e.hunks.at(-1);if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),a=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==a)throw new Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${a}) for ${e.name}`);return Math.min(n,a)}function Ok(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Hk(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Zk(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}var M9=-1,js,Ls=(js=class{constructor(e={theme:Ae},t,n=!1){f(this,"__id",`file-diff:${++M9}`);f(this,"type","file-diff");f(this,"fileContainer");f(this,"spriteSVG");f(this,"pre");f(this,"codeUnified");f(this,"codeDeletions");f(this,"codeAdditions");f(this,"bufferBefore");f(this,"bufferAfter");f(this,"themeCSSStyle");f(this,"appliedThemeCSS");f(this,"hasAdoptedThemeCSS",!1);f(this,"unsafeCSSStyle");f(this,"appliedUnsafeCSS");f(this,"gutterUtilityContent");f(this,"headerElement");f(this,"headerPrefix");f(this,"headerMetadata");f(this,"headerCustom");f(this,"separatorCache",new Map);f(this,"errorWrapper");f(this,"placeHolder");f(this,"hunksRenderer");f(this,"resizeManager");f(this,"scrollSyncManager");f(this,"interactionManager");f(this,"annotationCache",new Map);f(this,"lineAnnotations",[]);f(this,"managersDirty",!1);f(this,"deletionFile");f(this,"additionFile");f(this,"fileDiff");f(this,"renderRange");f(this,"appliedPreAttributes");f(this,"lastRenderedHeaderHTML");f(this,"cachedHeaderHTML");f(this,"lastRowCount");f(this,"mounted",!1);f(this,"enabled",!0);f(this,"handleHighlightRender",()=>{this.rerender()});f(this,"getLineIndex",(e,t="additions")=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),a,i;e:for(let r of this.fileDiff.hunks){let o=t==="deletions"?r.deletionStart:r.additionStart,c=t==="deletions"?r.deletionCount:r.additionCount,s=r.splitLineStart,l=r.unifiedLineStart;if(e<o){let p=o-e;a=Math.max(l-p,0),i=Math.max(s-p,0);break e}if(e>=o+c){if(r===n){let p=e-(o+c);a=l+r.unifiedLineCount+p,i=s+r.splitLineCount+p;break e}continue}for(let p of r.hunkContent)if(p.type==="context")if(e<o+p.lines){let d=e-o;i=s+d,a=l+d;break e}else o+=p.lines,s+=p.lines,l+=p.lines;else{let d=t==="deletions"?p.deletions:p.additions;if(e<o+d){let m=e-o;a=l+(t==="additions"?p.deletions:0)+m,i=s+m;break e}else o+=d,s+=Math.max(p.deletions,p.additions),l+=p.deletions+p.additions}break e}if(!(a==null||i==null))return[a,i]});f(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine());f(this,"handleExpandHunk",(e,t,n)=>{this.expandHunk(e,t,n)});f(this,"expandHunk",(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()});this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new al,this.scrollSyncManager=new jk,this.interactionManager=new nl("diff",_r(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}getHunksRendererOptions(e){return Zk(e)}createHunksRenderer(e){return new Uk(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(_r(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?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Qa(this.appliedThemeCSS.theme,this.options.theme??Ae)}setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators=="function")}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,t==="wrap"),t==="scroll"&&e==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,this.lineAnnotations=[],this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:a=!1,lineAnnotations:i,oldFile:r,newFile:o,fileDiff:c}=e;this.hydrateElements(t,n),P9(this.pre,G9({fileDiff:c,oldFile:r,newFile:o}),this.options.collapsed)||z9(this.headerElement,T9({fileDiff:c,oldFile:r,newFile:o}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:c,oldFile:r,newFile:o,lineAnnotations:i}),a||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),wk(e,t);for(let n of e.shadowRoot?.children??[]){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n;for(let a of n.children)!(a instanceof HTMLElement)||a.tagName.toLowerCase()!=="code"||("deletions"in a.dataset&&(this.codeDeletions=a),"additions"in a.dataset&&(this.codeAdditions=a),"unified"in a.dataset&&(this.codeUnified=a));continue}if("diffsHeader"in n.dataset){this.headerElement=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(Bn)){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(xn)){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:a}){this.lineAnnotations=a??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?Qs(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}render({oldFile:e,newFile:t,fileDiff:n,deferManagers:a=!1,forceRender:i=!1,preventEmit:r=!1,lineAnnotations:o,fileContainer:c,containerWrapper:s,renderRange:l}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");let{collapsed:p=!1,themeType:d="system"}=this.options,m=p?void 0:l,g=this.hasThemeChanged(),b=e!=null&&t!=null&&(!ss(e,this.deletionFile)||!ss(t,this.additionFile)),w=n!=null&&n!==this.fileDiff,C=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1;if(!p&&Si(m,this.renderRange)&&!i&&!C&&!g&&(n!=null&&n===this.fileDiff||n==null&&!b))return this.applyCachedThemeState(d);let{renderRange:_}=this;if(this.renderRange=m,this.deletionFile=e,this.additionFile=t,n!=null?this.fileDiff=n:e!=null&&t!=null&&b&&(w=!0,this.fileDiff=Qs(e,t,this.options.parseDiffOptions)),w&&(this.cachedHeaderHTML=void 0),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),c=this.getOrCreateFileContainer(c,s),this.applyCachedThemeState(d),p){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let k=this.hunksRenderer.renderDiff(this.fileDiff,fc);k!=null&&this.applyThemeState(c,k.themeStyles,d,k.baseThemeType),k?.headerElement!=null&&this.applyHeaderToDOM(k.headerElement,c),this.renderSeparators([]),this.injectUnsafeCSS()}catch(k){if(h)throw k;console.error(k),k instanceof Error&&this.applyErrorToDOM(k,c)}return r||this.emitPostRender(),!0}try{let k=this.getOrCreatePreNode(c);if(!(this.canPartiallyRender(i,C,b||w||g)&&this.applyPartialRender({previousRenderRange:_,renderRange:m}))){let B=this.hunksRenderer.renderDiff(this.fileDiff,m);if(B==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(c,B.themeStyles,d,B.baseThemeType),B.headerElement!=null&&this.applyHeaderToDOM(B.headerElement,c),B.additionsContentAST!=null||B.deletionsContentAST!=null||B.unifiedContentAST!=null?this.applyHunksToDOM(k,B):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(B.hunkData)}this.applyBuffers(k,m),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers()}catch(k){if(h)throw k;console.error(k),k instanceof Error&&this.applyErrorToDOM(k,c)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,"unmount");return}if(t==null)return;let a=this.mounted?"update":"mount";this.mounted=!0,n?.(t,this,a)}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 t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){let{fileDiff:e,workerManager:t}=this;if(e==null||t==null||_a(e))return;let n=this.options.tokenizeMaxLength??vn;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!="function"){for(let{element:a}of this.separatorCache.values())a.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let a of e){let i=a.slotName,r=this.separatorCache.get(i);if(r==null||!Hk(a,r.hunkData)){r?.element.remove();let o=document.createElement("div");o.style.display="contents",o.slot=a.slotName;let c=t(a,this);c!=null&&o.appendChild(c),this.fileContainer.appendChild(o),r={element:o,hunkData:a},this.separatorCache.set(i,r)}n.delete(i)}for(let[a,{element:i}]of n.entries())this.separatorCache.delete(a),i.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,a]of this.lineAnnotations.entries()){let i=`${n}-${An(a)}`,r=this.annotationCache.get(i);if(r==null||!Ok(a,r.annotation)){r?.element.remove();let o=t(a);if(o==null)continue;r={element:uk(An(a)),annotation:a},r.element.appendChild(o),this.fileContainer.appendChild(r.element),this.annotationCache.set(i,r)}e.delete(i)}for(let[n,{element:a}]of e.entries())this.annotationCache.delete(n),a.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=mk();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,a=e??n??document.createElement(Cn),i=n!==a;return i&&this.emitPostRender(!0),this.fileContainer=a,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let n of t.children)n instanceof SVGElement?this.spriteSVG??(this.spriteSVG=n):ms(n)&&n.hasAttribute(Bn)?(this.themeCSSStyle??(this.themeCSSStyle=n),this.hasAdoptedThemeCSS=!0):ms(n)&&n.hasAttribute(xn)&&(this.unsafeCSSStyle??(this.unsafeCSSStyle=n),this.appliedUnsafeCSS??(this.appliedUnsafeCSS=this.options.unsafeCSS??void 0))}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){let n=document.createElement("div");n.innerHTML=lk;let a=n.firstChild;a instanceof SVGElement&&(this.spriteSVG=a)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,a=this.cachedHeaderHTML??je(e);if(this.cachedHeaderHTML=a,a!==this.lastRenderedHeaderHTML){let l=document.createElement("div");l.innerHTML=a;let p=l.firstElementChild;if(!(p instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(p,this.headerElement):t.shadowRoot?.prepend(p),this.headerElement=p,this.lastRenderedHeaderHTML=a}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:r,renderHeaderMetadata:o}=this.options;if(i!=null){let l=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Ea,l),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let c=r?.(n)??void 0,s=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,xa,c),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,va,s),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,a){if(a==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t==null&&e.appendChild(i),this.replaceHeaderSlotContent(i,a),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??(this.unsafeCSSStyle=Ak()),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=fk(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,a){let i=e.shadowRoot??e.attachShadow({mode:"open"}),r=a??n,o=this.options.theme??Ae,c=typeof o=="string"?o:{...o},s=Aa(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===r&&this.appliedThemeCSS.scrollbarGutter===s){this.appliedThemeCSS.theme=c;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:c,themeStyles:t,themeType:r,baseThemeType:a,scrollbarGutter:s};return}this.themeCSSStyle=kk({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:hk(t,r,s)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:c,themeStyles:t,themeType:r,baseThemeType:a,scrollbarGutter:s}:void 0}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=yk(this.themeCSSStyle.textContent??"",Aa(e)))}applyHunksToDOM(e,t){let{overflow:n="scroll"}=this.options,a=(this.options.hunkSeparators??"line-info")==="line-info",i=n==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let r=!1,o=[],c=this.hunksRenderer.renderCodeAST("unified",t),s=this.hunksRenderer.renderCodeAST("deletions",t),l=this.hunksRenderer.renderCodeAST("additions",t);c!=null?(r=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=Ri({code:this.codeUnified,columnType:"unified",rowSpan:i,containerSize:a}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(c),o.push(this.codeUnified)):s!=null||l!=null?(s!=null?(r=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ri({code:this.codeDeletions,columnType:"deletions",rowSpan:i,containerSize:a}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(s),o.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),l!=null?(r=r||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ri({code:this.codeAdditions,columnType:"additions",rowSpan:i,containerSize:a}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l),o.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),o.length===0?e.textContent="":r&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:a,codeAdditions:i,codeDeletions:r,options:{diffStyle:o="split"}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(o,a,r,i);if(c==null)return!1;let s=e.startingLine,l=t.startingLine,p=s+e.totalLines,d=l+t.totalLines,m=Math.max(s,l),g=Math.min(p,d);if(g<=m)return!1;let b=Math.max(0,m-s),w=Math.max(0,p-g),C=this.trimColumns({columns:c,trimStart:b,trimEnd:w,previousStart:s,overlapStart:m,overlapEnd:g,diffStyle:o});if(C<0)throw new Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<C)throw new Error("applyPartialRender: trimmed beyond DOM row count");let _=this.lastRowCount-C,h=(E,x)=>{if(!(x<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:E,totalLines:x,bufferBefore:0,bufferAfter:0})},y=h(l,Math.max(m-l,0));if(y==null&&l<m)return!1;let k=h(g,Math.max(d-g,0));if(k==null&&d>g)return!1;let B=(E,x)=>{if(E!=null){if(o==="unified"&&!Array.isArray(c))this.insertPartialHTML(o,c,E,x);else if(o==="split"&&Array.isArray(c))this.insertPartialHTML(o,c,E,x);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");_+=E.rowCount}};return this.cleanupErrorWrapper(),B(y,"afterbegin"),B(k,"beforeend"),this.lastRowCount!==_&&(this.applyRowSpan(o,c,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,a){if(e==="unified"&&!Array.isArray(t)){let i=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,i,a)}else if(e==="split"&&Array.isArray(t)){let i=this.hunksRenderer.renderCodeAST("deletions",n),r=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],i,a),this.renderPartialColumn(t[1],r,a)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}renderPartialColumn(e,t,n){if(e==null||t==null)return;let a=Wk(t[0]),i=Wk(t[1]);if(a==null||i==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");let r=i.at(0);n==="beforeend"&&r?.type==="element"&&typeof r.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(r.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],a,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],a,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(a)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,a,i,r){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(r?(a.shift(),i.shift()):(a.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let a=i=>{i!=null&&(i.gutter.style.setProperty("grid-row",`span ${n}`),i.content.style.setProperty("grid-row",`span ${n}`))};if(e==="unified"&&!Array.isArray(t))a(t);else if(e==="split"&&Array.isArray(t))a(t[0]),a(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,n){let a=0,i=0,r=0,o=!1,c=n>=0;if(e==null)return 0;let s=Array.from(e.content.children),l=Array.from(e.gutter.children);if(s.length!==l.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;r<s.length&&!(t<=0&&!c&&!o);){let p=l[r],d=s[r];if(r++,!(p instanceof HTMLElement)||!(d instanceof HTMLElement))throw console.error({gutterElement:p,contentElement:d}),new Error("FileDiff.trimColumnRows: invalid row elements");if(o&&(o=!1,p.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in d.dataset||p.dataset.gutterBuffer==="metadata"&&"noNewline"in d.dataset)){p.remove(),d.remove(),i++;continue}if("lineIndex"in p.dataset&&"lineIndex"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),t>0&&(t--,t===0&&(o=!0)),i++),a++;continue}if("separator"in p.dataset&&"separator"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),i++);continue}if(p.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),i++);continue}if(p.dataset.gutterBuffer==="metadata"&&"noNewline"in d.dataset){(t>0||c&&a>=n)&&(p.remove(),d.remove(),i++);continue}if(p.dataset.gutterBuffer==="buffer"&&"contentBuffer"in d.dataset){let m=this.getBufferSize(d.dataset);if(m==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){let g=Math.min(t,m),b=m-g;b>0?(this.updateBufferSize(p,b),this.updateBufferSize(d,b),i+=g):(p.remove(),d.remove(),i+=m),t-=g,t===0&&b===0&&(o=!0)}else if(c){let g=a,b=a+m-1;if(n<=g)p.remove(),d.remove(),i+=m;else if(n<=b){let w=b-n+1,C=m-w;this.updateBufferSize(p,C),this.updateBufferSize(d,C),i+=w}}a+=m;continue}throw console.error({gutterElement:p,contentElement:d}),new Error("FileDiff.trimColumnRows: unknown row elements")}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:a,previousStart:i,trimEnd:r,trimStart:o}){let c=Math.max(0,a-i),s=n-i;if(s<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");let l=o>0,p=r>0;if(!l&&!p)return 0;let d=l?c:0,m=p?s:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,d,m);if(t==="split"&&Array.isArray(e)){let g=this.trimColumnRows(e[0],d,m),b=this.trimColumnRows(e[1],d,m);if(e[0]!=null&&e[1]!=null&&g!==b)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?g:b}else throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,a){function i(r){if(r==null)return;let o=r.children[0],c=r.children[1];if(!(!(o instanceof HTMLElement)||!(c instanceof HTMLElement)||o.dataset.gutter==null||c.dataset.content==null))return{gutter:o,content:c}}if(e==="unified")return i(t);{let r=i(n),o=i(a);return r!=null||o!=null?[r,o]:void 0}}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:a},i){let{diffIndicators:r="bars",disableBackground:o=!1,disableLineNumbers:c=!1,overflow:s="scroll",diffStyle:l="split"}=this.options,p={type:"diff",diffIndicators:r,disableBackground:o,disableLineNumbers:c,overflow:s,split:l==="unified"?!1:t!=null&&n!=null,totalLines:a,customProperties:i};dk(p,this.appliedPreAttributes)||(_k(e,p),this.appliedPreAttributes=p)}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??(this.errorWrapper=document.createElement("div")),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",n.appendChild(this.errorWrapper);let a=document.createElement("div");a.dataset.errorMessage="",a.innerText=e.message,this.errorWrapper.appendChild(a);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}},f(js,"LoadedCustomComponent",Ck),js);function G9({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function T9({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function P9(e,t,n=!1){return!n&&e==null&&t}function z9(e,t,n=!1){return e==null&&t&&!n}function Wk(e){if(!(e==null||e.type!=="element"))return e.children??[]}var qj=()=>Promise.resolve().then(()=>(Kt(),Yk)),Mj=()=>Promise.resolve().then(()=>(Rs(),Kk)),Gj=()=>Promise.resolve().then(()=>(Ms(),Jk)),Tj=()=>Promise.resolve().then(()=>(Ts(),Vk)),Pj=()=>Promise.resolve().then(()=>(zs(),Xk)),zj=()=>Promise.resolve().then(()=>(tC(),eC)),Uj=()=>Promise.resolve().then(()=>(Os(),nC)),Oj=()=>Promise.resolve().then(()=>(yn(),aC)),Hj=()=>Promise.resolve().then(()=>(Hi(),iC)),Zj=()=>Promise.resolve().then(()=>(oC(),rC)),Wj=()=>Promise.resolve().then(()=>(cC(),sC)),Yj=()=>Promise.resolve().then(()=>(pC(),lC)),Kj=()=>Promise.resolve().then(()=>(uC(),dC)),Jj=()=>Promise.resolve().then(()=>(Ws(),mC)),Vj=()=>Promise.resolve().then(()=>(Ca(),AC)),Xj=()=>Promise.resolve().then(()=>(Vs(),hC)),e3=()=>Promise.resolve().then(()=>(wC(),yC)),t3=()=>Promise.resolve().then(()=>(CC(),kC)),n3=()=>Promise.resolve().then(()=>(wn(),gC)),a3=()=>Promise.resolve().then(()=>(xC(),BC)),i3=()=>Promise.resolve().then(()=>($C(),FC)),r3=()=>Promise.resolve().then(()=>(jC(),SC)),o3=()=>Promise.resolve().then(()=>(NC(),LC)),s3=()=>Promise.resolve().then(()=>(qC(),RC)),c3=()=>Promise.resolve().then(()=>(GC(),MC)),l3=()=>Promise.resolve().then(()=>(ec(),DC)),p3=()=>Promise.resolve().then(()=>(PC(),TC)),d3=()=>Promise.resolve().then(()=>(Ki(),_C)),u3=()=>Promise.resolve().then(()=>(UC(),zC)),Ji=[{id:"javascript",name:"JavaScript",aliases:["js","mjs","cjs"],import:qj},{id:"typescript",name:"TypeScript",aliases:["ts","mts","cts"],import:Mj},{id:"tsx",name:"TSX",import:Gj},{id:"jsx",name:"JSX",import:Tj},{id:"json",name:"JSON",aliases:["jsonc","json5","jsonl"],import:Pj},{id:"markdown",name:"Markdown",aliases:["md"],import:zj},{id:"yaml",name:"YAML",aliases:["yml"],import:Uj},{id:"css",name:"CSS",import:Oj},{id:"html",name:"HTML",import:Hj},{id:"sh",name:"Shell",aliases:["bash","shell","shellscript","zsh"],import:Zj},{id:"python",name:"Python",aliases:["py"],import:Wj},{id:"go",name:"Go",import:Yj},{id:"rust",name:"Rust",aliases:["rs"],import:Kj},{id:"java",name:"Java",import:Jj},{id:"c",name:"C",import:Vj},{id:"cpp",name:"C++",aliases:["c++"],import:Xj},{id:"csharp",name:"C#",aliases:["c#","cs"],import:e3},{id:"php",name:"PHP",import:t3},{id:"sql",name:"SQL",import:n3},{id:"docker",name:"Docker",aliases:["dockerfile"],import:a3},{id:"ruby",name:"Ruby",aliases:["rb"],import:i3},{id:"swift",name:"Swift",import:r3},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:o3},{id:"r",name:"R",import:s3},{id:"dart",name:"Dart",import:c3},{id:"lua",name:"Lua",import:l3},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:p3},{id:"xml",name:"XML",import:d3},{id:"toml",name:"TOML",import:u3}],tc=Object.fromEntries(Ji.map(e=>[e.id,e.import]));function nc(e){return"aliases"in e?e.aliases:[]}var m3=Object.fromEntries(Ji.flatMap(e=>nc(e).map(t=>[t,e.import]))),jU={...tc,...m3};var A3=[...Object.keys(tc),"text","ansi"],g3=new Set(A3),b3=new Map(Ji.flatMap(e=>nc(e).map(t=>[t,e.id])));function f3(e){if(typeof e!="string")return;let t=e.trim();return t||void 0}async function OC(e,t={}){let n=f3(e);if(!n)return;let a=b3.get(n);if(a)return a;if(g3.has(n))return n;if(t.languagePackAvailable)try{return await la(n),n}catch{return}}async function h3(e,t){let n=new Set;for(let a of e){let i=await OC(a,t);i&&n.add(i)}return t.fallbackToText&&n.size===0&&n.add("text"),[...n]}function y3(e){let t=new Set;return e.fileDiff?.lang&&t.add(e.fileDiff.lang),e.oldFile?.lang&&t.add(e.oldFile.lang),e.newFile?.lang&&t.add(e.newFile.lang),[...t]}async function ac(e,t){if(!e)return;if(typeof e.lang!="string")return e;let n=await OC(e.lang,t);return e.lang===n?e:n?{...e,lang:n}:{...e,lang:"text"}}async function HC(e,t={}){let[n,a,i,r]=await Promise.all([ac(e.fileDiff,t),ac(e.oldFile,t),ac(e.newFile,t),h3(e.langs,{fallbackToText:!1,...t})]),o=new Set(r);for(let c of y3({fileDiff:n,oldFile:a,newFile:i}))o.add(c);return o.size===0&&o.add("text"),{...e,fileDiff:n,oldFile:a,newFile:i,langs:[...o]}}var ZC=["unified","split"];var WC=["light","dark"],YC=["bars","classic","none"];var w3=["scroll","wrap"];function _n(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function KC(e){let t;try{t=JSON.parse(e)}catch{throw new Error("Diff payload is not valid JSON.")}if(!_3(t))throw new Error("Diff payload has invalid shape.");return t}function _3(e){if(!_n(e)||typeof e.prerenderedHTML!="string"||!Array.isArray(e.langs)||!e.langs.every(a=>typeof a=="string")||!k3(e.options))return!1;let t=_n(e.fileDiff),n=_n(e.oldFile)&&_n(e.newFile);return!(!t&&!n)}function k3(e){return!(!_n(e)||!_n(e.theme)||e.theme.light!=="pierre-light"||e.theme.dark!=="pierre-dark"||!Vi(ZC,e.diffStyle)||!Vi(YC,e.diffIndicators)||!Vi(WC,e.themeType)||!Vi(w3,e.overflow)||typeof e.disableLineNumbers!="boolean"||typeof e.expandUnchanged!="boolean"||typeof e.backgroundEnabled!="boolean"||typeof e.unsafeCSS!="string")}function Vi(e,t){return typeof t=="string"&&e.includes(t)}var VC=[],z={theme:"dark",layout:"unified",backgroundEnabled:!0,wrapEnabled:!0};function C3(e){let t=e.textContent?.trim();if(!t)throw new Error("Diff payload was empty.");return KC(t)}function B3(){let e=[];for(let t of document.querySelectorAll(".oc-diff-card")){let n=t.querySelector("[data-openclaw-diff-host]"),a=t.querySelector("[data-openclaw-diff-payload]");if(!(!n||!a))try{e.push({host:n,payload:C3(a)})}catch(i){console.warn("Skipping invalid diff payload",i)}}return e}function x3(e){if(e.shadowRoot)return;let t=e.querySelector(":scope > template[shadowrootmode='open']");if(!t)return;e.attachShadow({mode:"open"}).append(t.content.cloneNode(!0)),t.remove()}function v3(e){return e.fileDiff?{fileDiff:e.fileDiff}:{oldFile:e.oldFile,newFile:e.newFile}}var E3={split:`<svg viewBox="0 0 16 16" aria-hidden="true">
|
|
235
235
|
<path fill="currentColor" 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>
|
|
236
236
|
<path fill="currentColor" opacity="0.5" 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"></path>
|
|
237
237
|
</svg>`,unified:`<svg viewBox="0 0 16 16" aria-hidden="true">
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diffs-language-pack",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.31-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/diffs-language-pack",
|
|
9
|
-
"version": "2026.5.
|
|
9
|
+
"version": "2026.5.31-beta.1"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diffs-language-pack",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.31-beta.1",
|
|
4
4
|
"description": "OpenClaw diffs viewer syntax highlighting language pack",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"minHostVersion": ">=2026.5.27"
|
|
20
20
|
},
|
|
21
21
|
"compat": {
|
|
22
|
-
"pluginApi": ">=2026.5.
|
|
22
|
+
"pluginApi": ">=2026.5.31-beta.1"
|
|
23
23
|
},
|
|
24
24
|
"assetScripts": {
|
|
25
25
|
"build": "node ../../scripts/build-diffs-viewer-runtime.mjs full"
|
|
26
26
|
},
|
|
27
27
|
"build": {
|
|
28
|
-
"openclawVersion": "2026.5.
|
|
28
|
+
"openclawVersion": "2026.5.31-beta.1",
|
|
29
29
|
"staticAssets": [
|
|
30
30
|
{
|
|
31
31
|
"source": "./assets/viewer-runtime.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"README.md"
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"openclaw": ">=2026.5.
|
|
51
|
+
"openclaw": ">=2026.5.31-beta.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"openclaw": {
|