v-code-diff 1.5.0 → 1.5.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.
@@ -11,6 +11,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`),x=b,k=M),O===void 0&&(
11
11
  `);if(v===void 0){for(const D of m){let N=t(),I=t();const R=Z(o,D);E===S.EQUAL&&(s++,a++,N=r(S.EQUAL,s,R),I=r(S.EQUAL,a,R)),E===S.DELETE&&(s++,N=r(S.DELETE,s,R),I=t()),E===S.ADD&&(a++,N=t(),I=r(S.ADD,a,R)),c.push({left:N,right:I})}break}if(E===S.EQUAL)for(const D of m){s++,a++;const N=Z(o,D);c.push({left:r(S.EQUAL,s,N),right:r(S.EQUAL,a,N)})}const T=v.value.replace(/\n$/,"").split(`
12
12
  `);if(E===S.DELETE){if(w===S.EQUAL)for(const D of m)s++,c.push({left:r(S.DELETE,s,Z(o,D)),right:t()});if(w===S.ADD){l=!0;const D=Math.max(_.count,v.count);for(let N=0;N<D;N++){N<_.count&&s++,N<v.count&&a++;const[I,R]=[m[N],T[N]],H=m.length===T.length?Ae(R,I,u):I,U=m.length===T.length?Ae(I,R,u):R,$=N<_.count?r(S.DELETE,s,Z(o,H)):t(),F=N<v.count?r(S.ADD,a,Z(o,U)):t();c.push({left:$,right:F})}}}if(E===S.ADD)for(const D of m)a++,c.push({left:t(),right:r(S.ADD,a,Z(o,D))})}if(n===e){for(let p=0;p<c.length;p++)c[p].fold=!1;return f}for(let p=0;p<c.length;p++){const _=c[p];if(_.left.type===S.DELETE||_.right.type===S.ADD){const[v,E]=[Math.max(p-g,0),Math.min(p+g+1,c.length)];for(let w=v;w<E;w++)c[w].fold=!1}_.fold===void 0&&(_.fold=!0)}const h=[];let d=[];for(let p=0;p<c.length;p++){const _=c[p];if(_.fold===!1){d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),h.push(_);continue}_.hide=!0,d.push(_),h.push(_)}return d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),f.changes=h,f}function Vt(n,e,o="plaintext",u="word",g=10){const t=bn(n,e);let r=0,i=0,s=!1;const a=[],l={changes:a,collector:[],stat:vn(t)};for(let h=0;h<t.length;h++){if(s){s=!1;continue}const[d,p]=[t[h],t[h+1]],[_,v]=[ce(d),ce(p)],E=d.value.replace(/\n$/,"").split(`
13
13
  `);if(p===void 0){for(const m of E){_===S.EQUAL&&(r++,i++),_===S.DELETE&&r++,_===S.ADD&&i++;const T=Z(o,m);a.push({type:_,code:T,addNum:_===S.DELETE?void 0:i,delNum:_===S.ADD?void 0:r})}break}if(_===S.EQUAL)for(const m of E){r++,i++;const T=Z(o,m);a.push({type:S.EQUAL,code:T,delNum:r,addNum:i})}const w=p.value.replace(/\n$/,"").split(`
14
- `);if(_===S.DELETE)if(v===S.ADD&&E.length===w.length){for(let m=0;m<E.length;m++){const T=E[m],D=w[m];r++;const N=Z(o,Ae(D,T,u));a.push({type:S.DELETE,code:N,delNum:r})}for(let m=0;m<w.length;m++){const T=E[m],D=w[m];i++;const N=Z(o,Ae(T,D,u));a.push({type:S.ADD,code:N,addNum:i})}s=!0}else for(const m of E){r++;const T=Z(o,m);a.push({type:S.DELETE,code:T,delNum:r})}if(_===S.ADD)for(const m of E){i++;const T=Z(o,m);a.push({type:S.ADD,code:T,addNum:i})}}for(let h=0;h<a.length;h++){const d=a[h];if(d.type===S.DELETE||d.type===S.ADD){const[p,_]=[Math.max(h-g,0),Math.min(h+g+1,a.length)];for(let v=p;v<_;v++)a[v].fold=!1}d.fold===void 0&&(d.fold=!0)}if(n===e){for(let h=0;h<a.length;h++)a[h].fold=!1;return l}const c=[];let f=[];for(let h=0;h<a.length;h++){const d=a[h];if(d.fold===!1){f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),l.changes=c,l}const Zt=V.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===S.DELETE?"-":g===S.ADD?"+":"",DiffType:S}}});function pe(n,e,o,u,g,t,r,i){var s=typeof n=="function"?n.options:n;e&&(s.render=e,s.staticRenderFns=o,s._compiled=!0),u&&(s.functional=!0),t&&(s._scopeId="data-v-"+t);var a;if(r?(a=function(f){f=f||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!f&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(f=__VUE_SSR_CONTEXT__),g&&g.call(this,f),f&&f._registeredComponents&&f._registeredComponents.add(r)},s._ssrRegister=a):g&&(a=i?function(){g.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:g),a)if(s.functional){s._injectStyles=a;var l=s.render;s.render=function(h,d){return a.call(d),l(h,d)}}else{var c=s.beforeCreate;s.beforeCreate=c?[].concat(c,a):[a]}return{exports:n,options:s}}var Yt=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.line.hideIndex!==void 0&&e.line.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk text-center",attrs:{colspan:"2"},on:{click:function(g){return u.emit("expand",e.line)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-hunk",attrs:{align:"left"}},[e._v(" ⋯ ")])]):e.line.hide?e._e():o("tr",[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.delNum)+" ")]),o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.addNum)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":e.line.type===u.DiffType.DELETE,"blob-code-addition":e.line.type===u.DiffType.ADD,"blob-code-context":e.line.type===u.DiffType.EQUAL,"blob-code-hunk":e.line.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(e.line.type)},domProps:{innerHTML:e._s(e.line.code)}})])])},Xt=[],jt=pe(Zt,Yt,Xt,!1,null,null,null,null);const Jt=jt.exports,qt=V.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,UnifiedLine:Jt}}});var er=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"diff-table"},[o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.UnifiedLine,{key:r,attrs:{line:t},on:{expand:u.expandHandler}})}),1)])},nr=[],tr=pe(qt,er,nr,!1,null,"238e1326",null,null);const rr=tr.exports,ir=V.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===S.DELETE?"-":g===S.ADD?"+":"",DiffType:S}}});var sr=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.splitLine.hideIndex!==void 0&&e.splitLine.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk",attrs:{colspan:"1"},on:{click:function(g){return u.emit("expand",e.splitLine)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-inner blob-code-hunk",attrs:{colspan:"3",align:"left"}},[e._v(" ⋯ ")])]):e.splitLine.hide?e._e():o("tr",[e._l([e.splitLine.left,e.splitLine.right],function(g){return[g.type===u.DiffType.EMPTY?[o("td",{staticClass:"blob-num blob-num-empty empty-cell"}),o("td",{staticClass:"blob-code blob-code-empty empty-cell"})]:[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":g.type===u.DiffType.DELETE,"blob-num-addition":g.type===u.DiffType.ADD,"blob-num-context":g.type===u.DiffType.EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}},[e._v(" "+e._s(g.num)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":g.type===u.DiffType.DELETE,"blob-code-addition":g.type===u.DiffType.ADD,"blob-code-context":g.type===u.DiffType.EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(g.type)},domProps:{innerHTML:e._s(g.code)}})])]]})],2)},ar=[],or=pe(ir,sr,ar,!1,null,null,null,null);const lr=or.exports,cr=V.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,SplitLine:lr}}});var ur=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"file-diff-split diff-table"},[e._m(0),o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.SplitLine,{key:r,attrs:{"split-line":t},on:{expand:u.expandHandler}})}),1)])},fr=[function(){var n=this,e=n._self._c;return n._self._setupProxy,e("colgroup",[e("col",{attrs:{width:"44"}}),e("col"),e("col",{attrs:{width:"44"}}),e("col")])}],gr=pe(cr,ur,fr,!1,null,"829edc33",null,null);const hr=gr.exports;const dr=V.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(n){const e=n,o=V.computed(()=>e.outputFormat==="line-by-line"),u=V.computed(()=>{const i=e.trim?e.oldString.trim():e.oldString;return e.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
- `):i}),g=V.computed(()=>{const i=e.trim?e.newString.trim():e.newString;return e.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
- `):i}),t=V.computed(()=>o.value?Vt(u.value,g.value,e.language,e.diffStyle,e.context):Qt(u.value,g.value,e.language,e.diffStyle,e.context)),r=V.ref(t.value);return V.watch(()=>e,()=>{r.value=t.value},{deep:!0}),{__sfc:!0,props:e,isUnifiedViewer:o,oldString:u,newString:g,raw:t,diffChange:r,UnifiedViewer:rr,SplitViewer:hr}}});var pr=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return o("div",{staticClass:"code-diff-view",style:{maxHeight:e.maxHeight}},[o("div",{staticClass:"file-header"},[o("div",{staticClass:"file-info"},[o("span",{staticClass:"filename"},[e._v(e._s(e.filename))]),o("span",{staticClass:"diff-stat"},[o("span",{staticClass:"diff-stat-added"},[e._v("+"+e._s(u.diffChange.stat.additionsNum)+" additions")]),o("span",{staticClass:"diff-stat-deleted",staticStyle:{"margin-left":"8px"}},[e._v("-"+e._s(u.diffChange.stat.deletionsNum)+" deletions")])])])]),u.isUnifiedViewer?o(u.UnifiedViewer,{attrs:{"diff-change":u.diffChange}}):o(u.SplitViewer,{attrs:{"diff-change":u.diffChange}})],1)},_r=[],br=pe(dr,pr,_r,!1,null,null,null,null);const En=br.exports,vr=n=>{n.component("CodeDiff",En)},Er={install:vr,hljs:Y};exports.CodeDiff=En;exports.default=Er;
14
+ `);if(_===S.DELETE)if(v===S.ADD&&E.length===w.length){for(let m=0;m<E.length;m++){const T=E[m],D=w[m];r++;const N=Z(o,Ae(D,T,u));a.push({type:S.DELETE,code:N,delNum:r})}for(let m=0;m<w.length;m++){const T=E[m],D=w[m];i++;const N=Z(o,Ae(T,D,u));a.push({type:S.ADD,code:N,addNum:i})}s=!0}else for(const m of E){r++;const T=Z(o,m);a.push({type:S.DELETE,code:T,delNum:r})}if(_===S.ADD)for(const m of E){i++;const T=Z(o,m);a.push({type:S.ADD,code:T,addNum:i})}}for(let h=0;h<a.length;h++){const d=a[h];if(d.type===S.DELETE||d.type===S.ADD){const[p,_]=[Math.max(h-g,0),Math.min(h+g+1,a.length)];for(let v=p;v<_;v++)a[v].fold=!1}d.fold===void 0&&(d.fold=!0)}if(n===e){for(let h=0;h<a.length;h++)a[h].fold=!1;return l}const c=[];let f=[];for(let h=0;h<a.length;h++){const d=a[h];if(d.fold===!1){f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),l.changes=c,l}const Zt=V.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===S.DELETE?"-":g===S.ADD?"+":"",DiffType:S}}});function pe(n,e,o,u,g,t,r,i){var s=typeof n=="function"?n.options:n;e&&(s.render=e,s.staticRenderFns=o,s._compiled=!0),u&&(s.functional=!0),t&&(s._scopeId="data-v-"+t);var a;if(r?(a=function(f){f=f||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!f&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(f=__VUE_SSR_CONTEXT__),g&&g.call(this,f),f&&f._registeredComponents&&f._registeredComponents.add(r)},s._ssrRegister=a):g&&(a=i?function(){g.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:g),a)if(s.functional){s._injectStyles=a;var l=s.render;s.render=function(h,d){return a.call(d),l(h,d)}}else{var c=s.beforeCreate;s.beforeCreate=c?[].concat(c,a):[a]}return{exports:n,options:s}}var Yt=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.line.hideIndex!==void 0&&e.line.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk text-center",attrs:{colspan:"2"},on:{click:function(g){return u.emit("expand",e.line)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-hunk",attrs:{align:"left"}},[e._v(" ⋯ ")])]):e.line.hide?e._e():o("tr",[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.delNum)+" ")]),o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.addNum)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":e.line.type===u.DiffType.DELETE,"blob-code-addition":e.line.type===u.DiffType.ADD,"blob-code-context":e.line.type===u.DiffType.EQUAL,"blob-code-hunk":e.line.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(e.line.type)},domProps:{innerHTML:e._s(e.line.code)}})])])},Xt=[],jt=pe(Zt,Yt,Xt,!1,null,null,null,null);const Jt=jt.exports,qt=V.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,UnifiedLine:Jt}}});var er=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"diff-table"},[o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.UnifiedLine,{key:r,attrs:{line:t},on:{expand:u.expandHandler}})}),1)])},nr=[],tr=pe(qt,er,nr,!1,null,"238e1326",null,null);const rr=tr.exports,ir=V.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===S.DELETE?"-":g===S.ADD?"+":"",DiffType:S}}});var sr=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.splitLine.hideIndex!==void 0&&e.splitLine.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk",attrs:{colspan:"1"},on:{click:function(g){return u.emit("expand",e.splitLine)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-inner blob-code-hunk",attrs:{colspan:"3",align:"left"}},[e._v(" ⋯ ")])]):e.splitLine.hide?e._e():o("tr",[e._l([e.splitLine.left,e.splitLine.right],function(g){return[g.type===u.DiffType.EMPTY?[o("td",{staticClass:"blob-num blob-num-empty empty-cell"}),o("td",{staticClass:"blob-code blob-code-empty empty-cell"})]:[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":g.type===u.DiffType.DELETE,"blob-num-addition":g.type===u.DiffType.ADD,"blob-num-context":g.type===u.DiffType.EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}},[e._v(" "+e._s(g.num)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":g.type===u.DiffType.DELETE,"blob-code-addition":g.type===u.DiffType.ADD,"blob-code-context":g.type===u.DiffType.EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(g.type)},domProps:{innerHTML:e._s(g.code)}})])]]})],2)},ar=[],or=pe(ir,sr,ar,!1,null,null,null,null);const lr=or.exports,cr=V.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,SplitLine:lr}}});var ur=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"file-diff-split diff-table"},[e._m(0),o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.SplitLine,{key:r,attrs:{"split-line":t},on:{expand:u.expandHandler}})}),1)])},fr=[function(){var n=this,e=n._self._c;return n._self._setupProxy,e("colgroup",[e("col",{attrs:{width:"44"}}),e("col"),e("col",{attrs:{width:"44"}}),e("col")])}],gr=pe(cr,ur,fr,!1,null,"829edc33",null,null);const hr=gr.exports;const dr=V.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(n){const e=n,o=V.computed(()=>e.outputFormat==="line-by-line"),u=V.computed(()=>{let i=e.oldString||"";return i=e.trim?i.trim():i,i=e.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
+ `):i,i}),g=V.computed(()=>{let i=e.newString||"";return i=e.trim?i.trim():i,i=e.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
+ `):i,i}),t=V.computed(()=>o.value?Vt(u.value,g.value,e.language,e.diffStyle,e.context):Qt(u.value,g.value,e.language,e.diffStyle,e.context)),r=V.ref(t.value);return V.watch(()=>e,()=>{r.value=t.value},{deep:!0}),{__sfc:!0,props:e,isUnifiedViewer:o,oldString:u,newString:g,raw:t,diffChange:r,UnifiedViewer:rr,SplitViewer:hr}}});var pr=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return o("div",{staticClass:"code-diff-view",style:{maxHeight:e.maxHeight}},[o("div",{staticClass:"file-header"},[o("div",{staticClass:"file-info"},[o("span",{staticClass:"filename"},[e._v(e._s(e.filename))]),o("span",{staticClass:"diff-stat"},[o("span",{staticClass:"diff-stat-added"},[e._v("+"+e._s(u.diffChange.stat.additionsNum)+" additions")]),o("span",{staticClass:"diff-stat-deleted",staticStyle:{"margin-left":"8px"}},[e._v("-"+e._s(u.diffChange.stat.deletionsNum)+" deletions")])])])]),u.isUnifiedViewer?o(u.UnifiedViewer,{attrs:{"diff-change":u.diffChange}}):o(u.SplitViewer,{attrs:{"diff-change":u.diffChange}})],1)},_r=[],br=pe(dr,pr,_r,!1,null,null,null,null);const En=br.exports,vr=n=>{n.component("CodeDiff",En)},Er={install:vr,hljs:Y};exports.CodeDiff=En;exports.default=Er;
@@ -5014,13 +5014,13 @@ const br = /* @__PURE__ */ de({
5014
5014
  },
5015
5015
  setup(n) {
5016
5016
  const e = n, o = me(() => e.outputFormat === "line-by-line"), u = me(() => {
5017
- const i = e.trim ? e.oldString.trim() : e.oldString;
5018
- return e.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5019
- `) : i;
5017
+ let i = e.oldString || "";
5018
+ return i = e.trim ? i.trim() : i, i = e.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5019
+ `) : i, i;
5020
5020
  }), g = me(() => {
5021
- const i = e.trim ? e.newString.trim() : e.newString;
5022
- return e.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5023
- `) : i;
5021
+ let i = e.newString || "";
5022
+ return i = e.trim ? i.trim() : i, i = e.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5023
+ `) : i, i;
5024
5024
  }), t = me(
5025
5025
  () => o.value ? Xt(u.value, g.value, e.language, e.diffStyle, e.context) : Yt(u.value, g.value, e.language, e.diffStyle, e.context)
5026
5026
  ), r = Sn(t.value);
@@ -11,6 +11,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`),x=b,k=N),L===void 0&&(
11
11
  `);if(v===void 0){for(const S of m){let M=t(),I=t();const R=j(o,S);E===T.EQUAL&&(s++,a++,M=r(T.EQUAL,s,R),I=r(T.EQUAL,a,R)),E===T.DELETE&&(s++,M=r(T.DELETE,s,R),I=t()),E===T.ADD&&(a++,M=t(),I=r(T.ADD,a,R)),c.push({left:M,right:I})}break}if(E===T.EQUAL)for(const S of m){s++,a++;const M=j(o,S);c.push({left:r(T.EQUAL,s,M),right:r(T.EQUAL,a,M)})}const D=v.value.replace(/\n$/,"").split(`
12
12
  `);if(E===T.DELETE){if(w===T.EQUAL)for(const S of m)s++,c.push({left:r(T.DELETE,s,j(o,S)),right:t()});if(w===T.ADD){l=!0;const S=Math.max(_.count,v.count);for(let M=0;M<S;M++){M<_.count&&s++,M<v.count&&a++;const[I,R]=[m[M],D[M]],H=m.length===D.length?we(R,I,u):I,U=m.length===D.length?we(I,R,u):R,$=M<_.count?r(T.DELETE,s,j(o,H)):t(),F=M<v.count?r(T.ADD,a,j(o,U)):t();c.push({left:$,right:F})}}}if(E===T.ADD)for(const S of m)a++,c.push({left:t(),right:r(T.ADD,a,j(o,S))})}if(n===e){for(let p=0;p<c.length;p++)c[p].fold=!1;return f}for(let p=0;p<c.length;p++){const _=c[p];if(_.left.type===T.DELETE||_.right.type===T.ADD){const[v,E]=[Math.max(p-g,0),Math.min(p+g+1,c.length)];for(let w=v;w<E;w++)c[w].fold=!1}_.fold===void 0&&(_.fold=!0)}const h=[];let d=[];for(let p=0;p<c.length;p++){const _=c[p];if(_.fold===!1){d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),h.push(_);continue}_.hide=!0,d.push(_),h.push(_)}return d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),f.changes=h,f}function Ut(n,e,o="plaintext",u="word",g=10){const t=hn(n,e);let r=0,i=0,s=!1;const a=[],l={changes:a,collector:[],stat:dn(t)};for(let h=0;h<t.length;h++){if(s){s=!1;continue}const[d,p]=[t[h],t[h+1]],[_,v]=[ce(d),ce(p)],E=d.value.replace(/\n$/,"").split(`
13
13
  `);if(p===void 0){for(const m of E){_===T.EQUAL&&(r++,i++),_===T.DELETE&&r++,_===T.ADD&&i++;const D=j(o,m);a.push({type:_,code:D,addNum:_===T.DELETE?void 0:i,delNum:_===T.ADD?void 0:r})}break}if(_===T.EQUAL)for(const m of E){r++,i++;const D=j(o,m);a.push({type:T.EQUAL,code:D,delNum:r,addNum:i})}const w=p.value.replace(/\n$/,"").split(`
14
- `);if(_===T.DELETE)if(v===T.ADD&&E.length===w.length){for(let m=0;m<E.length;m++){const D=E[m],S=w[m];r++;const M=j(o,we(S,D,u));a.push({type:T.DELETE,code:M,delNum:r})}for(let m=0;m<w.length;m++){const D=E[m],S=w[m];i++;const M=j(o,we(D,S,u));a.push({type:T.ADD,code:M,addNum:i})}s=!0}else for(const m of E){r++;const D=j(o,m);a.push({type:T.DELETE,code:D,delNum:r})}if(_===T.ADD)for(const m of E){i++;const D=j(o,m);a.push({type:T.ADD,code:D,addNum:i})}}for(let h=0;h<a.length;h++){const d=a[h];if(d.type===T.DELETE||d.type===T.ADD){const[p,_]=[Math.max(h-g,0),Math.min(h+g+1,a.length)];for(let v=p;v<_;v++)a[v].fold=!1}d.fold===void 0&&(d.fold=!0)}if(n===e){for(let h=0;h<a.length;h++)a[h].fold=!1;return l}const c=[];let f=[];for(let h=0;h<a.length;h++){const d=a[h];if(d.fold===!1){f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),l.changes=c,l}const Pt=G.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===T.DELETE?"-":g===T.ADD?"+":"",DiffType:T}}});function pe(n,e,o,u,g,t,r,i){var s=typeof n=="function"?n.options:n;e&&(s.render=e,s.staticRenderFns=o,s._compiled=!0),u&&(s.functional=!0),t&&(s._scopeId="data-v-"+t);var a;if(r?(a=function(f){f=f||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!f&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(f=__VUE_SSR_CONTEXT__),g&&g.call(this,f),f&&f._registeredComponents&&f._registeredComponents.add(r)},s._ssrRegister=a):g&&(a=i?function(){g.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:g),a)if(s.functional){s._injectStyles=a;var l=s.render;s.render=function(h,d){return a.call(d),l(h,d)}}else{var c=s.beforeCreate;s.beforeCreate=c?[].concat(c,a):[a]}return{exports:n,options:s}}var xt=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.line.hideIndex!==void 0&&e.line.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk text-center",attrs:{colspan:"2"},on:{click:function(g){return u.emit("expand",e.line)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-hunk",attrs:{align:"left"}},[e._v(" ⋯ ")])]):e.line.hide?e._e():o("tr",[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.delNum)+" ")]),o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.addNum)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":e.line.type===u.DiffType.DELETE,"blob-code-addition":e.line.type===u.DiffType.ADD,"blob-code-context":e.line.type===u.DiffType.EQUAL,"blob-code-hunk":e.line.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(e.line.type)},domProps:{innerHTML:e._s(e.line.code)}})])])},Ht=[],Ft=pe(Pt,xt,Ht,!1,null,null,null,null);const zt=Ft.exports,Gt=G.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,UnifiedLine:zt}}}),vr="";var Kt=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"diff-table"},[o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.UnifiedLine,{key:r,attrs:{line:t},on:{expand:u.expandHandler}})}),1)])},Wt=[],Qt=pe(Gt,Kt,Wt,!1,null,"238e1326",null,null);const Zt=Qt.exports,Yt=G.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===T.DELETE?"-":g===T.ADD?"+":"",DiffType:T}}}),Er="";var Xt=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.splitLine.hideIndex!==void 0&&e.splitLine.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk",attrs:{colspan:"1"},on:{click:function(g){return u.emit("expand",e.splitLine)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-inner blob-code-hunk",attrs:{colspan:"3",align:"left"}},[e._v(" ⋯ ")])]):e.splitLine.hide?e._e():o("tr",[e._l([e.splitLine.left,e.splitLine.right],function(g){return[g.type===u.DiffType.EMPTY?[o("td",{staticClass:"blob-num blob-num-empty empty-cell"}),o("td",{staticClass:"blob-code blob-code-empty empty-cell"})]:[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":g.type===u.DiffType.DELETE,"blob-num-addition":g.type===u.DiffType.ADD,"blob-num-context":g.type===u.DiffType.EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}},[e._v(" "+e._s(g.num)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":g.type===u.DiffType.DELETE,"blob-code-addition":g.type===u.DiffType.ADD,"blob-code-context":g.type===u.DiffType.EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(g.type)},domProps:{innerHTML:e._s(g.code)}})])]]})],2)},jt=[],Vt=pe(Yt,Xt,jt,!1,null,null,null,null);const Jt=Vt.exports,qt=G.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,SplitLine:Jt}}}),mr="";var er=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"file-diff-split diff-table"},[e._m(0),o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.SplitLine,{key:r,attrs:{"split-line":t},on:{expand:u.expandHandler}})}),1)])},nr=[function(){var n=this,e=n._self._c;return n._self._setupProxy,e("colgroup",[e("col",{attrs:{width:"44"}}),e("col"),e("col",{attrs:{width:"44"}}),e("col")])}],tr=pe(qt,er,nr,!1,null,"829edc33",null,null);const rr=tr.exports,yr="",wr="",ir=G.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(n){const e=n,o=G.computed(()=>e.outputFormat==="line-by-line"),u=G.computed(()=>{const i=e.trim?e.oldString.trim():e.oldString;return e.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
- `):i}),g=G.computed(()=>{const i=e.trim?e.newString.trim():e.newString;return e.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
- `):i}),t=G.computed(()=>o.value?Ut(u.value,g.value,e.language,e.diffStyle,e.context):$t(u.value,g.value,e.language,e.diffStyle,e.context)),r=G.ref(t.value);return G.watch(()=>e,()=>{r.value=t.value},{deep:!0}),{__sfc:!0,props:e,isUnifiedViewer:o,oldString:u,newString:g,raw:t,diffChange:r,UnifiedViewer:Zt,SplitViewer:rr}}}),Nr="";var sr=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return o("div",{staticClass:"code-diff-view",style:{maxHeight:e.maxHeight}},[o("div",{staticClass:"file-header"},[o("div",{staticClass:"file-info"},[o("span",{staticClass:"filename"},[e._v(e._s(e.filename))]),o("span",{staticClass:"diff-stat"},[o("span",{staticClass:"diff-stat-added"},[e._v("+"+e._s(u.diffChange.stat.additionsNum)+" additions")]),o("span",{staticClass:"diff-stat-deleted",staticStyle:{"margin-left":"8px"}},[e._v("-"+e._s(u.diffChange.stat.deletionsNum)+" deletions")])])])]),u.isUnifiedViewer?o(u.UnifiedViewer,{attrs:{"diff-change":u.diffChange}}):o(u.SplitViewer,{attrs:{"diff-change":u.diffChange}})],1)},ar=[],or=pe(ir,sr,ar,!1,null,null,null,null);const lr=or.exports;return{install:n=>{n.component("CodeDiff",lr)},hljs:X}});
14
+ `);if(_===T.DELETE)if(v===T.ADD&&E.length===w.length){for(let m=0;m<E.length;m++){const D=E[m],S=w[m];r++;const M=j(o,we(S,D,u));a.push({type:T.DELETE,code:M,delNum:r})}for(let m=0;m<w.length;m++){const D=E[m],S=w[m];i++;const M=j(o,we(D,S,u));a.push({type:T.ADD,code:M,addNum:i})}s=!0}else for(const m of E){r++;const D=j(o,m);a.push({type:T.DELETE,code:D,delNum:r})}if(_===T.ADD)for(const m of E){i++;const D=j(o,m);a.push({type:T.ADD,code:D,addNum:i})}}for(let h=0;h<a.length;h++){const d=a[h];if(d.type===T.DELETE||d.type===T.ADD){const[p,_]=[Math.max(h-g,0),Math.min(h+g+1,a.length)];for(let v=p;v<_;v++)a[v].fold=!1}d.fold===void 0&&(d.fold=!0)}if(n===e){for(let h=0;h<a.length;h++)a[h].fold=!1;return l}const c=[];let f=[];for(let h=0;h<a.length;h++){const d=a[h];if(d.fold===!1){f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=l.collector.length,l.collector.push({lines:f,fold:!0}),f=[]),l.changes=c,l}const Pt=G.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===T.DELETE?"-":g===T.ADD?"+":"",DiffType:T}}});function pe(n,e,o,u,g,t,r,i){var s=typeof n=="function"?n.options:n;e&&(s.render=e,s.staticRenderFns=o,s._compiled=!0),u&&(s.functional=!0),t&&(s._scopeId="data-v-"+t);var a;if(r?(a=function(f){f=f||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!f&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(f=__VUE_SSR_CONTEXT__),g&&g.call(this,f),f&&f._registeredComponents&&f._registeredComponents.add(r)},s._ssrRegister=a):g&&(a=i?function(){g.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:g),a)if(s.functional){s._injectStyles=a;var l=s.render;s.render=function(h,d){return a.call(d),l(h,d)}}else{var c=s.beforeCreate;s.beforeCreate=c?[].concat(c,a):[a]}return{exports:n,options:s}}var xt=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.line.hideIndex!==void 0&&e.line.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk text-center",attrs:{colspan:"2"},on:{click:function(g){return u.emit("expand",e.line)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-hunk",attrs:{align:"left"}},[e._v(" ⋯ ")])]):e.line.hide?e._e():o("tr",[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.delNum)+" ")]),o("td",{staticClass:"blob-num",class:{"blob-num-deletion":e.line.type===u.DiffType.DELETE,"blob-num-addition":e.line.type===u.DiffType.ADD,"blob-num-context":e.line.type===u.DiffType.EQUAL,"blob-num-hunk":e.line.hide!==void 0}},[e._v(" "+e._s(e.line.addNum)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":e.line.type===u.DiffType.DELETE,"blob-code-addition":e.line.type===u.DiffType.ADD,"blob-code-context":e.line.type===u.DiffType.EQUAL,"blob-code-hunk":e.line.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(e.line.type)},domProps:{innerHTML:e._s(e.line.code)}})])])},Ht=[],Ft=pe(Pt,xt,Ht,!1,null,null,null,null);const zt=Ft.exports,Gt=G.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,UnifiedLine:zt}}}),vr="";var Kt=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"diff-table"},[o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.UnifiedLine,{key:r,attrs:{line:t},on:{expand:u.expandHandler}})}),1)])},Wt=[],Qt=pe(Gt,Kt,Wt,!1,null,"238e1326",null,null);const Zt=Qt.exports,Yt=G.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(n,{emit:e}){return{__sfc:!0,props:n,emit:e,getCodeMarker:g=>g===T.DELETE?"-":g===T.ADD?"+":"",DiffType:T}}}),Er="";var Xt=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return e.splitLine.hideIndex!==void 0&&e.splitLine.hide?o("tr",[o("td",{staticClass:"blob-num blob-num-hunk",attrs:{colspan:"1"},on:{click:function(g){return u.emit("expand",e.splitLine)}}},[e._v(" > ")]),o("td",{staticClass:"blob-code blob-code-inner blob-code-hunk",attrs:{colspan:"3",align:"left"}},[e._v(" ⋯ ")])]):e.splitLine.hide?e._e():o("tr",[e._l([e.splitLine.left,e.splitLine.right],function(g){return[g.type===u.DiffType.EMPTY?[o("td",{staticClass:"blob-num blob-num-empty empty-cell"}),o("td",{staticClass:"blob-code blob-code-empty empty-cell"})]:[o("td",{staticClass:"blob-num",class:{"blob-num-deletion":g.type===u.DiffType.DELETE,"blob-num-addition":g.type===u.DiffType.ADD,"blob-num-context":g.type===u.DiffType.EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}},[e._v(" "+e._s(g.num)+" ")]),o("td",{staticClass:"blob-code",class:{"blob-code-deletion":g.type===u.DiffType.DELETE,"blob-code-addition":g.type===u.DiffType.ADD,"blob-code-context":g.type===u.DiffType.EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}},[o("span",{staticClass:"blob-code-inner blob-code-marker",attrs:{"data-code-marker":u.getCodeMarker(g.type)},domProps:{innerHTML:e._s(g.code)}})])]]})],2)},jt=[],Vt=pe(Yt,Xt,jt,!1,null,null,null,null);const Jt=Vt.exports,qt=G.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(n){const e=n;function o({hideIndex:u}){u!==void 0&&e.diffChange.collector[u].lines.forEach(g=>{g.hide=!1,g.fold=!1})}return{__sfc:!0,props:e,expandHandler:o,SplitLine:Jt}}}),mr="";var er=function(){var g;var e=this,o=e._self._c,u=e._self._setupProxy;return o("table",{staticClass:"file-diff-split diff-table"},[e._m(0),o("tbody",e._l((g=e.diffChange)==null?void 0:g.changes,function(t,r){return o(u.SplitLine,{key:r,attrs:{"split-line":t},on:{expand:u.expandHandler}})}),1)])},nr=[function(){var n=this,e=n._self._c;return n._self._setupProxy,e("colgroup",[e("col",{attrs:{width:"44"}}),e("col"),e("col",{attrs:{width:"44"}}),e("col")])}],tr=pe(qt,er,nr,!1,null,"829edc33",null,null);const rr=tr.exports,yr="",wr="",ir=G.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(n){const e=n,o=G.computed(()=>e.outputFormat==="line-by-line"),u=G.computed(()=>{let i=e.oldString||"";return i=e.trim?i.trim():i,i=e.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
+ `):i,i}),g=G.computed(()=>{let i=e.newString||"";return i=e.trim?i.trim():i,i=e.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
+ `):i,i}),t=G.computed(()=>o.value?Ut(u.value,g.value,e.language,e.diffStyle,e.context):$t(u.value,g.value,e.language,e.diffStyle,e.context)),r=G.ref(t.value);return G.watch(()=>e,()=>{r.value=t.value},{deep:!0}),{__sfc:!0,props:e,isUnifiedViewer:o,oldString:u,newString:g,raw:t,diffChange:r,UnifiedViewer:Zt,SplitViewer:rr}}}),Nr="";var sr=function(){var e=this,o=e._self._c,u=e._self._setupProxy;return o("div",{staticClass:"code-diff-view",style:{maxHeight:e.maxHeight}},[o("div",{staticClass:"file-header"},[o("div",{staticClass:"file-info"},[o("span",{staticClass:"filename"},[e._v(e._s(e.filename))]),o("span",{staticClass:"diff-stat"},[o("span",{staticClass:"diff-stat-added"},[e._v("+"+e._s(u.diffChange.stat.additionsNum)+" additions")]),o("span",{staticClass:"diff-stat-deleted",staticStyle:{"margin-left":"8px"}},[e._v("-"+e._s(u.diffChange.stat.deletionsNum)+" deletions")])])])]),u.isUnifiedViewer?o(u.UnifiedViewer,{attrs:{"diff-change":u.diffChange}}):o(u.SplitViewer,{attrs:{"diff-change":u.diffChange}})],1)},ar=[],or=pe(ir,sr,ar,!1,null,null,null,null);const lr=or.exports;return{install:n=>{n.component("CodeDiff",lr)},hljs:X}});
@@ -11,6 +11,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`),H=E,B=A),C===void 0&&(
11
11
  `);if(m===void 0){for(const R of y){let T=n(),I=n();const L=Z(l,R);v===M.EQUAL&&(s++,a++,T=r(M.EQUAL,s,L),I=r(M.EQUAL,a,L)),v===M.DELETE&&(s++,T=r(M.DELETE,s,L),I=n()),v===M.ADD&&(a++,T=n(),I=r(M.ADD,a,L)),c.push({left:T,right:I})}break}if(v===M.EQUAL)for(const R of y){s++,a++;const T=Z(l,R);c.push({left:r(M.EQUAL,s,T),right:r(M.EQUAL,a,T)})}const S=m.value.replace(/\n$/,"").split(`
12
12
  `);if(v===M.DELETE){if(N===M.EQUAL)for(const R of y)s++,c.push({left:r(M.DELETE,s,Z(l,R)),right:n()});if(N===M.ADD){o=!0;const R=Math.max(_.count,m.count);for(let T=0;T<R;T++){T<_.count&&s++,T<m.count&&a++;const[I,L]=[y[T],S[T]],F=y.length===S.length?Me(L,I,u):I,P=y.length===S.length?Me(I,L,u):L,U=T<_.count?r(M.DELETE,s,Z(l,F)):n(),z=T<m.count?r(M.ADD,a,Z(l,P)):n();c.push({left:U,right:z})}}}if(v===M.ADD)for(const R of y)a++,c.push({left:n(),right:r(M.ADD,a,Z(l,R))})}if(e===t){for(let p=0;p<c.length;p++)c[p].fold=!1;return f}for(let p=0;p<c.length;p++){const _=c[p];if(_.left.type===M.DELETE||_.right.type===M.ADD){const[m,v]=[Math.max(p-h,0),Math.min(p+h+1,c.length)];for(let N=m;N<v;N++)c[N].fold=!1}_.fold===void 0&&(_.fold=!0)}const g=[];let d=[];for(let p=0;p<c.length;p++){const _=c[p];if(_.fold===!1){d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),g.push(_);continue}_.hide=!0,d.push(_),g.push(_)}return d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),f.changes=g,f}function Wt(e,t,l="plaintext",u="word",h=10){const n=bn(e,t);let r=0,i=0,s=!1;const a=[],o={changes:a,collector:[],stat:_n(n)};for(let g=0;g<n.length;g++){if(s){s=!1;continue}const[d,p]=[n[g],n[g+1]],[_,m]=[ce(d),ce(p)],v=d.value.replace(/\n$/,"").split(`
13
13
  `);if(p===void 0){for(const y of v){_===M.EQUAL&&(r++,i++),_===M.DELETE&&r++,_===M.ADD&&i++;const S=Z(l,y);a.push({type:_,code:S,addNum:_===M.DELETE?void 0:i,delNum:_===M.ADD?void 0:r})}break}if(_===M.EQUAL)for(const y of v){r++,i++;const S=Z(l,y);a.push({type:M.EQUAL,code:S,delNum:r,addNum:i})}const N=p.value.replace(/\n$/,"").split(`
14
- `);if(_===M.DELETE)if(m===M.ADD&&v.length===N.length){for(let y=0;y<v.length;y++){const S=v[y],R=N[y];r++;const T=Z(l,Me(R,S,u));a.push({type:M.DELETE,code:T,delNum:r})}for(let y=0;y<N.length;y++){const S=v[y],R=N[y];i++;const T=Z(l,Me(S,R,u));a.push({type:M.ADD,code:T,addNum:i})}s=!0}else for(const y of v){r++;const S=Z(l,y);a.push({type:M.DELETE,code:S,delNum:r})}if(_===M.ADD)for(const y of v){i++;const S=Z(l,y);a.push({type:M.ADD,code:S,addNum:i})}}for(let g=0;g<a.length;g++){const d=a[g];if(d.type===M.DELETE||d.type===M.ADD){const[p,_]=[Math.max(g-h,0),Math.min(g+h+1,a.length)];for(let m=p;m<_;m++)a[m].fold=!1}d.fold===void 0&&(d.fold=!0)}if(e===t){for(let g=0;g<a.length;g++)a[g].fold=!1;return o}const c=[];let f=[];for(let g=0;g<a.length;g++){const d=a[g];if(d.fold===!1){f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),o.changes=c,o}const Qt={key:0},Zt=b.createElementVNode("td",{class:"blob-code blob-code-hunk",align:"left"}," ⋯ ",-1),Yt={key:1},Xt=["data-code-marker","innerHTML"],jt=b.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.line.hideIndex!==void 0&&e.line.hide?(b.openBlock(),b.createElementBlock("tr",Qt,[b.createElementVNode("td",{class:"blob-num blob-num-hunk text-center",colspan:"2",onClick:h[0]||(h[0]=n=>t("expand",e.line))}," > "),Zt])):e.line.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",Yt,[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.delNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.addNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":e.line.type===b.unref(M).DELETE,"blob-code-addition":e.line.type===b.unref(M).ADD,"blob-code-context":e.line.type===b.unref(M).EQUAL,"blob-code-hunk":e.line.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(e.line.type),innerHTML:e.line.code},null,8,Xt)],2)]))}}),Jt={class:"diff-table"},qt=b.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",Jt,[b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(jt,{key:i,line:r,onExpand:l},null,8,["line"]))),128))])])}}}),er={key:0},nr=b.createElementVNode("td",{class:"blob-code blob-code-inner blob-code-hunk",colspan:"3",align:"left"}," ⋯ ",-1),tr={key:1},rr=b.createElementVNode("td",{class:"blob-num blob-num-empty empty-cell"},null,-1),ir=b.createElementVNode("td",{class:"blob-code blob-code-empty empty-cell"},null,-1),sr=["data-code-marker","innerHTML"],ar=b.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.splitLine.hideIndex!==void 0&&e.splitLine.hide?(b.openBlock(),b.createElementBlock("tr",er,[b.createElementVNode("td",{class:"blob-num blob-num-hunk",colspan:"1",onClick:h[0]||(h[0]=n=>t("expand",e.splitLine))}," > "),nr])):e.splitLine.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",tr,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList([e.splitLine.left,e.splitLine.right],n=>(b.openBlock(),b.createElementBlock(b.Fragment,null,[n.type===b.unref(M).EMPTY?(b.openBlock(),b.createElementBlock(b.Fragment,{key:0},[rr,ir],64)):(b.openBlock(),b.createElementBlock(b.Fragment,{key:1},[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":n.type===b.unref(M).DELETE,"blob-num-addition":n.type===b.unref(M).ADD,"blob-num-context":n.type===b.unref(M).EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}])},b.toDisplayString(n.num),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":n.type===b.unref(M).DELETE,"blob-code-addition":n.type===b.unref(M).ADD,"blob-code-context":n.type===b.unref(M).EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(n.type),innerHTML:n.code},null,8,sr)],2)],64))],64))),256))]))}}),or={class:"file-diff-split diff-table"},lr=b.createElementVNode("colgroup",null,[b.createElementVNode("col",{width:"44"}),b.createElementVNode("col"),b.createElementVNode("col",{width:"44"}),b.createElementVNode("col")],-1),cr=b.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",or,[lr,b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(ar,{key:i,"split-line":r,onExpand:l},null,8,["split-line"]))),128))])])}}});const ur={class:"file-header"},fr={class:"file-info"},gr={class:"filename"},hr={class:"diff-stat"},dr={class:"diff-stat-added"},pr={class:"diff-stat-deleted",style:{"margin-left":"8px"}},En=b.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(e){const t=e,l=b.computed(()=>t.outputFormat==="line-by-line"),u=b.computed(()=>{const i=t.trim?t.oldString.trim():t.oldString;return t.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
- `):i}),h=b.computed(()=>{const i=t.trim?t.newString.trim():t.newString;return t.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
- `):i}),n=b.computed(()=>l.value?Wt(u.value,h.value,t.language,t.diffStyle,t.context):Vt(u.value,h.value,t.language,t.diffStyle,t.context)),r=b.ref(n.value);return b.watch(()=>t,()=>{r.value=n.value},{deep:!0}),(i,s)=>(b.openBlock(),b.createElementBlock("div",{class:"code-diff-view",style:b.normalizeStyle({maxHeight:e.maxHeight})},[b.createElementVNode("div",ur,[b.createElementVNode("div",fr,[b.createElementVNode("span",gr,b.toDisplayString(e.filename),1),b.createElementVNode("span",hr,[b.createElementVNode("span",dr,"+"+b.toDisplayString(b.unref(r).stat.additionsNum)+" additions",1),b.createElementVNode("span",pr,"-"+b.toDisplayString(b.unref(r).stat.deletionsNum)+" deletions",1)])])]),b.unref(l)?(b.openBlock(),b.createBlock(qt,{key:0,"diff-change":b.unref(r)},null,8,["diff-change"])):(b.openBlock(),b.createBlock(cr,{key:1,"diff-change":b.unref(r)},null,8,["diff-change"]))],4))}}),br=e=>{e.component("CodeDiff",En)},_r={install:br,hljs:Y};exports.CodeDiff=En;exports.default=_r;
14
+ `);if(_===M.DELETE)if(m===M.ADD&&v.length===N.length){for(let y=0;y<v.length;y++){const S=v[y],R=N[y];r++;const T=Z(l,Me(R,S,u));a.push({type:M.DELETE,code:T,delNum:r})}for(let y=0;y<N.length;y++){const S=v[y],R=N[y];i++;const T=Z(l,Me(S,R,u));a.push({type:M.ADD,code:T,addNum:i})}s=!0}else for(const y of v){r++;const S=Z(l,y);a.push({type:M.DELETE,code:S,delNum:r})}if(_===M.ADD)for(const y of v){i++;const S=Z(l,y);a.push({type:M.ADD,code:S,addNum:i})}}for(let g=0;g<a.length;g++){const d=a[g];if(d.type===M.DELETE||d.type===M.ADD){const[p,_]=[Math.max(g-h,0),Math.min(g+h+1,a.length)];for(let m=p;m<_;m++)a[m].fold=!1}d.fold===void 0&&(d.fold=!0)}if(e===t){for(let g=0;g<a.length;g++)a[g].fold=!1;return o}const c=[];let f=[];for(let g=0;g<a.length;g++){const d=a[g];if(d.fold===!1){f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),o.changes=c,o}const Qt={key:0},Zt=b.createElementVNode("td",{class:"blob-code blob-code-hunk",align:"left"}," ⋯ ",-1),Yt={key:1},Xt=["data-code-marker","innerHTML"],jt=b.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.line.hideIndex!==void 0&&e.line.hide?(b.openBlock(),b.createElementBlock("tr",Qt,[b.createElementVNode("td",{class:"blob-num blob-num-hunk text-center",colspan:"2",onClick:h[0]||(h[0]=n=>t("expand",e.line))}," > "),Zt])):e.line.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",Yt,[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.delNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.addNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":e.line.type===b.unref(M).DELETE,"blob-code-addition":e.line.type===b.unref(M).ADD,"blob-code-context":e.line.type===b.unref(M).EQUAL,"blob-code-hunk":e.line.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(e.line.type),innerHTML:e.line.code},null,8,Xt)],2)]))}}),Jt={class:"diff-table"},qt=b.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",Jt,[b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(jt,{key:i,line:r,onExpand:l},null,8,["line"]))),128))])])}}}),er={key:0},nr=b.createElementVNode("td",{class:"blob-code blob-code-inner blob-code-hunk",colspan:"3",align:"left"}," ⋯ ",-1),tr={key:1},rr=b.createElementVNode("td",{class:"blob-num blob-num-empty empty-cell"},null,-1),ir=b.createElementVNode("td",{class:"blob-code blob-code-empty empty-cell"},null,-1),sr=["data-code-marker","innerHTML"],ar=b.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.splitLine.hideIndex!==void 0&&e.splitLine.hide?(b.openBlock(),b.createElementBlock("tr",er,[b.createElementVNode("td",{class:"blob-num blob-num-hunk",colspan:"1",onClick:h[0]||(h[0]=n=>t("expand",e.splitLine))}," > "),nr])):e.splitLine.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",tr,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList([e.splitLine.left,e.splitLine.right],n=>(b.openBlock(),b.createElementBlock(b.Fragment,null,[n.type===b.unref(M).EMPTY?(b.openBlock(),b.createElementBlock(b.Fragment,{key:0},[rr,ir],64)):(b.openBlock(),b.createElementBlock(b.Fragment,{key:1},[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":n.type===b.unref(M).DELETE,"blob-num-addition":n.type===b.unref(M).ADD,"blob-num-context":n.type===b.unref(M).EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}])},b.toDisplayString(n.num),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":n.type===b.unref(M).DELETE,"blob-code-addition":n.type===b.unref(M).ADD,"blob-code-context":n.type===b.unref(M).EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(n.type),innerHTML:n.code},null,8,sr)],2)],64))],64))),256))]))}}),or={class:"file-diff-split diff-table"},lr=b.createElementVNode("colgroup",null,[b.createElementVNode("col",{width:"44"}),b.createElementVNode("col"),b.createElementVNode("col",{width:"44"}),b.createElementVNode("col")],-1),cr=b.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",or,[lr,b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(ar,{key:i,"split-line":r,onExpand:l},null,8,["split-line"]))),128))])])}}});const ur={class:"file-header"},fr={class:"file-info"},gr={class:"filename"},hr={class:"diff-stat"},dr={class:"diff-stat-added"},pr={class:"diff-stat-deleted",style:{"margin-left":"8px"}},En=b.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(e){const t=e,l=b.computed(()=>t.outputFormat==="line-by-line"),u=b.computed(()=>{let i=t.oldString||"";return i=t.trim?i.trim():i,i=t.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
+ `):i,i}),h=b.computed(()=>{let i=t.newString||"";return i=t.trim?i.trim():i,i=t.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
+ `):i,i}),n=b.computed(()=>l.value?Wt(u.value,h.value,t.language,t.diffStyle,t.context):Vt(u.value,h.value,t.language,t.diffStyle,t.context)),r=b.ref(n.value);return b.watch(()=>t,()=>{r.value=n.value},{deep:!0}),(i,s)=>(b.openBlock(),b.createElementBlock("div",{class:"code-diff-view",style:b.normalizeStyle({maxHeight:e.maxHeight})},[b.createElementVNode("div",ur,[b.createElementVNode("div",fr,[b.createElementVNode("span",gr,b.toDisplayString(e.filename),1),b.createElementVNode("span",hr,[b.createElementVNode("span",dr,"+"+b.toDisplayString(b.unref(r).stat.additionsNum)+" additions",1),b.createElementVNode("span",pr,"-"+b.toDisplayString(b.unref(r).stat.deletionsNum)+" deletions",1)])])]),b.unref(l)?(b.openBlock(),b.createBlock(qt,{key:0,"diff-change":b.unref(r)},null,8,["diff-change"])):(b.openBlock(),b.createBlock(cr,{key:1,"diff-change":b.unref(r)},null,8,["diff-change"]))],4))}}),br=e=>{e.component("CodeDiff",En)},_r={install:br,hljs:Y};exports.CodeDiff=En;exports.default=_r;
@@ -5003,13 +5003,13 @@ const Nr = { class: "file-header" }, Mr = { class: "file-info" }, Ar = { class:
5003
5003
  },
5004
5004
  setup(e) {
5005
5005
  const t = e, l = Te(() => t.outputFormat === "line-by-line"), u = Te(() => {
5006
- const i = t.trim ? t.oldString.trim() : t.oldString;
5007
- return t.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5008
- `) : i;
5006
+ let i = t.oldString || "";
5007
+ return i = t.trim ? i.trim() : i, i = t.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5008
+ `) : i, i;
5009
5009
  }), h = Te(() => {
5010
- const i = t.trim ? t.newString.trim() : t.newString;
5011
- return t.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5012
- `) : i;
5010
+ let i = t.newString || "";
5011
+ return i = t.trim ? i.trim() : i, i = t.noDiffLineFeed ? i.replace(/(\r\n)/g, `
5012
+ `) : i, i;
5013
5013
  }), n = Te(
5014
5014
  () => l.value ? sr(u.value, h.value, t.language, t.diffStyle, t.context) : ir(u.value, h.value, t.language, t.diffStyle, t.context)
5015
5015
  ), r = $n(n.value);
