antosdk-apps/AceDiff/build/debug/main.js

1 line
34 KiB
JavaScript
Raw Normal View History

(function(){}).call(this),parcelRequire=function(t,e,n,i){var r,s="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function a(n,i){if(!e[n]){if(!t[n]){var r="function"==typeof parcelRequire&&parcelRequire;if(!i&&r)return r(n,!0);if(s)return s(n,!0);if(o&&"string"==typeof n)return o(n);var f=new Error("Cannot find module '"+n+"'");throw f.code="MODULE_NOT_FOUND",f}l.resolve=function(e){return t[n][1][e]||e},l.cache={};var h=e[n]=new a.Module(n);t[n][0].call(h.exports,l,h,h.exports,this)}return e[n].exports;function l(t){return a(l.resolve(t))}}a.isParcelRequire=!0,a.Module=function(t){this.id=t,this.bundle=a,this.exports={}},a.modules=t,a.cache=e,a.parent=s,a.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]};for(var f=0;f<n.length;f++)try{a(n[f])}catch(t){r||(r=t)}if(n.length){var h=a(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd?define((function(){return h})):this.AceDiff=h}if(parcelRequire=a,r)throw r;return a}({k8CM:[function(t,e,n){var i=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1;i.Diff=function(t,e){return[t,e]},i.prototype.diff_main=function(t,e,n,r){void 0===r&&(r=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var s=r;if(null==t||null==e)throw new Error("Null input. (diff_main)");if(t==e)return t?[new i.Diff(0,t)]:[];void 0===n&&(n=!0);var o=n,a=this.diff_commonPrefix(t,e),f=t.substring(0,a);t=t.substring(a),e=e.substring(a),a=this.diff_commonSuffix(t,e);var h=t.substring(t.length-a);t=t.substring(0,t.length-a),e=e.substring(0,e.length-a);var l=this.diff_compute_(t,e,o,s);return f&&l.unshift(new i.Diff(0,f)),h&&l.push(new i.Diff(0,h)),this.diff_cleanupMerge(l),l},i.prototype.diff_compute_=function(t,e,n,s){var o;if(!t)return[new i.Diff(1,e)];if(!e)return[new i.Diff(r,t)];var a=t.length>e.length?t:e,f=t.length>e.length?e:t,h=a.indexOf(f);if(-1!=h)return o=[new i.Diff(1,a.substring(0,h)),new i.Diff(0,f),new i.Diff(1,a.substring(h+f.length))],t.length>e.length&&(o[0][0]=o[2][0]=r),o;if(1==f.length)return[new i.Diff(r,t),new i.Diff(1,e)];var l=this.diff_halfMatch_(t,e);if(l){var c=l[0],g=l[1],u=l[2],d=l[3],p=l[4],_=this.diff_main(c,u,n,s),m=this.diff_main(g,d,n,s);return _.concat([new i.Diff(0,p)],m)}return n&&t.length>100&&e.length>100?this.diff_lineMode_(t,e,s):this.diff_bisect_(t,e,s)},i.prototype.diff_lineMode_=function(t,e,n){var s=this.diff_linesToChars_(t,e);t=s.chars1,e=s.chars2;var o=s.lineArray,a=this.diff_main(t,e,!1,n);this.diff_charsToLines_(a,o),this.diff_cleanupSemantic(a),a.push(new i.Diff(0,""));for(var f=0,h=0,l=0,c="",g="";f<a.length;){switch(a[f][0]){case 1:l++,g+=a[f][1];break;case r:h++,c+=a[f][1];break;case 0:if(h>=1&&l>=1){a.splice(f-h-l,h+l),f=f-h-l;for(var u=this.diff_main(c,g,!1,n),d=u.length-1;d>=0;d--)a.splice(f,0,u[d]);f+=u.length}l=0,h=0,c="",g=""}f++}return a.pop(),a},i.prototype.diff_bisect_=function(t,e,n){for(var s=t.length,o=e.length,a=Math.ceil((s+o)/2),f=a,h=2*a,l=new Array(h),c=new Array(h),g=0;g<h;g++)l[g]=-1,c[g]=-1;l[f+1]=0,c[f+1]=0;for(var u=s-o,d=u%2!=0,p=0,_=0,m=0,v=0,b=0;b<a&&!((new Date).getTime()>n);b++){for(var L=-b+p;L<=b-_;L+=2){for(var y=f+L,E=(C=L==-b||L!=b&&l[y-1]<l[y+1]?l[y+1]:l[y-1]+1)-L;C<s&&E<o&&t.charAt(C)==e.charAt(E);)C++,E++;if(l[y]=C,C>s)_+=2;else if(E>o)p+=2;else if(d&&(x=f+u-L)>=0&&x<h&&-1!=c[x]&&C>=(D=s-c[x]))return this.diff_bisectSplit_(t,e,C,E,n)}for(var w=-b+m;w<=b-v;w+=2){for(var D,x=f+w,S=(D=w==-b||w!=b&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-w;D<s&&S<o&&t.charAt(s-D-1)==e.charAt(o-S-1);)D++,S++;if(c[x]=D,D>s)v+=2;else if(S>o)m+=2;else if(!d){var C;if((y=f+u-w)>=0&&y<h&&-1!=l[y]&&(E=f+(C=l[y])-y,C>=(D=s-D)))return this.diff_bisectSplit_(t,e,C,E,n)}}}return[new i.Diff(r,t),new i.Diff(1,e)]},i.prototype.diff_bisectSplit_=function(t,e,n,i,r){var s=t.substring(0,n),o=e.substring(0,i),a=t.substring(n),f=e.substring(i),h=this.diff_main(s,o,!1,r),l=this.diff_main(a,f,!1,r)