!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jsondiffpatch=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;on.length?t:n,f=t.length>n.length?n:t,a=r.indexOf(f);if(-1!=a)return h=[[DIFF_INSERT,r.substring(0,a)],[DIFF_EQUAL,f],[DIFF_INSERT,r.substring(a+f.length)]],t.length>n.length&&(h[0][0]=h[2][0]=DIFF_DELETE),h;if(1==f.length)return[[DIFF_DELETE,t],[DIFF_INSERT,n]];r=f=null;var s=this.diff_halfMatch_(t,n);if(s){var l=s[0],g=s[1],c=s[2],_=s[3],o=s[4],u=this.diff_main(l,c,e,i),p=this.diff_main(g,_,e,i);return u.concat([[DIFF_EQUAL,o]],p)}return e&&t.length>100&&n.length>100?this.diff_lineMode_(t,n,i):this.diff_bisect_(t,n,i)},diff_match_patch.prototype.diff_lineMode_=function(t,n,e){var i=this.diff_linesToChars_(t,n);t=i[0],n=i[1];var h=i[2],r=this.diff_bisect_(t,n,e);this.diff_charsToLines_(r,h),this.diff_cleanupSemantic(r),r.push([DIFF_EQUAL,""]);for(var f=0,a=0,s=0,l="",g="";f=1&&s>=1){var i=this.diff_main(l,g,!1,e);r.splice(f-a-s,a+s),f=f-a-s;for(var c=i.length-1;c>=0;c--)r.splice(f,0,i[c]);f+=i.length}s=0,a=0,l="",g=""}f++}return r.pop(),r},diff_match_patch.prototype.diff_bisect_=function(t,n,e){for(var i=t.length,h=n.length,r=Math.ceil((i+h)/2),f=r,a=2*r,s=new Array(a),l=new Array(a),g=0;a>g;g++)s[g]=-1,l[g]=-1;s[f+1]=0,l[f+1]=0;for(var c=i-h,_=c%2!=0,o=0,u=0,p=0,d=0,F=0;r>F&&!((new Date).getTime()>e);F++){for(var E=-F+o;F-u>=E;E+=2){var D,I=f+E;D=E==-F||E!=F&&s[I-1]D&&h>m&&t.charAt(D)==n.charAt(m);)D++,m++;if(s[I]=D,D>i)u+=2;else if(m>h)o+=2;else if(_){var b=f+c-E;if(b>=0&&a>b&&-1!=l[b]){var v=i-l[b];if(D>=v)return this.diff_bisectSplit_(t,n,D,m,e)}}}for(var L=-F+p;F-d>=L;L+=2){var v,b=f+L;v=L==-F||L!=F&&l[b-1]v&&h>T&&t.charAt(i-v-1)==n.charAt(h-T-1);)v++,T++;if(l[b]=v,v>i)d+=2;else if(T>h)p+=2;else if(!_){var I=f+c-L;if(I>=0&&a>I&&-1!=s[I]){var D=s[I],m=f+D-I;if(v=i-v,D>=v)return this.diff_bisectSplit_(t,n,D,m,e)}}}}return[[DIFF_DELETE,t],[DIFF_INSERT,n]]},diff_match_patch.prototype.diff_bisectSplit_=function(t,n,e,i,h){var r=t.substring(0,e),f=n.substring(0,i),a=t.substring(e),s=n.substring(i),l=this.diff_main(r,f,!1,h),g=this.diff_main(a,s,!1,h);return l.concat(g)},diff_match_patch.prototype.diff_linesToChars_=function(t,n){function e(t){for(var n="",e=0,r=-1,f=i.length;re;)t.substring(r,h)==n.substring(r,h)?(e=h,r=e):i=h,h=Math.floor((i-e)/2+e);return h},diff_match_patch.prototype.diff_commonSuffix=function(t,n){if(!t||!n||t.charAt(t.length-1)!=n.charAt(n.length-1))return 0;for(var e=0,i=Math.min(t.length,n.length),h=i,r=0;h>e;)t.substring(t.length-h,t.length-r)==n.substring(n.length-h,n.length-r)?(e=h,r=e):i=h,h=Math.floor((i-e)/2+e);return h},diff_match_patch.prototype.diff_commonOverlap_=function(t,n){var e=t.length,i=n.length;if(0==e||0==i)return 0;e>i?t=t.substring(e-i):i>e&&(n=n.substring(0,e));var h=Math.min(e,i);if(t==n)return h;for(var r=0,f=1;;){var a=t.substring(h-f),s=n.indexOf(a);if(-1==s)return r;f+=s,0!=s&&t.substring(h-f)!=n.substring(0,f)||(r=f,f++)}},diff_match_patch.prototype.diff_halfMatch_=function(t,n){function e(t,n,e){for(var i,h,r,a,s=t.substring(e,e+Math.floor(t.length/4)),l=-1,g="";-1!=(l=n.indexOf(s,l+1));){var c=f.diff_commonPrefix(t.substring(e),n.substring(l)),_=f.diff_commonSuffix(t.substring(0,e),n.substring(0,l));g.length<_+c&&(g=n.substring(l-_,l)+n.substring(l,l+c),i=t.substring(0,e-_),h=t.substring(e+c),r=n.substring(0,l-_),a=n.substring(l+c))}return 2*g.length>=t.length?[i,h,r,a,g]:null}if(this.Diff_Timeout<=0)return null;var i=t.length>n.length?t:n,h=t.length>n.length?n:t;if(i.length<4||2*h.lengths[4].length?a:s:a;var l,g,c,_;t.length>n.length?(l=r[0],g=r[1],c=r[2],_=r[3]):(c=r[0],_=r[1],l=r[2],g=r[3]);var o=r[4];return[l,g,c,_,o]},diff_match_patch.prototype.diff_cleanupSemantic=function(t){for(var n=!1,e=[],i=0,h=null,r=0,f=0,a=0,s=0,l=0;r0?e[i-1]:-1,f=0,a=0,s=0,l=0,h=null,n=!0)),r++;for(n&&this.diff_cleanupMerge(t),this.diff_cleanupSemanticLossless(t),r=1;r=g.length/2||_>=c.length/2)&&(t.splice(r,0,[DIFF_EQUAL,c.substring(0,_)]),t[r-1][1]=g.substring(0,g.length-_),t[r+1][1]=c.substring(_),r++),r++}r++}},diff_match_patch.prototype.diff_cleanupSemanticLossless=function(t){function n(t,n){if(!t||!n)return 5;var a=0;return(t.charAt(t.length-1).match(e)||n.charAt(0).match(e))&&(a++,(t.charAt(t.length-1).match(i)||n.charAt(0).match(i))&&(a++,(t.charAt(t.length-1).match(h)||n.charAt(0).match(h))&&(a++,(t.match(r)||n.match(f))&&a++))),a}for(var e=/[^a-zA-Z0-9]/,i=/\s/,h=/[\r\n]/,r=/\n\r?\n$/,f=/^\r?\n\r?\n/,a=1;a=d&&(d=F,o=s,u=l,p=g)}t[a-1][1]!=o&&(o?t[a-1][1]=o:(t.splice(a-1,1),a--),t[a][1]=u,p?t[a+1][1]=p:(t.splice(a+1,1),a--))}a++}},diff_match_patch.prototype.diff_cleanupEfficiency=function(t){for(var n=!1,e=[],i=0,h="",r=0,f=!1,a=!1,s=!1,l=!1;r0?e[i-1]:-1,s=l=!1),n=!0)),r++;n&&this.diff_cleanupMerge(t)},diff_match_patch.prototype.diff_cleanupMerge=function(t){t.push([DIFF_EQUAL,""]);for(var n,e=0,i=0,h=0,r="",f="";e1?(0!==i&&0!==h&&(n=this.diff_commonPrefix(f,r),0!==n&&(e-i-h>0&&t[e-i-h-1][0]==DIFF_EQUAL?t[e-i-h-1][1]+=f.substring(0,n):(t.splice(0,0,[DIFF_EQUAL,f.substring(0,n)]),e++),f=f.substring(n),r=r.substring(n)),n=this.diff_commonSuffix(f,r),0!==n&&(t[e][1]=f.substring(f.length-n)+t[e][1],f=f.substring(0,f.length-n),r=r.substring(0,r.length-n))),0===i?t.splice(e-i-h,i+h,[DIFF_INSERT,f]):0===h?t.splice(e-i-h,i+h,[DIFF_DELETE,r]):t.splice(e-i-h,i+h,[DIFF_DELETE,r],[DIFF_INSERT,f]),e=e-i-h+(i?1:0)+(h?1:0)+1):0!==e&&t[e-1][0]==DIFF_EQUAL?(t[e-1][1]+=t[e][1],t.splice(e,1)):e++,h=0,i=0,r="",f=""}""===t[t.length-1][1]&&t.pop();var a=!1;for(e=1;en));e++)r=i,f=h;return t.length!=e&&t[e][0]===DIFF_DELETE?f:f+(n-r)},diff_match_patch.prototype.diff_prettyHtml=function(t){for(var n=[],e=0,i=/&/g,h=//g,f=/\n/g,a=0;a");switch(s){case DIFF_INSERT:n[a]=''+g+"";break;case DIFF_DELETE:n[a]=''+g+"";break;case DIFF_EQUAL:n[a]=""+g+""}s!==DIFF_DELETE&&(e+=l.length)}return n.join("")},diff_match_patch.prototype.diff_text1=function(t){for(var n=[],e=0;ethis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var h=this.match_alphabet_(n),r=this,f=this.Match_Threshold,a=t.indexOf(n,e);-1!=a&&(f=Math.min(i(0,a),f),a=t.lastIndexOf(n,e+n.length),-1!=a&&(f=Math.min(i(0,a),f)));var s=1<l;)i(o,e+g)<=f?l=g:_=g,g=Math.floor((_-l)/2+l);_=g;var u=Math.max(1,e-g+1),p=Math.min(e+g,t.length)+n.length,d=Array(p+2);d[p+1]=(1<=u;F--){var E=h[t.charAt(F-1)];if(0===o?d[F]=(d[F+1]<<1|1)&E:d[F]=(d[F+1]<<1|1)&E|((c[F+1]|c[F])<<1|1)|c[F+1],d[F]&s){var D=i(o,F-1);if(f>=D){if(f=D,a=F-1,!(a>e))break;u=Math.max(1,2*e-a)}}}if(i(o+1,e)>f)break;c=d}return a},diff_match_patch.prototype.match_alphabet_=function(t){for(var n={},e=0;e2&&(this.diff_cleanupSemantic(h),this.diff_cleanupEfficiency(h));else if(t&&"object"==typeof t&&"undefined"==typeof n&&"undefined"==typeof e)h=t,i=this.diff_text1(h);else if("string"==typeof t&&n&&"object"==typeof n&&"undefined"==typeof e)i=t,h=n;else{if("string"!=typeof t||"string"!=typeof n||!e||"object"!=typeof e)throw new Error("Unknown call format to patch_make.");i=t,h=e}if(0===h.length)return[];for(var r=[],f=new diff_match_patch.patch_obj,a=0,s=0,l=0,g=i,c=i,_=0;_=2*this.Patch_Margin&&a&&(this.patch_addContext_(f,g),r.push(f),f=new diff_match_patch.patch_obj,a=0,g=c,s=l)}o!==DIFF_INSERT&&(s+=u.length),o!==DIFF_DELETE&&(l+=u.length)}return a&&(this.patch_addContext_(f,g),r.push(f)),r},diff_match_patch.prototype.patch_deepCopy=function(t){for(var n=[],e=0;ethis.Match_MaxBits?(f=this.match_main(n,s.substring(0,this.Match_MaxBits),a),-1!=f&&(l=this.match_main(n,s.substring(s.length-this.Match_MaxBits),a+s.length-this.Match_MaxBits),(-1==l||f>=l)&&(f=-1))):f=this.match_main(n,s,a),-1==f)h[r]=!1,i-=t[r].length2-t[r].length1;else{h[r]=!0,i=f-a;var g;if(g=-1==l?n.substring(f,f+s.length):n.substring(f,l+this.Match_MaxBits),s==g)n=n.substring(0,f)+this.diff_text2(t[r].diffs)+n.substring(f+s.length);else{var c=this.diff_main(s,g,!1);if(s.length>this.Match_MaxBits&&this.diff_levenshtein(c)/s.length>this.Patch_DeleteThreshold)h[r]=!1;else{this.diff_cleanupSemanticLossless(c);for(var _,o=0,u=0;u=i;i++)e+=String.fromCharCode(i);for(var i=0;ir[0][1].length){var f=n-r[0][1].length;r[0][1]=e.substring(r[0][1].length)+r[0][1],h.start1-=f,h.start2-=f,h.length1+=f,h.length2+=f}if(h=t[t.length-1],r=h.diffs,0==r.length||r[r.length-1][0]!=DIFF_EQUAL)r.push([DIFF_EQUAL,e]),h.length1+=n,h.length2+=n;else if(n>r[r.length-1][1].length){var f=n-r[r.length-1][1].length;r[r.length-1][1]+=e.substring(0,f),h.length1+=f,h.length2+=f}return e},diff_match_patch.prototype.patch_splitMax=function(t){for(var n=this.Match_MaxBits,e=0;en){var i=t[e];t.splice(e--,1);for(var h=i.start1,r=i.start2,f="";0!==i.diffs.length;){var a=new diff_match_patch.patch_obj,s=!0;for(a.start1=h-f.length,a.start2=r-f.length,""!==f&&(a.length1=a.length2=f.length,a.diffs.push([DIFF_EQUAL,f]));0!==i.diffs.length&&a.length12*n?(a.length1+=g.length,h+=g.length,s=!1,a.diffs.push([l,g]),i.diffs.shift()):(g=g.substring(0,n-a.length1-this.Patch_Margin),a.length1+=g.length,h+=g.length,l===DIFF_EQUAL?(a.length2+=g.length,r+=g.length):s=!1,a.diffs.push([l,g]),g==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(g.length))}f=this.diff_text2(a.diffs),f=f.substring(f.length-this.Patch_Margin);var c=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);""!==c&&(a.length1+=c.length,a.length2+=c.length,0!==a.diffs.length&&a.diffs[a.diffs.length-1][0]===DIFF_EQUAL?a.diffs[a.diffs.length-1][1]+=c:a.diffs.push([DIFF_EQUAL,c])),s||t.splice(++e,0,a)}}},diff_match_patch.prototype.patch_toText=function(t){for(var n=[],e=0;ea;a++)for(var n=e[a],l=0;i>l;l++){var s=t[l];if(a!==l&&n===s)return!0}}function matchItems(e,t,r,i,a){var n=e[r],l=t[i];if(n===l)return!0;if("object"!=typeof n||"object"!=typeof l)return!1;var s=a.objectHash;if(!s)return a.matchByPosition&&r===i;var o,f;return"number"==typeof r?(a.hashCache1=a.hashCache1||[],o=a.hashCache1[r],"undefined"==typeof o&&(a.hashCache1[r]=o=s(n,r))):o=s(n),"undefined"==typeof o?!1:("number"==typeof i?(a.hashCache2=a.hashCache2||[],f=a.hashCache2[i],"undefined"==typeof f&&(a.hashCache2[i]=f=s(l,i))):f=s(l),"undefined"==typeof f?!1:o===f)}var DiffContext=require("../contexts/diff").DiffContext,PatchContext=require("../contexts/patch").PatchContext,ReverseContext=require("../contexts/reverse").ReverseContext,lcs=require("./lcs"),ARRAY_MOVE=3,isArray="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},arrayIndexOf="function"==typeof Array.prototype.indexOf?function(e,t){return e.indexOf(t)}:function(e,t){for(var r=e.length,i=0;r>i;i++)if(e[i]===t)return i;return-1},diffFilter=function(e){if(e.leftIsArray){var t,r,i,a,n={objectHash:e.options&&e.options.objectHash,matchByPosition:e.options&&e.options.matchByPosition},l=0,s=0,o=e.left,f=e.right,c=o.length,h=f.length;for(c>0&&h>0&&!n.objectHash&&"boolean"!=typeof n.matchByPosition&&(n.matchByPosition=!arraysHaveMatchByRef(o,f,c,h));c>l&&h>l&&matchItems(o,f,l,l,n);)t=l,a=new DiffContext(e.left[t],e.right[t]),e.push(a,t),l++;for(;c>s+l&&h>s+l&&matchItems(o,f,c-1-s,h-1-s,n);)r=c-1-s,i=h-1-s,a=new DiffContext(e.left[r],e.right[i]),e.push(a,i),s++;var u;if(l+s===c){if(c===h)return void e.setResult(void 0).exit();for(u=u||{_t:"a"},t=l;h-s>t;t++)u[t]=[f[t]];return void e.setResult(u).exit()}if(l+s===h){for(u=u||{_t:"a"},t=l;c-s>t;t++)u["_"+t]=[o[t],0,0];return void e.setResult(u).exit()}delete n.hashCache1,delete n.hashCache2;var d=o.slice(l,c-s),v=f.slice(l,h-s),p=lcs.get(d,v,matchItems,n),y=[];for(u=u||{_t:"a"},t=l;c-s>t;t++)arrayIndexOf(p.indices1,t-l)<0&&(u["_"+t]=[o[t],0,0],y.push(t));var x=!0;e.options&&e.options.arrays&&e.options.arrays.detectMove===!1&&(x=!1);var m=!1;e.options&&e.options.arrays&&e.options.arrays.includeValueOnMove&&(m=!0);var C=y.length;for(t=l;h-s>t;t++){var R=arrayIndexOf(p.indices2,t-l);if(0>R){var A=!1;if(x&&C>0)for(var _=0;C>_;_++)if(r=y[_],matchItems(d,v,r-l,t-l,n)){u["_"+r].splice(1,2,t,ARRAY_MOVE),m||(u["_"+r][0]=""),i=t,a=new DiffContext(e.left[r],e.right[i]),e.push(a,i),y.splice(_,1),A=!0;break}A||(u[t]=[f[t]])}else r=p.indices1[R]+l,i=p.indices2[R]+l,a=new DiffContext(e.left[r],e.right[i]),e.push(a,i)}e.setResult(u).exit()}};diffFilter.filterName="arrays";var compare={numerically:function(e,t){return e-t},numericallyBy:function(e){return function(t,r){return t[e]-r[e]}}},patchFilter=function(e){if(e.nested&&"a"===e.delta._t){var t,r,i=e.delta,a=e.left,n=[],l=[],s=[];for(t in i)if("_t"!==t)if("_"===t[0]){if(0!==i[t][2]&&i[t][2]!==ARRAY_MOVE)throw new Error("only removal or move can be applied at original array indices, invalid diff type: "+i[t][2]);n.push(parseInt(t.slice(1),10))}else 1===i[t].length?l.push({index:parseInt(t,10),value:i[t][0]}):s.push({index:parseInt(t,10),delta:i[t]});for(n=n.sort(compare.numerically),t=n.length-1;t>=0;t--){r=n[t];var o=i["_"+r],f=a.splice(r,1)[0];o[2]===ARRAY_MOVE&&l.push({index:o[1],value:f})}l=l.sort(compare.numericallyBy("index"));var c=l.length;for(t=0;c>t;t++){var h=l[t];a.splice(h.index,0,h.value)}var u,d=s.length;if(d>0)for(t=0;d>t;t++){var v=s[t];u=new PatchContext(e.left[v.index],v.delta),e.push(u,v.index)}return e.children?void e.exit():void e.setResult(e.left).exit()}};patchFilter.filterName="arrays";var collectChildrenPatchFilter=function(e){if(e&&e.children&&"a"===e.delta._t){for(var t,r=e.children.length,i=0;r>i;i++)t=e.children[i],e.left[t.childName]=t.result;e.setResult(e.left).exit()}};collectChildrenPatchFilter.filterName="arraysCollectChildren";var reverseFilter=function(e){if(!e.nested)return void(e.delta[2]===ARRAY_MOVE&&(e.newName="_"+e.delta[1],e.setResult([e.delta[0],parseInt(e.childName.substr(1),10),ARRAY_MOVE]).exit()));if("a"===e.delta._t){var t,r;for(t in e.delta)"_t"!==t&&(r=new ReverseContext(e.delta[t]),e.push(r,t));e.exit()}};reverseFilter.filterName="arrays";var reverseArrayDeltaIndex=function(e,t,r){if("string"==typeof t&&"_"===t[0])return parseInt(t.substr(1),10);if(isArray(r)&&0===r[2])return"_"+t;var i=+t;for(var a in e){var n=e[a];if(isArray(n))if(n[2]===ARRAY_MOVE){var l=parseInt(a.substr(1),10),s=n[1];if(s===+t)return l;i>=l&&s>i?i++:l>=i&&i>s&&i--}else if(0===n[2]){var o=parseInt(a.substr(1),10);i>=o&&i++}else 1===n.length&&i>=a&&i--}return i},collectChildrenReverseFilter=function(e){if(e&&e.children&&"a"===e.delta._t){for(var t,r=e.children.length,i={_t:"a"},a=0;r>a;a++){t=e.children[a];var n=t.newName;"undefined"==typeof n&&(n=reverseArrayDeltaIndex(e.delta,t.childName,t.result)),i[n]!==t.result&&(i[n]=t.result)}e.setResult(i).exit()}};collectChildrenReverseFilter.filterName="arraysCollectChildren",exports.diffFilter=diffFilter,exports.patchFilter=patchFilter,exports.collectChildrenPatchFilter=collectChildrenPatchFilter,exports.reverseFilter=reverseFilter,exports.collectChildrenReverseFilter=collectChildrenReverseFilter; },{"../contexts/diff":5,"../contexts/patch":6,"../contexts/reverse":7,"./lcs":13}],12:[function(require,module,exports){ var diffFilter=function(t){t.left instanceof Date?(t.right instanceof Date?t.left.getTime()!==t.right.getTime()?t.setResult([t.left,t.right]):t.setResult(void 0):t.setResult([t.left,t.right]),t.exit()):t.right instanceof Date&&t.setResult([t.left,t.right]).exit()};diffFilter.filterName="dates",exports.diffFilter=diffFilter; },{}],13:[function(require,module,exports){ var defaultMatch=function(t,e,n,r){return t[n]===e[r]},lengthMatrix=function(t,e,n,r){var c,a,i=t.length,u=e.length,f=[i+1];for(c=0;i+1>c;c++)for(f[c]=[u+1],a=0;u+1>a;a++)f[c][a]=0;for(f.match=n,c=1;i+1>c;c++)for(a=1;u+1>a;a++)n(t,e,c-1,a-1,r)?f[c][a]=f[c-1][a-1]+1:f[c][a]=Math.max(f[c-1][a],f[c][a-1]);return f},backtrack=function(t,e,n,r,c,a){if(0===r||0===c)return{sequence:[],indices1:[],indices2:[]};if(t.match(e,n,r-1,c-1,a)){var i=backtrack(t,e,n,r-1,c-1,a);return i.sequence.push(e[r-1]),i.indices1.push(r-1),i.indices2.push(c-1),i}return t[r][c-1]>t[r-1][c]?backtrack(t,e,n,r,c-1,a):backtrack(t,e,n,r-1,c,a)},get=function(t,e,n,r){r=r||{};var c=lengthMatrix(t,e,n||defaultMatch,r),a=backtrack(c,t,e,t.length,e.length,r);return"string"==typeof t&&"string"==typeof e&&(a.sequence=a.sequence.join("")),a};exports.get=get; },{}],14:[function(require,module,exports){ var DiffContext=require("../contexts/diff").DiffContext,PatchContext=require("../contexts/patch").PatchContext,ReverseContext=require("../contexts/reverse").ReverseContext,collectChildrenDiffFilter=function(e){if(e&&e.children){for(var t,l=e.children.length,r=e.result,i=0;l>i;i++)t=e.children[i],"undefined"!=typeof t.result&&(r=r||{},r[t.childName]=t.result);r&&e.leftIsArray&&(r._t="a"),e.setResult(r).exit()}};collectChildrenDiffFilter.filterName="collectChildren";var objectsDiffFilter=function(e){if(!e.leftIsArray&&"object"===e.leftType){var t,l,r=e.options.propertyFilter;for(t in e.left)Object.prototype.hasOwnProperty.call(e.left,t)&&(r&&!r(t,e)||(l=new DiffContext(e.left[t],e.right[t]),e.push(l,t)));for(t in e.right)Object.prototype.hasOwnProperty.call(e.right,t)&&(r&&!r(t,e)||"undefined"==typeof e.left[t]&&(l=new DiffContext(void 0,e.right[t]),e.push(l,t)));return e.children&&0!==e.children.length?void e.exit():void e.setResult(void 0).exit()}};objectsDiffFilter.filterName="objects";var patchFilter=function(e){if(e.nested&&!e.delta._t){var t,l;for(t in e.delta)l=new PatchContext(e.left[t],e.delta[t]),e.push(l,t);e.exit()}};patchFilter.filterName="objects";var collectChildrenPatchFilter=function(e){if(e&&e.children&&!e.delta._t){for(var t,l=e.children.length,r=0;l>r;r++)t=e.children[r],Object.prototype.hasOwnProperty.call(e.left,t.childName)&&void 0===t.result?delete e.left[t.childName]:e.left[t.childName]!==t.result&&(e.left[t.childName]=t.result);e.setResult(e.left).exit()}};collectChildrenPatchFilter.filterName="collectChildren";var reverseFilter=function(e){if(e.nested&&!e.delta._t){var t,l;for(t in e.delta)l=new ReverseContext(e.delta[t]),e.push(l,t);e.exit()}};reverseFilter.filterName="objects";var collectChildrenReverseFilter=function(e){if(e&&e.children&&!e.delta._t){for(var t,l=e.children.length,r={},i=0;l>i;i++)t=e.children[i],r[t.childName]!==t.result&&(r[t.childName]=t.result);e.setResult(r).exit()}};collectChildrenReverseFilter.filterName="collectChildren",exports.collectChildrenDiffFilter=collectChildrenDiffFilter,exports.objectsDiffFilter=objectsDiffFilter,exports.patchFilter=patchFilter,exports.collectChildrenPatchFilter=collectChildrenPatchFilter,exports.reverseFilter=reverseFilter,exports.collectChildrenReverseFilter=collectChildrenReverseFilter; },{"../contexts/diff":5,"../contexts/patch":6,"../contexts/reverse":7}],15:[function(require,module,exports){ var TEXT_DIFF=2,DEFAULT_MIN_LENGTH=60,cachedDiffPatch=null,getDiffMatchPatch=function(t){if(!cachedDiffPatch){var e;if("undefined"!=typeof diff_match_patch)e="function"==typeof diff_match_patch?new diff_match_patch:new diff_match_patch.diff_match_patch;else if("function"==typeof require)try{var i="diff_match_patch_uncompressed",f=require("../../public/external/"+i);e=new f.diff_match_patch}catch(r){e=null}if(!e){if(!t)return null;var a=new Error("text diff_match_patch library not found");throw a.diff_match_patch_not_found=!0,a}cachedDiffPatch={diff:function(t,i){return e.patch_toText(e.patch_make(t,i))},patch:function(t,i){for(var f=e.patch_apply(e.patch_fromText(i),t),r=0;re;e++){r=f[e];var o=r.slice(0,1);"@"===o?(h=d.exec(r),c=e,l=null,n=null,f[c]="@@ -"+h[3]+","+h[4]+" +"+h[1]+","+h[2]+" @@"):"+"===o?(l=e,f[e]="-"+f[e].slice(1),"+"===f[e-1].slice(0,1)&&(a=f[e],f[e]=f[e-1],f[e-1]=a)):"-"===o&&(n=e,f[e]="+"+f[e].slice(1))}return f.join("\n")},reverseFilter=function(t){t.nested||t.delta[2]===TEXT_DIFF&&t.setResult([textDeltaReverse(t.delta[0]),0,TEXT_DIFF]).exit()};reverseFilter.filterName="texts",exports.diffFilter=diffFilter,exports.patchFilter=patchFilter,exports.reverseFilter=reverseFilter; },{}],16:[function(require,module,exports){ var isArray="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},diffFilter=function(e){if(e.left===e.right)return void e.setResult(void 0).exit();if("undefined"==typeof e.left){if("function"==typeof e.right)throw new Error("functions are not supported");return void e.setResult([e.right]).exit()}if("undefined"==typeof e.right)return void e.setResult([e.left,0,0]).exit();if("function"==typeof e.left||"function"==typeof e.right)throw new Error("functions are not supported");if(e.leftType=null===e.left?"null":typeof e.left,e.rightType=null===e.right?"null":typeof e.right,e.leftType!==e.rightType)return void e.setResult([e.left,e.right]).exit();if("boolean"===e.leftType||"number"===e.leftType)return void e.setResult([e.left,e.right]).exit();if("object"===e.leftType&&(e.leftIsArray=isArray(e.left)),"object"===e.rightType&&(e.rightIsArray=isArray(e.right)),e.leftIsArray!==e.rightIsArray)return void e.setResult([e.left,e.right]).exit();if(e.left instanceof RegExp){if(!(e.right instanceof RegExp))return void e.setResult([e.left,e.right]).exit();e.setResult([e.left.toString(),e.right.toString()]).exit()}};diffFilter.filterName="trivial";var patchFilter=function(e){if("undefined"==typeof e.delta)return void e.setResult(e.left).exit();if(e.nested=!isArray(e.delta),!e.nested){if(1===e.delta.length)return void e.setResult(e.delta[0]).exit();if(2===e.delta.length){if(e.left instanceof RegExp){var t=/^\/(.*)\/([gimyu]+)$/.exec(e.delta[1]);if(t)return void e.setResult(new RegExp(t[1],t[2])).exit()}return void e.setResult(e.delta[1]).exit()}return 3===e.delta.length&&0===e.delta[2]?void e.setResult(void 0).exit():void 0}};patchFilter.filterName="trivial";var reverseFilter=function(e){return"undefined"==typeof e.delta?void e.setResult(e.delta).exit():(e.nested=!isArray(e.delta),e.nested?void 0:1===e.delta.length?void e.setResult([e.delta[0],0,0]).exit():2===e.delta.length?void e.setResult([e.delta[1],e.delta[0]]).exit():3===e.delta.length&&0===e.delta[2]?void e.setResult([e.delta[0]]).exit():void 0)};reverseFilter.filterName="trivial",exports.diffFilter=diffFilter,exports.patchFilter=patchFilter,exports.reverseFilter=reverseFilter; },{}],17:[function(require,module,exports){ var environment=require("./environment"),DiffPatcher=require("./diffpatcher").DiffPatcher;exports.DiffPatcher=DiffPatcher,exports.create=function(e){return new DiffPatcher(e)},exports.dateReviver=require("./date-reviver");var defaultInstance;if(exports.diff=function(){return defaultInstance||(defaultInstance=new DiffPatcher),defaultInstance.diff.apply(defaultInstance,arguments)},exports.patch=function(){return defaultInstance||(defaultInstance=new DiffPatcher),defaultInstance.patch.apply(defaultInstance,arguments)},exports.unpatch=function(){return defaultInstance||(defaultInstance=new DiffPatcher),defaultInstance.unpatch.apply(defaultInstance,arguments)},exports.reverse=function(){return defaultInstance||(defaultInstance=new DiffPatcher),defaultInstance.reverse.apply(defaultInstance,arguments)},exports.clone=function(){return defaultInstance||(defaultInstance=new DiffPatcher),defaultInstance.clone.apply(defaultInstance,arguments)},environment.isBrowser)exports.homepage="https://github.com/benjamine/jsondiffpatch",exports.version="0.2.4";else{var packageInfoModuleName="../package.json",packageInfo=require(packageInfoModuleName);exports.homepage=packageInfo.homepage,exports.version=packageInfo.version;var formatterModuleName="./formatters",formatters=require(formatterModuleName);exports.formatters=formatters,exports.console=formatters.console} },{"./date-reviver":8,"./diffpatcher":9,"./environment":10}],18:[function(require,module,exports){ var Pipe=function(t){this.name=t,this.filters=[]};Pipe.prototype.process=function(t){if(!this.processor)throw new Error("add this pipe to a processor before using it");for(var e=this.debug,r=this.filters.length,i=t,s=0;r>s;s++){var o=this.filters[s];if(e&&this.log("filter: "+o.filterName),o(i),"object"==typeof i&&i.exiting){i.exiting=!1;break}}!i.next&&this.resultCheck&&this.resultCheck(i)},Pipe.prototype.log=function(t){console.log("[jsondiffpatch] "+this.name+" pipe, "+t)},Pipe.prototype.append=function(){return this.filters.push.apply(this.filters,arguments),this},Pipe.prototype.prepend=function(){return this.filters.unshift.apply(this.filters,arguments),this},Pipe.prototype.indexOf=function(t){if(!t)throw new Error("a filter name is required");for(var e=0;e