@@ -11,6 +11,6 @@ https://github.com/highlightjs/highlight.js/issues/2277`),H=E,B=A),C===void 0&&(
11
11
  `);if(m===void 0){for(const R of y){let T=n(),I=n();const L=X(l,R);v===M.EQUAL&&(s++,a++,T=r(M.EQUAL,s,L),I=r(M.EQUAL,a,L)),v===M.DELETE&&(s++,T=r(M.DELETE,s,L),I=n()),v===M.ADD&&(a++,T=n(),I=r(M.ADD,a,L)),c.push({left:T,right:I})}break}if(v===M.EQUAL)for(const R of y){s++,a++;const T=X(l,R);c.push({left:r(M.EQUAL,s,T),right:r(M.EQUAL,a,T)})}const S=m.value.replace(/\n$/,"").split(`
12
12
  `);if(v===M.DELETE){if(N===M.EQUAL)for(const R of y)s++,c.push({left:r(M.DELETE,s,X(l,R)),right:n()});if(N===M.ADD){o=!0;const R=Math.max(_.count,m.count);for(let T=0;T<R;T++){T<_.count&&s++,T<m.count&&a++;const[I,L]=[y[T],S[T]],F=y.length===S.length?ye(L,I,u):I,P=y.length===S.length?ye(I,L,u):L,U=T<_.count?r(M.DELETE,s,X(l,F)):n(),z=T<m.count?r(M.ADD,a,X(l,P)):n();c.push({left:U,right:z})}}}if(v===M.ADD)for(const R of y)a++,c.push({left:n(),right:r(M.ADD,a,X(l,R))})}if(e===t){for(let p=0;p<c.length;p++)c[p].fold=!1;return f}for(let p=0;p<c.length;p++){const _=c[p];if(_.left.type===M.DELETE||_.right.type===M.ADD){const[m,v]=[Math.max(p-h,0),Math.min(p+h+1,c.length)];for(let N=m;N<v;N++)c[N].fold=!1}_.fold===void 0&&(_.fold=!0)}const g=[];let d=[];for(let p=0;p<c.length;p++){const _=c[p];if(_.fold===!1){d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),g.push(_);continue}_.hide=!0,d.push(_),g.push(_)}return d.length&&(d[0].hideIndex=f.collector.length,f.collector.push({lines:d,fold:!0}),d=[]),f.changes=g,f}function $t(e,t,l="plaintext",u="word",h=10){const n=gn(e,t);let r=0,i=0,s=!1;const a=[],o={changes:a,collector:[],stat:hn(n)};for(let g=0;g<n.length;g++){if(s){s=!1;continue}const[d,p]=[n[g],n[g+1]],[_,m]=[ce(d),ce(p)],v=d.value.replace(/\n$/,"").split(`
