-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathdifflib-browser.js
More file actions
7 lines (7 loc) · 26.3 KB
/
difflib-browser.js
File metadata and controls
7 lines (7 loc) · 26.3 KB
1
2
3
4
5
6
7
/**
* @fileoverview Text diff library ported from Python's difflib module.
* https://github.com/qiao/difflib.js
*/
var difflib=(function r(o,i,u){function s(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(l)return l(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return s(o[e][1][t]||t)},n,n.exports,r,o,i,u)}return i[e].exports}for(var l="function"==typeof require&&require,t=0;t<u.length;t++)s(u[t]);return s}({1:[function(a,t,b){!function(){var o,h,i,t,K,z,j,f,u,$,M,p,d,e,g,n,y,m,r,s,l,c=[].indexOf;({floor:g,max:y,min:m}=Math),h=a("heap"),d=a("assert"),f=function(t,e){return e?2*t/e:1},j=function(t,e){var n,r,o,i,u;for([o,i]=[t.length,e.length],n=r=0,u=m(o,i);0<=u?r<u:u<r;n=0<=u?++r:--r){if(t[n]<e[n])return-1;if(t[n]>e[n])return 1}return o-i},p=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},z=function(t){for(var e=0,n=t.length;e<n;e++)if(t[e])return!0;return!1},K=class{constructor(t,e="",n="",r=!0){this.isjunk=t,this.autojunk=r,this.a=this.b=null,this.setSeqs(e,n)}setSeqs(t,e){return this.setSeq1(t),this.setSeq2(e)}setSeq1(t){if(t!==this.a)return this.a=t,this.matchingBlocks=this.opcodes=null}setSeq2(t){if(t!==this.b)return this.b=t,this.matchingBlocks=this.opcodes=null,this.fullbcount=null,this._chainB()}_chainB(){var n,t,e,r,o,i,u,s,l,c,a=this.b;for(this.b2j=n=new Map,e=i=0,u=a.length;i<u;e=++i)t=a[e],n.has(t)||n.set(t,[]),n.get(t).push(e);return o=new Map,(r=this.isjunk)&&n.forEach(function(t,e){if(r(e))return o.set(e,!0),n.delete(e)}),c=new Map,s=a.length,this.autojunk&&200<=s&&(l=g(s/100)+1,n.forEach(function(t,e){if(t.length>l)return c.set(e,!0),n.delete(e)})),this.isbjunk=function(t){return o.has(t)},this.isbpopular=function(t){return c.has(t)}}findLongestMatch(t,e,n,r){var o,i,u,s,l,c,a,f,p,h,g,d,y,m,b,v,w,j;for([o,i,u,f]=[this.a,this.b,this.b2j,this.isbjunk],[s,l,c]=[t,n,0],h={},a=y=w=t,j=e;w<=j?y<j:j<y;a=w<=j?++y:--y){for(v={},g=[],b=0,m=(g=u.has(o[a])?u.get(o[a]):g).length;b<m;b++)if(!((p=g[b])<n)){if(r<=p)break;c<(d=v[p]=(h[p-1]||0)+1)&&([s,l,c]=[a-d+1,p-d+1,d])}h=v}for(;t<s&&n<l&&!f(i[l-1])&&o[s-1]===i[l-1];)[s,l,c]=[s-1,l-1,c+1];for(;s+c<e&&l+c<r&&!f(i[l+c])&&o[s+c]===i[l+c];)c++;for(;t<s&&n<l&&f(i[l-1])&&o[s-1]===i[l-1];)[s,l,c]=[s-1,l-1,c+1];for(;s+c<e&&l+c<r&&f(i[l+c])&&o[s+c]===i[l+c];)c++;return[s,l,c]}getMatchingBlocks(){var t,e,n,r,o,i,u,s,l,c,a,f,p,h,g,d,y,m,b,v,w;if(this.matchingBlocks)return this.matchingBlocks;for([g,d]=[this.a.length,this.b.length],v=[[0,g,0,d]],m=[];v.length;)[e,t,r,n]=v.pop(),[o,s,a]=w=this.findLongestMatch(e,t,r,n),a&&(m.push(w),e<o&&r<s&&v.push([e,o,r,s]),o+a<t&&s+a<n&&v.push([o+a,t,s+a,n]));for(m.sort(j),b=[],h=i=l=f=0,y=m.length;h<y;h++)[u,c,p]=m[h],i+f===u&&l+f===c?f+=p:(f&&b.push([i,l,f]),[i,l,f]=[u,c,p]);return f&&b.push([i,l,f]),b.push([g,d,0]),this.matchingBlocks=b}getOpcodes(){var t,e,n,r,o,i,u,s,l,c;if(this.opcodes)return this.opcodes;for(r=o=0,this.opcodes=e=[],i=0,u=(s=this.getMatchingBlocks()).length;i<u;i++)[t,n,l]=s[i],c="",r<t&&o<n?c="replace":r<t?c="delete":o<n&&(c="insert"),c&&e.push([c,r,t,o,n]),[r,o]=[t+l,n+l],l&&e.push(["equal",t,r,n,o]);return e}getGroupedOpcodes(t=3){var e,n,r,o,i,u,s,l,c,a,f=this.getOpcodes();for("equal"===(f=!f.length?[["equal",0,1,0,1]]:f)[0][0]&&([a,r,o,i,u]=f[0],f[0]=[a,y(r,o-t),o,y(i,u-t),u]),"equal"===f[f.length-1][0]&&([a,r,o,i,u]=f[f.length-1],f[f.length-1]=[a,r,m(o,r+t),i,m(u,i+t)]),c=t+t,n=[],e=[],s=0,l=f.length;s<l;s++)[a,r,o,i,u]=f[s],"equal"===a&&c<o-r&&(e.push([a,r,m(o,r+t),i,m(u,i+t)]),n.push(e),e=[],[r,i]=[y(r,o-t),y(i,u-t)]),e.push([a,r,o,i,u]);return!e.length||1===e.length&&"equal"===e[0][0]||n.push(e),n}ratio(){for(var t=0,e=this.getMatchingBlocks(),n=0,r=e.length;n<r;n++)t+=e[n][2];return f(t,this.a.length+this.b.length)}quickRatio(){var t,e,n,r,o,i,u,s,l,c,a;if(!this.fullbcount)for(this.fullbcount=n={},r=0,o=(c=this.b).length;r<o;r++)n[e=c[r]]=(n[e]||0)+1;for(n=this.fullbcount,t={},u=s=0,i=(a=this.a).length;u<i;u++)e=a[u],l=p(t,e)?t[e]:n[e]||0,t[e]=l-1,0<l&&s++;return f(s,this.a.length+this.b.length)}realQuickRatio(){var t,e;return[t,e]=[this.a.length,this.b.length],f(m(t,e),t+e)}},n=function(t,e,n=3,r=.6){var o,i,u,s,l,c,a,f,p;if(!(0<n))throw new Error(`n must be > 0: (${n})`);if(!(0<=r&&r<=1))throw new Error(`cutoff must be in [0.0, 1.0]: (${r})`);for(l=[],(a=new K).setSeq2(t),o=0,i=e.length;o<i;o++)p=e[o],a.setSeq1(p),a.realQuickRatio()>=r&&a.quickRatio()>=r&&a.ratio()>=r&&l.push([a.ratio(),p]);for(c=[],s=0,u=(l=h.nlargest(l,n,j)).length;s<u;s++)[f,p]=l[s],c.push(p);return c},u=function(t,e){var n,r;for([n,r]=[0,t.length];n<r&&t[n]===e;)n++;return n},o=class{constructor(t,e){this.linejunk=t,this.charjunk=e}compare(t,e){for(var n,r,o,i,u,s,l,c,a,f=[],p=new K(this.linejunk,t,e).getOpcodes(),h=0,g=p.length;h<g;h++){switch([a,r,n,i,o]=p[h],a){case"replace":u=this._fancyReplace(t,r,n,e,i,o);break;case"delete":u=this._dump("-",t,r,n);break;case"insert":u=this._dump("+",e,i,o);break;case"equal":u=this._dump(" ",t,r,n);break;default:throw new Error(`unknow tag (${a})`)}for(c=0,s=u.length;c<s;c++)l=u[c],f.push(l)}return f}_dump(t,e,n,r){for(var o,i,u=[],s=o=i=n,l=r;i<=l?o<l:l<o;s=i<=l?++o:--o)u.push(t+" "+e[s]);return u}_plainReplace(t,e,n,r,o,i){var u,s,l,c,a,f,p,h,g;for(d(e<n&&o<i),i=i-o<n-e?(u=this._dump("+",r,o,i),this._dump("-",t,e,n)):(u=this._dump("-",t,e,n),this._dump("+",r,o,i)),p=[],l=0,c=(g=[u,i]).length;l<c;l++)for(h=0,a=(s=g[l]).length;h<a;h++)f=s[h],p.push(f);return p}_fancyReplace(t,e,n,r,o,i){var u,s,l,c,a,f,p,h,g,d,y,m,b,v,w,j,E,O,q,k,S,x,_,A,D,T,B,R,M,z,$,N,P,C,U,F,I,H,L,J,G,Q,V;for([a,b]=[.74,.75],m=new K(this.charjunk),[v,w]=[null,null],B=[],E=O=P=o,C=i;P<=C?O<C:C<O;E=P<=C?++O:--O)for(h=r[E],m.setSeq2(h),j=R=U=e,F=n;U<=F?R<F:F<R;j=U<=F?++R:--R)(u=t[j])!==h?(m.setSeq1(u),m.realQuickRatio()>a&&m.quickRatio()>a&&m.ratio()>a&&([a,f,p]=[m.ratio(),j,E])):null===v&&([v,w]=[j,E]);if(a<b){if(null===v){for(M=0,S=(I=this._plainReplace(t,e,n,r,o,i)).length;M<S;M++)T=I[M],B.push(T);return B}[f,p,a]=[v,w,1]}else v=null;for(z=0,x=(H=this._fancyHelper(t,e,f,r,o,p)).length;z<x;z++)T=H[z],B.push(T);if([b,o]=[t[f],r[p]],null===v){for(c=y="",m.setSeqs(b,o),$=0,_=(L=m.getOpcodes()).length;$<_;$++)switch([V,s,l,g,d]=L[$],[q,k]=[l-s,d-g],V){case"replace":c+=Array(q+1).join("^"),y+=Array(k+1).join("^");break;case"delete":c+=Array(q+1).join("-");break;case"insert":y+=Array(k+1).join("+");break;case"equal":c+=Array(q+1).join(" "),y+=Array(k+1).join(" ");break;default:throw new Error(`unknow tag (${V})`)}for(N=0,A=(J=this._qformat(b,o,c,y)).length;N<A;N++)T=J[N],B.push(T)}else B.push(" "+b);for(Q=0,D=(G=this._fancyHelper(t,f+1,n,r,p+1,i)).length;Q<D;Q++)T=G[Q],B.push(T);return B}_fancyHelper(t,e,n,r,o,i){var u=[];return e<n?u=o<i?this._fancyReplace(t,e,n,r,o,i):this._dump("-",t,e,n):o<i&&(u=this._dump("+",r,o,i)),u}_qformat(t,e,n,r){var o=[],i=m(u(t,"\t"),u(e,"\t"));return i=m(i,u(n.slice(0,i)," ")),i=m(i,u(r.slice(0,i)," ")),n=n.slice(i).replace(/\s+$/,""),r=r.slice(i).replace(/\s+$/,""),o.push("- "+t),n.length&&o.push(`? ${Array(i+1).join("\t")}${n}
`),o.push("+ "+e),r.length&&o.push(`? ${Array(i+1).join("\t")}${r}
`),o}},t=function(t,e=/^\s*#?\s*$/){return e.test(t)},i=function(t,e=" \t"){return 0<=c.call(e,t)},M=function(t,e){var n=t+1,t=e-t;return 1==t?""+n:(t||n--,n+","+t)},l=function(t,e,{fromfile:n,tofile:r,fromfiledate:o,tofiledate:i,n:u,lineterm:s}={}){var l,c,a,f,p,h,g,d,y,m,b,v,w,j,E,O,q,k,S,x,_,A,D,T,B,R;for(null==n&&(n=""),null==r&&(r=""),null==o&&(o=""),null==i&&(i=""),null==u&&(u=3),null==s&&(s="\n"),T=!(E=[]),g=0,y=(x=new K(null,t,e).getGroupedOpcodes()).length;g<y;g++)for(c=x[g],T||(T=!0,R=i?` `+i:"",E.push("--- "+n+(o?` `+o:"")+s),E.push("+++ "+r+R+s)),[l,d]=[c[0],c[c.length-1]],R=M(l[1],d[2]),d=M(l[3],d[4]),E.push(`@@ -${R} +${d} @@`+s),O=0,m=c.length;O<m;O++)if([B,a,f,p,h]=c[O],"equal"!==B){if("replace"===B||"delete"===B)for(k=0,v=(A=t.slice(a,f)).length;k<v;k++)j=A[k],E.push("-"+j);if("replace"===B||"insert"===B)for(S=0,w=(D=e.slice(p,h)).length;S<w;S++)j=D[S],E.push("+"+j)}else for(q=0,b=(_=t.slice(a,f)).length;q<b;q++)j=_[q],E.push(" "+j);return E},$=function(t,e){var n=t+1,t=e-t;return t||n--,t<=1?""+n:n+","+(n+t-1)},e=function(t,e,{fromfile:n,tofile:r,fromfiledate:o,tofiledate:i,n:u,lineterm:s}={}){var l,c,a,f,p,h,g,d,y,m,b,v,w,j,E,O,q,k,S,x,_,A,D,T,B,R,M;for(null==n&&(n=""),null==r&&(r=""),null==o&&(o=""),null==i&&(i=""),null==u&&(u=3),null==s&&(s="\n"),B=!(x={insert:"+ ",delete:"- ",replace:"! ",equal:" "}),O=[],d=0,m=(A=new K(null,t,e).getGroupedOpcodes()).length;d<m;d++)if(a=A[d],!B){if(B=!0,M=i?` `+i:"",O.push("*** "+n+(o?` `+o:"")+s),O.push("--- "+r+M+s),[c,y]=[a[0],a[a.length-1]],O.push("***************"+s),M=$(c[1],y[2]),O.push(`*** ${M} ****`+s),z(function(){for(var t=[],e=0,n=a.length;e<n;e++)[R,l,l,l,l]=a[e],t.push("replace"===R||"delete"===R);return t}()))for(q=0,b=a.length;q<b;q++)if([R,f,p,l,l]=a[q],"insert"!==R)for(k=0,v=(D=t.slice(f,p)).length;k<v;k++)E=D[k],O.push(x[R]+E);if(y=$(c[3],y[4]),O.push(`--- ${y} ----`+s),z(function(){for(var t=[],e=0,n=a.length;e<n;e++)[R,l,l,l,l]=a[e],t.push("replace"===R||"insert"===R);return t}()))for(S=0,w=a.length;S<w;S++)if([R,l,l,h,g]=a[S],"delete"!==R)for(_=0,j=(T=e.slice(h,g)).length;_<j;_++)E=T[_],O.push(x[R]+E)}return O},r=function(t,e,n,r=i){return new o(n,r).compare(t,e)},s=function(t,e){var n,r,o,i,u,s,l={1:"- ",2:"+ "}[e];if(!l)throw new Error("unknow delta choice (must be 1 or 2): "+e);for(u=[" ",l],i=[],n=0,r=t.length;n<r;n++)s=(o=t[n]).slice(0,2),0<=c.call(u,s)&&i.push(o.slice(2));return i},b._arrayCmp=j,b.SequenceMatcher=K,b.getCloseMatches=n,b._countLeading=u,b.Differ=o,b.IS_LINE_JUNK=t,b.IS_CHARACTER_JUNK=i,b._formatRangeUnified=M,b.unifiedDiff=l,b._formatRangeContext=$,b.contextDiff=e,b.ndiff=r,b.restore=s}.call(this)},{assert:2,heap:6}],2:[function(E,O,t){!function(j){!function(){"use strict";var t=E("object-assign");function i(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0}function u(t){return j.Buffer&&"function"==typeof j.Buffer.isBuffer?j.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var a=E("util/"),r=Object.prototype.hasOwnProperty,f=Array.prototype.slice,e="foo"===function(){}.name;function s(t){return Object.prototype.toString.call(t)}function l(t){return!u(t)&&("function"==typeof j.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var c=O.exports=d,n=/\s*function\s+([^\(\s]*)\s*/;function o(t){if(a.isFunction(t)){if(e)return t.name;t=t.toString().match(n);return t&&t[1]}}function p(t,e){return"string"!=typeof t||t.length<e?t:t.slice(0,e)}function h(t){if(e||!a.isFunction(t))return a.inspect(t);t=o(t);return"[Function"+(t?": "+t:"")+"]"}function g(t,e,n,r,o){throw new c.AssertionError({message:n,actual:t,expected:e,operator:r,stackStartFunction:o})}function d(t,e){t||g(t,!0,e,"==",c.ok)}function y(t,e,n,r){if(t===e)return!0;if(u(t)&&u(e))return 0===i(t,e);if(a.isDate(t)&&a.isDate(e))return t.getTime()===e.getTime();if(a.isRegExp(t)&&a.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(l(t)&&l(e)&&s(t)===s(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(u(t)!==u(e))return!1;var o=(r=r||{actual:[],expected:[]}).actual.indexOf(t);return-1!==o&&o===r.expected.indexOf(e)||(r.actual.push(t),r.expected.push(e),function(t,e,n,r){if(null==t||null==e)return!1;if(a.isPrimitive(t)||a.isPrimitive(e))return t===e;if(n&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var o=m(t),i=m(e);if(o&&!i||!o&&i)return!1;if(o)return t=f.call(t),e=f.call(e),y(t,e,n);var u,s,l=w(t),c=w(e);if(l.length!==c.length)return!1;for(l.sort(),c.sort(),s=l.length-1;0<=s;s--)if(l[s]!==c[s])return!1;for(s=l.length-1;0<=s;s--)if(u=l[s],!y(t[u],e[u],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function m(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function b(t,e){if(t&&e){if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return 1}catch(t){}return Error.isPrototypeOf(e)?void 0:!0===e.call({},t)}}function v(t,e,n,r){var o;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!o&&g(o,n,"Missing expected exception"+r);var i="string"==typeof r,e=!t&&o&&!n;if((!t&&a.isError(o)&&i&&b(o,n)||e)&&g(o,n,"Got unwanted exception"+r),t&&o&&n&&!b(o,n)||!t&&o)throw o}c.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=p(h((e=this).actual),128)+" "+e.operator+" "+p(h(e.expected),128),this.generatedMessage=!0);var e=t.stackStartFunction||g;Error.captureStackTrace?Error.captureStackTrace(this,e):(t=new Error).stack&&(t=t.stack,e=o(e),0<=(e=t.indexOf("\n"+e))&&(e=t.indexOf("\n",e+1),t=t.substring(e+1)),this.stack=t)},a.inherits(c.AssertionError,Error),c.fail=g,c.ok=d,c.equal=function(t,e,n){t!=e&&g(t,e,n,"==",c.equal)},c.notEqual=function(t,e,n){t==e&&g(t,e,n,"!=",c.notEqual)},c.deepEqual=function(t,e,n){y(t,e,!1)||g(t,e,n,"deepEqual",c.deepEqual)},c.deepStrictEqual=function(t,e,n){y(t,e,!0)||g(t,e,n,"deepStrictEqual",c.deepStrictEqual)},c.notDeepEqual=function(t,e,n){y(t,e,!1)&&g(t,e,n,"notDeepEqual",c.notDeepEqual)},c.notDeepStrictEqual=function t(e,n,r){y(e,n,!0)&&g(e,n,r,"notDeepStrictEqual",t)},c.strictEqual=function(t,e,n){t!==e&&g(t,e,n,"===",c.strictEqual)},c.notStrictEqual=function(t,e,n){t===e&&g(t,e,n,"!==",c.notStrictEqual)},c.throws=function(t,e,n){v(!0,t,e,n)},c.doesNotThrow=function(t,e,n){v(!1,t,e,n)},c.ifError=function(t){if(t)throw t},c.strict=t(function t(e,n){e||g(e,!0,n,"==",t)},c,{equal:c.strictEqual,deepEqual:c.deepStrictEqual,notEqual:c.notStrictEqual,notDeepEqual:c.notDeepStrictEqual}),c.strict.strict=c.strict;var w=Object.keys||function(t){var e,n=[];for(e in t)r.call(t,e)&&n.push(e);return n}}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":8,"util/":5}],3:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;function n(){}n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],4:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],5:[function(S,t,x){!function(q,k){!function(){var s=/%[sdj%]/g;x.format=function(t){if(!y(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(l(arguments[n]));return e.join(" ")}for(var n=1,r=arguments,o=r.length,i=String(t).replace(s,function(t){if("%%"===t)return"%";if(o<=n)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),u=r[n];n<o;u=r[++n])g(u)||!v(u)?i+=" "+u:i+=" "+l(u);return i},x.deprecate=function(t,e){if(m(k.process))return function(){return x.deprecate(t,e).apply(this,arguments)};if(!0===q.noDeprecation)return t;var n=!1;return function(){if(!n){if(q.throwDeprecation)throw new Error(e);q.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}};var t,r={};function l(t,e){var n={seen:[],stylize:i};return 3<=arguments.length&&(n.depth=arguments[2]),4<=arguments.length&&(n.colors=arguments[3]),h(e)?n.showHidden=e:e&&x._extend(n,e),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),c(n,t,n.depth)}function o(t,e){e=l.styles[e];return e?"["+l.colors[e][0]+"m"+t+"["+l.colors[e][1]+"m":t}function i(t,e){return t}function c(e,n,r){if(e.customInspect&&n&&E(n.inspect)&&n.inspect!==x.inspect&&(!n.constructor||n.constructor.prototype!==n)){var t=n.inspect(r,e);return t=!y(t)?c(e,t,r):t}var o=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(y(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return d(e)?t.stylize(""+e,"number"):h(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}(e,n);if(o)return o;var i,t=Object.keys(n),u=(i={},t.forEach(function(t,e){i[t]=!0}),i);if(e.showHidden&&(t=Object.getOwnPropertyNames(n)),j(n)&&(0<=t.indexOf("message")||0<=t.indexOf("description")))return a(n);if(0===t.length){if(E(n)){var s=n.name?": "+n.name:"";return e.stylize("[Function"+s+"]","special")}if(b(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return e.stylize(Date.prototype.toString.call(n),"date");if(j(n))return a(n)}var o="",l=!1,s=["{","}"];return p(n)&&(l=!0,s=["[","]"]),E(n)&&(o=" [Function"+(n.name?": "+n.name:"")+"]"),b(n)&&(o=" "+RegExp.prototype.toString.call(n)),w(n)&&(o=" "+Date.prototype.toUTCString.call(n)),j(n)&&(o=" "+a(n)),0!==t.length||l&&0!=n.length?r<0?b(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),t=l?function(e,n,r,o,t){for(var i=[],u=0,s=n.length;u<s;++u)O(n,String(u))?i.push(f(e,n,r,o,String(u),!0)):i.push("");return t.forEach(function(t){t.match(/^\d+$/)||i.push(f(e,n,r,o,t,!0))}),i}(e,n,r,u,t):t.map(function(t){return f(e,n,r,u,t,l)}),e.seen.pop(),function(t,e,n){if(60<t.reduce(function(t,e){return 0<=e.indexOf("\n")&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0))return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(t,o,s)):s[0]+o+s[1]}function a(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,o,i){var u,s,e=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]};if(e.get?s=e.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):e.set&&(s=t.stylize("[Setter]","special")),O(r,o)||(u="["+o+"]"),s||(t.seen.indexOf(e.value)<0?-1<(s=g(n)?c(t,e.value,null):c(t,e.value,n-1)).indexOf("\n")&&(s=i?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n")):s=t.stylize("[Circular]","special")),m(u)){if(i&&o.match(/^\d+$/))return s;u=(u=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),t.stylize(u,"string"))}return u+": "+s}function p(t){return Array.isArray(t)}function h(t){return"boolean"==typeof t}function g(t){return null===t}function d(t){return"number"==typeof t}function y(t){return"string"==typeof t}function m(t){return void 0===t}function b(t){return v(t)&&"[object RegExp]"===e(t)}function v(t){return"object"==typeof t&&null!==t}function w(t){return v(t)&&"[object Date]"===e(t)}function j(t){return v(t)&&("[object Error]"===e(t)||t instanceof Error)}function E(t){return"function"==typeof t}function e(t){return Object.prototype.toString.call(t)}function n(t){return t<10?"0"+t.toString(10):t.toString(10)}x.debuglog=function(e){var n;return m(t)&&(t=q.env.NODE_DEBUG||""),e=e.toUpperCase(),r[e]||(new RegExp("\\b"+e+"\\b","i").test(t)?(n=q.pid,r[e]=function(){var t=x.format.apply(x,arguments);console.error("%s %d: %s",e,n,t)}):r[e]=function(){}),r[e]},(x.inspect=l).colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},x.isArray=p,x.isBoolean=h,x.isNull=g,x.isNullOrUndefined=function(t){return null==t},x.isNumber=d,x.isString=y,x.isSymbol=function(t){return"symbol"==typeof t},x.isUndefined=m,x.isRegExp=b,x.isObject=v,x.isDate=w,x.isError=j,x.isFunction=E,x.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},x.isBuffer=S("./support/isBuffer");var u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(t,e){return Object.prototype.hasOwnProperty.call(t,e)}x.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[n(t.getHours()),n(t.getMinutes()),n(t.getSeconds())].join(":"),[t.getDate(),u[t.getMonth()],e].join(" ")),x.format.apply(x,arguments))},x.inherits=S("inherits"),x._extend=function(t,e){if(!e||!v(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}.call(this)}.call(this,S("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":4,_process:9,inherits:3}],6:[function(t,e,n){e.exports=t("./lib/heap")},{"./lib/heap":7}],7:[function(t,s,m){!function(){var t,p,l,h,g,e,c,n,d,y,r,a,f,o,i;function u(t){this.cmp=null!=t?t:p,this.nodes=[]}l=Math.floor,y=Math.min,p=function(t,e){return t<e?-1:e<t?1:0},d=function(t,e,n,r,o){var i;if(null==o&&(o=p),(n=null==n?0:n)<0)throw new Error("lo must be non-negative");for(null==r&&(r=t.length);n<r;)o(e,t[i=l((n+r)/2)])<0?r=i:n=i+1;return[].splice.apply(t,[n,n-n].concat(e)),e},g=function(t,e){var n,r;return null==e&&(e=p),n=t.pop(),t.length?(r=t[0],t[0]=n,f(t,0,e)):r=n,r},n=function(t,e,n){var r;return null==n&&(n=p),r=t[0],t[0]=e,f(t,0,n),r},c=function(t,e,n){var r;return null==n&&(n=p),t.length&&n(t[0],e)<0&&(e=(r=[t[0],e])[0],t[0]=r[1],f(t,0,n)),e},h=function(n,t){var e,r,o,i,u,s;for(null==t&&(t=p),u=[],r=0,o=(i=function(){s=[];for(var t=0,e=l(n.length/2);0<=e?t<e:e<t;0<=e?t++:t--)s.push(t);return s}.apply(this).reverse()).length;r<o;r++)e=i[r],u.push(f(n,e,t));return u},r=function(t,e,n){if(null==n&&(n=p),-1!==(e=t.indexOf(e)))return a(t,0,e,n),f(t,e,n)},o=function(t,e,n){var r,o,i,u,s;if(null==n&&(n=p),!(o=t.slice(0,e)).length)return o;for(h(o,n),i=0,u=(s=t.slice(e)).length;i<u;i++)r=s[i],c(o,r,n);return o.sort(n).reverse()},i=function(t,e,n){var r,o,i,u,s,l,c,a,f;if(null==n&&(n=p),10*e<=t.length){if(!(i=t.slice(0,e).sort(n)).length)return i;for(o=i[i.length-1],u=0,l=(c=t.slice(e)).length;u<l;u++)n(r=c[u],o)<0&&(d(i,r,0,null,n),i.pop(),o=i[i.length-1]);return i}for(h(t,n),f=[],s=0,a=y(e,t.length);0<=a?s<a:a<s;0<=a?++s:--s)f.push(g(t,n));return f},a=function(t,e,n,r){var o,i,u;for(null==r&&(r=p),o=t[n];e<n&&r(o,i=t[u=n-1>>1])<0;)t[n]=i,n=u;return t[n]=o},f=function(t,e,n){var r,o,i,u,s;for(null==n&&(n=p),o=t.length,i=t[s=e],r=2*e+1;r<o;)(u=r+1)<o&&!(n(t[r],t[u])<0)&&(r=u),t[e]=t[r],r=2*(e=r)+1;return t[e]=i,a(t,s,e,n)},u.push=e=function(t,e,n){return null==n&&(n=p),t.push(e),a(t,0,t.length-1,n)},u.pop=g,u.replace=n,u.pushpop=c,u.heapify=h,u.updateItem=r,u.nlargest=o,u.nsmallest=i,u.prototype.push=function(t){return e(this.nodes,t,this.cmp)},u.prototype.pop=function(){return g(this.nodes,this.cmp)},u.prototype.peek=function(){return this.nodes[0]},u.prototype.contains=function(t){return-1!==this.nodes.indexOf(t)},u.prototype.replace=function(t){return n(this.nodes,t,this.cmp)},u.prototype.pushpop=function(t){return c(this.nodes,t,this.cmp)},u.prototype.heapify=function(){return h(this.nodes,this.cmp)},u.prototype.updateItem=function(t){return r(this.nodes,t,this.cmp)},u.prototype.clear=function(){return this.nodes=[]},u.prototype.empty=function(){return 0===this.nodes.length},u.prototype.size=function(){return this.nodes.length},u.prototype.clone=function(){var t=new u;return t.nodes=this.nodes.slice(0),t},u.prototype.toArray=function(){return this.nodes.slice(0)},u.prototype.insert=u.prototype.push,u.prototype.top=u.prototype.peek,u.prototype.front=u.prototype.peek,u.prototype.has=u.prototype.contains,u.prototype.copy=u.prototype.clone,t=u,o=this,i=function(){return t},"function"==typeof define&&define.amd?define([],i):"object"==typeof m?s.exports=t:o.Heap=t}.call(this)},{}],8:[function(t,e,n){"use strict";var l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},r)).join("")?void 0:1}catch(t){return}}()?Object.assign:function(t,e){for(var n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var i in n=Object(arguments[o]))c.call(n,i)&&(r[i]=n[i]);if(l)for(var u=l(n),s=0;s<u.length;s++)a.call(n,u[s])&&(r[u[s]]=n[u[s]])}return r}},{}],9:[function(t,e,n){var r,o,e=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(t){o=u}}();var l,c=[],a=!1,f=-1;function p(){a&&l&&(a=!1,l.length?c=l.concat(c):f=-1,c.length&&h())}function h(){if(!a){var t=s(p);a=!0;for(var e=c.length;e;){for(l=c,c=[];++f<e;)l&&l[f].run();f=-1,e=c.length}l=null,a=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function d(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new g(t,e)),1!==c.length||a||s(h)},g.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=d,e.addListener=d,e.once=d,e.off=d,e.removeListener=d,e.removeAllListeners=d,e.emit=d,e.prependListener=d,e.prependOnceListener=d,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}]},{},[1]),require("/difflib"));