13
13
  `);if(p===void 0){for(const y of v){_===M.EQUAL&&(r++,i++),_===M.DELETE&&r++,_===M.ADD&&i++;const S=X(l,y);a.push({type:_,code:S,addNum:_===M.DELETE?void 0:i,delNum:_===M.ADD?void 0:r})}break}if(_===M.EQUAL)for(const y of v){r++,i++;const S=X(l,y);a.push({type:M.EQUAL,code:S,delNum:r,addNum:i})}const N=p.value.replace(/\n$/,"").split(`
14
- `);if(_===M.DELETE)if(m===M.ADD&&v.length===N.length){for(let y=0;y<v.length;y++){const S=v[y],R=N[y];r++;const T=X(l,ye(R,S,u));a.push({type:M.DELETE,code:T,delNum:r})}for(let y=0;y<N.length;y++){const S=v[y],R=N[y];i++;const T=X(l,ye(S,R,u));a.push({type:M.ADD,code:T,addNum:i})}s=!0}else for(const y of v){r++;const S=X(l,y);a.push({type:M.DELETE,code:S,delNum:r})}if(_===M.ADD)for(const y of v){i++;const S=X(l,y);a.push({type:M.ADD,code:S,addNum:i})}}for(let g=0;g<a.length;g++){const d=a[g];if(d.type===M.DELETE||d.type===M.ADD){const[p,_]=[Math.max(g-h,0),Math.min(g+h+1,a.length)];for(let m=p;m<_;m++)a[m].fold=!1}d.fold===void 0&&(d.fold=!0)}if(e===t){for(let g=0;g<a.length;g++)a[g].fold=!1;return o}const c=[];let f=[];for(let g=0;g<a.length;g++){const d=a[g];if(d.fold===!1){f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),o.changes=c,o}const Ut={key:0},Pt=b.createElementVNode("td",{class:"blob-code blob-code-hunk",align:"left"}," ⋯ ",-1),xt={key:1},Ht=["data-code-marker","innerHTML"],Ft=b.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.line.hideIndex!==void 0&&e.line.hide?(b.openBlock(),b.createElementBlock("tr",Ut,[b.createElementVNode("td",{class:"blob-num blob-num-hunk text-center",colspan:"2",onClick:h[0]||(h[0]=n=>t("expand",e.line))}," > "),Pt])):e.line.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",xt,[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.delNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.addNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":e.line.type===b.unref(M).DELETE,"blob-code-addition":e.line.type===b.unref(M).ADD,"blob-code-context":e.line.type===b.unref(M).EQUAL,"blob-code-hunk":e.line.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(e.line.type),innerHTML:e.line.code},null,8,Ht)],2)]))}}),zt={class:"diff-table"},Gt=b.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",zt,[b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(Ft,{key:i,line:r,onExpand:l},null,8,["line"]))),128))])])}}}),Kt={key:0},Vt=b.createElementVNode("td",{class:"blob-code blob-code-inner blob-code-hunk",colspan:"3",align:"left"}," ⋯ ",-1),Wt={key:1},Qt=b.createElementVNode("td",{class:"blob-num blob-num-empty empty-cell"},null,-1),Zt=b.createElementVNode("td",{class:"blob-code blob-code-empty empty-cell"},null,-1),Yt=["data-code-marker","innerHTML"],Xt=b.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.splitLine.hideIndex!==void 0&&e.splitLine.hide?(b.openBlock(),b.createElementBlock("tr",Kt,[b.createElementVNode("td",{class:"blob-num blob-num-hunk",colspan:"1",onClick:h[0]||(h[0]=n=>t("expand",e.splitLine))}," > "),Vt])):e.splitLine.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",Wt,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList([e.splitLine.left,e.splitLine.right],n=>(b.openBlock(),b.createElementBlock(b.Fragment,null,[n.type===b.unref(M).EMPTY?(b.openBlock(),b.createElementBlock(b.Fragment,{key:0},[Qt,Zt],64)):(b.openBlock(),b.createElementBlock(b.Fragment,{key:1},[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":n.type===b.unref(M).DELETE,"blob-num-addition":n.type===b.unref(M).ADD,"blob-num-context":n.type===b.unref(M).EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}])},b.toDisplayString(n.num),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":n.type===b.unref(M).DELETE,"blob-code-addition":n.type===b.unref(M).ADD,"blob-code-context":n.type===b.unref(M).EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(n.type),innerHTML:n.code},null,8,Yt)],2)],64))],64))),256))]))}}),jt={class:"file-diff-split diff-table"},Jt=b.createElementVNode("colgroup",null,[b.createElementVNode("col",{width:"44"}),b.createElementVNode("col"),b.createElementVNode("col",{width:"44"}),b.createElementVNode("col")],-1),qt=b.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",jt,[Jt,b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(Xt,{key:i,"split-line":r,onExpand:l},null,8,["split-line"]))),128))])])}}}),br="",_r="",er={class:"file-header"},nr={class:"file-info"},tr={class:"filename"},rr={class:"diff-stat"},ir={class:"diff-stat-added"},sr={class:"diff-stat-deleted",style:{"margin-left":"8px"}},ar=b.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(e){const t=e,l=b.computed(()=>t.outputFormat==="line-by-line"),u=b.computed(()=>{const i=t.trim?t.oldString.trim():t.oldString;return t.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
- `):i}),h=b.computed(()=>{const i=t.trim?t.newString.trim():t.newString;return t.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
- `):i}),n=b.computed(()=>l.value?$t(u.value,h.value,t.language,t.diffStyle,t.context):Bt(u.value,h.value,t.language,t.diffStyle,t.context)),r=b.ref(n.value);return b.watch(()=>t,()=>{r.value=n.value},{deep:!0}),(i,s)=>(b.openBlock(),b.createElementBlock("div",{class:"code-diff-view",style:b.normalizeStyle({maxHeight:e.maxHeight})},[b.createElementVNode("div",er,[b.createElementVNode("div",nr,[b.createElementVNode("span",tr,b.toDisplayString(e.filename),1),b.createElementVNode("span",rr,[b.createElementVNode("span",ir,"+"+b.toDisplayString(b.unref(r).stat.additionsNum)+" additions",1),b.createElementVNode("span",sr,"-"+b.toDisplayString(b.unref(r).stat.deletionsNum)+" deletions",1)])])]),b.unref(l)?(b.openBlock(),b.createBlock(Gt,{key:0,"diff-change":b.unref(r)},null,8,["diff-change"])):(b.openBlock(),b.createBlock(qt,{key:1,"diff-change":b.unref(r)},null,8,["diff-change"]))],4))}});return{install:e=>{e.component("CodeDiff",ar)},hljs:Y}});
14
+ `);if(_===M.DELETE)if(m===M.ADD&&v.length===N.length){for(let y=0;y<v.length;y++){const S=v[y],R=N[y];r++;const T=X(l,ye(R,S,u));a.push({type:M.DELETE,code:T,delNum:r})}for(let y=0;y<N.length;y++){const S=v[y],R=N[y];i++;const T=X(l,ye(S,R,u));a.push({type:M.ADD,code:T,addNum:i})}s=!0}else for(const y of v){r++;const S=X(l,y);a.push({type:M.DELETE,code:S,delNum:r})}if(_===M.ADD)for(const y of v){i++;const S=X(l,y);a.push({type:M.ADD,code:S,addNum:i})}}for(let g=0;g<a.length;g++){const d=a[g];if(d.type===M.DELETE||d.type===M.ADD){const[p,_]=[Math.max(g-h,0),Math.min(g+h+1,a.length)];for(let m=p;m<_;m++)a[m].fold=!1}d.fold===void 0&&(d.fold=!0)}if(e===t){for(let g=0;g<a.length;g++)a[g].fold=!1;return o}const c=[];let f=[];for(let g=0;g<a.length;g++){const d=a[g];if(d.fold===!1){f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),c.push(d);continue}d.type==="equal"&&(d.hide=!0,f.push(d)),c.push(d)}return f.length&&(f[0].hideIndex=o.collector.length,o.collector.push({lines:f,fold:!0}),f=[]),o.changes=c,o}const Ut={key:0},Pt=b.createElementVNode("td",{class:"blob-code blob-code-hunk",align:"left"}," ⋯ ",-1),xt={key:1},Ht=["data-code-marker","innerHTML"],Ft=b.defineComponent({__name:"UnifiedLine",props:{line:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.line.hideIndex!==void 0&&e.line.hide?(b.openBlock(),b.createElementBlock("tr",Ut,[b.createElementVNode("td",{class:"blob-num blob-num-hunk text-center",colspan:"2",onClick:h[0]||(h[0]=n=>t("expand",e.line))}," > "),Pt])):e.line.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",xt,[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.delNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":e.line.type===b.unref(M).DELETE,"blob-num-addition":e.line.type===b.unref(M).ADD,"blob-num-context":e.line.type===b.unref(M).EQUAL,"blob-num-hunk":e.line.hide!==void 0}])},b.toDisplayString(e.line.addNum),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":e.line.type===b.unref(M).DELETE,"blob-code-addition":e.line.type===b.unref(M).ADD,"blob-code-context":e.line.type===b.unref(M).EQUAL,"blob-code-hunk":e.line.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(e.line.type),innerHTML:e.line.code},null,8,Ht)],2)]))}}),zt={class:"diff-table"},Gt=b.defineComponent({__name:"UnifiedViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",zt,[b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(Ft,{key:i,line:r,onExpand:l},null,8,["line"]))),128))])])}}}),Kt={key:0},Vt=b.createElementVNode("td",{class:"blob-code blob-code-inner blob-code-hunk",colspan:"3",align:"left"}," ⋯ ",-1),Wt={key:1},Qt=b.createElementVNode("td",{class:"blob-num blob-num-empty empty-cell"},null,-1),Zt=b.createElementVNode("td",{class:"blob-code blob-code-empty empty-cell"},null,-1),Yt=["data-code-marker","innerHTML"],Xt=b.defineComponent({__name:"SplitLine",props:{splitLine:null},emits:["expand"],setup(e,{emit:t}){const l=u=>u===M.DELETE?"-":u===M.ADD?"+":"";return(u,h)=>e.splitLine.hideIndex!==void 0&&e.splitLine.hide?(b.openBlock(),b.createElementBlock("tr",Kt,[b.createElementVNode("td",{class:"blob-num blob-num-hunk",colspan:"1",onClick:h[0]||(h[0]=n=>t("expand",e.splitLine))}," > "),Vt])):e.splitLine.hide?b.createCommentVNode("",!0):(b.openBlock(),b.createElementBlock("tr",Wt,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList([e.splitLine.left,e.splitLine.right],n=>(b.openBlock(),b.createElementBlock(b.Fragment,null,[n.type===b.unref(M).EMPTY?(b.openBlock(),b.createElementBlock(b.Fragment,{key:0},[Qt,Zt],64)):(b.openBlock(),b.createElementBlock(b.Fragment,{key:1},[b.createElementVNode("td",{class:b.normalizeClass(["blob-num",{"blob-num-deletion":n.type===b.unref(M).DELETE,"blob-num-addition":n.type===b.unref(M).ADD,"blob-num-context":n.type===b.unref(M).EQUAL,"blob-num-hunk":e.splitLine.hide!==void 0}])},b.toDisplayString(n.num),3),b.createElementVNode("td",{class:b.normalizeClass(["blob-code",{"blob-code-deletion":n.type===b.unref(M).DELETE,"blob-code-addition":n.type===b.unref(M).ADD,"blob-code-context":n.type===b.unref(M).EQUAL,"blob-code-hunk":e.splitLine.hide!==void 0}])},[b.createElementVNode("span",{class:"blob-code-inner blob-code-marker","data-code-marker":l(n.type),innerHTML:n.code},null,8,Yt)],2)],64))],64))),256))]))}}),jt={class:"file-diff-split diff-table"},Jt=b.createElementVNode("colgroup",null,[b.createElementVNode("col",{width:"44"}),b.createElementVNode("col"),b.createElementVNode("col",{width:"44"}),b.createElementVNode("col")],-1),qt=b.defineComponent({__name:"SplitViewer",props:{diffChange:null},setup(e){const t=e;function l({hideIndex:u}){u!==void 0&&t.diffChange.collector[u].lines.forEach(h=>{h.hide=!1,h.fold=!1})}return(u,h)=>{var n;return b.openBlock(),b.createElementBlock("table",jt,[Jt,b.createElementVNode("tbody",null,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList((n=e.diffChange)==null?void 0:n.changes,(r,i)=>(b.openBlock(),b.createBlock(Xt,{key:i,"split-line":r,onExpand:l},null,8,["split-line"]))),128))])])}}}),br="",_r="",er={class:"file-header"},nr={class:"file-info"},tr={class:"filename"},rr={class:"diff-stat"},ir={class:"diff-stat-added"},sr={class:"diff-stat-deleted",style:{"margin-left":"8px"}},ar=b.defineComponent({__name:"CodeDiff",props:{newString:null,oldString:null,language:{default:"plaintext"},context:{default:10},diffStyle:{default:"word"},outputFormat:{default:"line-by-line"},trim:{type:Boolean,default:!1},noDiffLineFeed:{type:Boolean,default:!1},maxHeight:{default:void 0},filename:{default:void 0}},setup(e){const t=e,l=b.computed(()=>t.outputFormat==="line-by-line"),u=b.computed(()=>{let i=t.oldString||"";return i=t.trim?i.trim():i,i=t.noDiffLineFeed?i.replace(/(\r\n)/g,`
15
+ `):i,i}),h=b.computed(()=>{let i=t.newString||"";return i=t.trim?i.trim():i,i=t.noDiffLineFeed?i.replace(/(\r\n)/g,`
16
+ `):i,i}),n=b.computed(()=>l.value?$t(u.value,h.value,t.language,t.diffStyle,t.context):Bt(u.value,h.value,t.language,t.diffStyle,t.context)),r=b.ref(n.value);return b.watch(()=>t,()=>{r.value=n.value},{deep:!0}),(i,s)=>(b.openBlock(),b.createElementBlock("div",{class:"code-diff-view",style:b.normalizeStyle({maxHeight:e.maxHeight})},[b.createElementVNode("div",er,[b.createElementVNode("div",nr,[b.createElementVNode("span",tr,b.toDisplayString(e.filename),1),b.createElementVNode("span",rr,[b.createElementVNode("span",ir,"+"+b.toDisplayString(b.unref(r).stat.additionsNum)+" additions",1),b.createElementVNode("span",sr,"-"+b.toDisplayString(b.unref(r).stat.deletionsNum)+" deletions",1)])])]),b.unref(l)?(b.openBlock(),b.createBlock(Gt,{key:0,"diff-change":b.unref(r)},null,8,["diff-change"])):(b.openBlock(),b.createBlock(qt,{key:1,"diff-change":b.unref(r)},null,8,["diff-change"]))],4))}});return{install:e=>{e.component("CodeDiff",ar)},hljs:Y}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-code-diff",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "template component for vue-demi, can dev and build",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.es.js",
package/src/CodeDiff.vue CHANGED
@@ -34,12 +34,16 @@ const props = withDefaults(defineProps<Props>(), {
34
34
  const isUnifiedViewer = computed(() => props.outputFormat === 'line-by-line')
35
35
 
36
36
  const oldString = computed(() => {
37
- const value = props.trim ? props.oldString.trim() : props.oldString
38
- return props.noDiffLineFeed ? value.replace(/(\r\n)/g, '\n') : value
37
+ let value = props.oldString || ''
38
+ value = props.trim ? value.trim() : value
39
+ value = props.noDiffLineFeed ? value.replace(/(\r\n)/g, '\n') : value
40
+ return value
39
41
  })
40
42
  const newString = computed(() => {
41
- const value = props.trim ? props.newString.trim() : props.newString
42
- return props.noDiffLineFeed ? value.replace(/(\r\n)/g, '\n') : value
43
+ let value = props.newString || ''
44
+ value = props.trim ? value.trim() : value
45
+ value = props.noDiffLineFeed ? value.replace(/(\r\n)/g, '\n') : value
46
+ return value
43
47
  })
44
48
 
45
49
  const raw = computed(() =>