(function(){var a,c=function(b,a){return function(){return b.apply(a,arguments)}},b={}.hasOwnProperty;a=function(){function a(){this.patch_apply_with_offsets=c(this.patch_apply_with_offsets,this);this.transform_object_diff=c(this.transform_object_diff,this);this.transform_list_diff_dmp=c(this.transform_list_diff_dmp,this);this.transform_list_diff=c(this.transform_list_diff,this);this.apply_diff=c(this.apply_diff,this);this.apply_object_diff_with_offsets=c(this.apply_object_diff_with_offsets,this);
this.apply_object_diff=c(this.apply_object_diff,this);this.apply_list_diff_dmp=c(this.apply_list_diff_dmp,this);this.apply_list_diff=c(this.apply_list_diff,this);this.diff=c(this.diff,this);this.object_diff=c(this.object_diff,this);this._text_to_array=c(this._text_to_array,this);this._serialize_to_text=c(this._serialize_to_text,this);this.list_diff_dmp=c(this.list_diff_dmp,this);this.list_diff=c(this.list_diff,this);this._common_suffix=c(this._common_suffix,this);this._common_prefix=c(this._common_prefix,
this);this.object_equals=c(this.object_equals,this);this.list_equals=c(this.list_equals,this);this.equals=c(this.equals,this);this.deepCopy=c(this.deepCopy,this);this.typeOf=c(this.typeOf,this);this.entries=c(this.entries,this);this.dmp=new diff_match_patch}a.prototype.entries=function(a){var f,e;e=0;for(f in a)b.call(a,f)&&e++;return e};a.prototype.typeOf=function(b){var f;f=typeof b;"object"===f&&(b?"number"!==typeof b.length||"function"!==typeof b.splice||b.propertyIsEnumerable("length")||(f="array"):
f="null");return f};a.prototype.deepCopy=function(b){return JSON.parse(JSON.stringify(b))};a.prototype.equals=function(b,f){var e,g;e=this.typeOf(b);g=this.typeOf(f);return"boolean"===e&&"number"===g?Number(b)===f:"number"===e&&"boolean"===g?Number(f)===b:e!==g?!1:"array"===e?this.list_equals(b,f):"object"===e?this.object_equals(b,f):b===f};a.prototype.list_equals=function(b,f){var e,g,a;e=b.length;if(e!==f.length)return!1;for(g=a=0;0<=e?a<e:a>e;g=0<=e?++a:--a)if(!this.equals(b[g],f[g]))return!1;
return!0};a.prototype.object_equals=function(a,f){for(var e in a)if(b.call(a,e)&&!(e in f&&this.equals(a[e],f[e])))return!1;for(e in f)if(b.call(f,e)&&!(e in a))return!1;return!0};a.prototype._common_prefix=function(b,f){var e,g,a;g=Math.min(b.length,f.length);for(e=a=0;0<=g?a<g:a>g;e=0<=g?++a:--a)if(!this.equals(b[e],f[e]))return e;return g};a.prototype._common_suffix=function(b,f){var e,g,a,c,d;g=b.length;a=f.length;c=Math.min(b.length,f.length);if(0===c)return 0;for(e=d=0;0<=c?d<c:d>c;e=0<=c?++d:
--d)if(!this.equals(b[g-e-1],f[a-e-1]))return e;return c};a.prototype.list_diff=function(b,f,e){var g,a,c,d,r,n,p;e=null!=e&&"item"in e?e.item:null;g={};c=b.length;d=f.length;n=this._common_prefix(b,f);a=this._common_suffix(b,f);b=b.slice(n,c-a);f=f.slice(n,d-a);c=b.length;d=f.length;r=Math.max(c,d);for(a=p=0;0<=r?p<=r:p>=r;a=0<=r?++p:--p)a<c&&a<d?this.equals(b[a],f[a])||(g[a+n]=this.diff(b[a],f[a],e)):a<c?g[a+n]={o:"-"}:a<d&&(g[a+n]={o:"+",v:f[a]});return g};a.prototype.list_diff_dmp=function(b,
a,e){b=this._serialize_to_text(b);a=this._serialize_to_text(a);a=this.dmp.diff_lineMode_(b,a);this.dmp.diff_cleanupEfficiency(a);return this.dmp.diff_toDelta(a)};a.prototype._serialize_to_text=function(b){var a,e,g,c;e="";g=0;for(c=b.length;g<c;g++)a=b[g],e+=""+JSON.stringify(a)+"\n";return e};a.prototype._text_to_array=function(b){var a;b=b.split("\n");var e,g,c;c=[];e=0;for(g=b.length;e<g;e++)a=b[e],0<a.length&&c.push(JSON.parse(a));return c};a.prototype.object_diff=function(a,f,e){var g,c,k;g=
{};null!=e&&"attributes"in e&&(e=e.attributes);if(null==a||null==f)return{};for(c in a)b.call(a,c)&&(k=null!=e&&c in e?e[c]:null,c in f?this.equals(a[c],f[c])||(g[c]=this.diff(a[c],f[c],k)):g[c]={o:"-"});for(c in f)b.call(f,c)&&(c in a||null==f[c]||(g[c]={o:"+",v:f[c]}));return g};a.prototype.diff=function(b,a,e){var g;if(this.equals(b,a))return{};null!=e&&"attributes"in e&&(e=e.attributes);if(null!=e&&"otype"in e)switch(g=e.otype,g){case "replace":return{o:"r",v:a};case "list":return{o:"L",v:this.list_diff(b,
a,e)};case "list_dmp":return{o:"dL",v:this.list_diff_dmp(b,a,e)};case "integer":return{o:"I",v:a-b};case "string":if(g=this.dmp.diff_main(b,a),2<g.length&&this.dmp.diff_cleanupEfficiency(g),0<g.length)return{o:"d",v:this.dmp.diff_toDelta(g)}}g=this.typeOf(b);if(g!==this.typeOf(a))return{o:"r",v:a};switch(g){case "boolean":return{o:"r",v:a};case "number":return{o:"r",v:a};case "array":return{o:"r",v:a};case "object":return{o:"O",v:this.object_diff(b,a,e)};case "string":if(g=this.dmp.diff_main(b,a),
2<g.length&&this.dmp.diff_cleanupEfficiency(g),0<g.length)return{o:"d",v:this.dmp.diff_toDelta(g)}}return{}};a.prototype.apply_list_diff=function(a,f){var e,g,c,k,d,r,n,p;r=this.deepCopy(a);k=[];e=[];for(d in f)b.call(f,d)&&(k.push(d),k.sort());d=0;for(p=k.length;d<p;d++){c=k[d];g=f[c];for(var u=void 0,t=void 0,q=void 0,q=[],u=0,t=e.length;u<t;u++)n=e[u],n<=c&&q.push(n);n=q.length;c-=n;switch(g.o){case "+":[].splice.apply(r,[c,c-1-c+1].concat(g=g.v));g;break;case "-":[].splice.apply(r,[c,c-c+1].concat(g=
[]));g;e[e.length]=c;break;case "r":r[c]=g.v;break;case "I":r[c]+=g.v;break;case "L":r[c]=this.apply_list_diff(r[c],g.v);break;case "dL":r[c]=this.apply_list_diff_dmp(r[c],g.v);break;case "O":r[c]=this.apply_object_diff(r[c],g.v);break;case "d":g=this.dmp.diff_fromDelta(r[c],g.v),g=this.dmp.patch_make(r[c],g),g=this.dmp.patch_apply(g,r[c]),r[c]=g[0]}}return r};a.prototype.apply_list_diff_dmp=function(a,b){var e,g;g=this._serialize_to_text(a);e=this.dmp.diff_fromDelta(g,b);e=this.dmp.patch_make(g,
e);g=this.dmp.patch_apply(e,g);return this._text_to_array(g[0])};a.prototype.apply_object_diff=function(a,c){var e,g,l;l=this.deepCopy(a);for(e in c)b.call(c,e)&&(g=c[e],"-"===g.o?delete l[e]:l[e]=this.apply_diff(l[e],g));return l};a.prototype.apply_object_diff_with_offsets=function(a,c,e,g){var l,k;a=this.deepCopy(a);for(k in c)if(b.call(c,k))switch(l=c[k],l.o){case "+":a[k]=l.v;break;case "-":delete a[k];break;case "r":a[k]=l.v;break;case "I":a[k]+=l.v;break;case "L":a[k]=this.apply_list_diff(a[k],
l.v);break;case "O":a[k]=this.apply_object_diff(a[k],l.v);break;case "d":l=this.dmp.diff_fromDelta(a[k],l.v),l=this.dmp.patch_make(a[k],l),k===e?a[k]=this.patch_apply_with_offsets(l,a[k],g):(l=this.dmp.patch_apply(l,a[k]),a[k]=l[0])}return a};a.prototype.apply_diff=function(a,b){var e;switch(b.o){case "+":return b.v;case "-":return null;case "r":return b.v;case "I":return a+b.v;case "L":return this.apply_list_diff(a,b.v);case "dL":return this.apply_list_diff_dmp(a,b.v);case "O":return this.apply_object_diff(a,
b.v);case "d":return e=this.dmp.diff_fromDelta(a,b.v),e=this.dmp.patch_make(a,e),e=this.dmp.patch_apply(e,a),e[0]}};a.prototype.transform_list_diff=function(a,c,e,g){var l,k,d,r,n,p,u,t,q,m;l={};d=[];k=[];g=null!=g&&"item"in g?g.item:null;for(n in c)b.call(c,n)&&(r=c[n],n=parseInt(n),"+"===r.o&&d.push(n),"-"===r.o&&k.push(n));u=p=0;for(n in a)b.call(a,n)&&(r=a[n],n=parseInt(n),q=function(){var a,e,b;b=[];a=0;for(e=d.length;a<e;a++)m=d[a],m<n&&b.push(m);return b}().length,t=function(){var a,e,b;b=
[];a=0;for(e=k.length;a<e;a++)m=k[a],m<n&&b.push(m);return b}().length,p=n=p+1===n?n+u:n+q-t,u=q-t,t=String(n),l[t]=r,t in c&&("+"!==r.o||"+"!==c[n].o)&&("-"===r.o?"-"===c[n].o&&delete l[t]:"-"===c[n].o?("r"===r.o&&(l[t]={o:"+",v:r.v}),!1===r.o&&(l[t]={o:"+",v:this.apply_object_diff(e[t],r.v)})):(q={},q[t]=r,r={},r[t]=c[n],r=this.transform_object_diff(q,r,e,g),l[t]=r[t])));return l};a.prototype.transform_list_diff_dmp=function(a,b,e,g){e=this._serialize_to_text(e);a=this.dmp.patch_make(e,this.dmp.diff_fromDelta(e,
a));b=this.dmp.patch_make(e,this.dmp.diff_fromDelta(e,b));b=this.dmp.patch_apply(b,e)[0];a=this.dmp.patch_apply(a,b)[0];return a!==b&&(b=this.dmp.diff_lineMode_(b,a),2<b.length&&this.dmp.diff_cleanupEfficiency(b),0<b.length)?this.dmp.diff_toDelta(b):""};a.prototype.transform_object_diff=function(a,c,e,g){var d,k,s,r;d=this.deepCopy(a);null!=g&&"attributes"in g&&(g=g.attributes);for(s in a)if(b.call(a,s)&&(k=a[s],s in c))return null!=g&&"attributes"in g?(g=g.attributes,g=null!=g&&s in g?g[s]:null):
g=null,a=e[s],c=c[s],"+"===k.o&&"+"===c.o?this.equals(k.v,c.v)?delete d[s]:d[s]=this.diff(c.v,k.v,g):"-"===k.o&&"-"===c.o?delete d[s]:"-"===c.o&&"+"!==(r=k.o)&&"-"!==r?(d[s]={o:"+"},d[s].v=this.apply_diff(a,k)):"O"===k.o&&"O"===c.o?d[s]={o:"O",v:this.transform_object_diff(k.v,c.v,a,g)}:"L"===k.o&&"L"===c.o?d[s]={o:"L",v:this.transform_list_diff(k.v,c.v,a,g)}:"dL"===k.o&&"dL"===c.o?d[s]={o:"dL",v:this.transform_list_diff_dmp(k.v,c.v,a,g)}:"d"===k.o&&"d"===c.o&&(delete d[s],g=this.dmp.patch_make(a,
this.dmp.diff_fromDelta(a,k.v)),k=this.dmp.patch_make(a,this.dmp.diff_fromDelta(a,c.v)),k=this.dmp.patch_apply(k,a)[0],g=this.dmp.patch_apply(g,k)[0],g!==k&&(g=this.dmp.diff_main(k,g),2<g.length&&this.dmp.diff_cleanupEfficiency(g),0<g.length&&(d[s]={o:"d",v:this.dmp.diff_toDelta(g)}))),d};a.prototype.patch_apply_with_offsets=function(a,b,e){var g,c,d,s,r,n,p,u,t,q,m,v,x,w,B,C,y;if(0===a.length)return b;a=this.dmp.patch_deepCopy(a);q=this.dmp.patch_addPadding(a);b=q+b+q;this.dmp.patch_splitMax(a);
v=x=d=0;for(B=a.length;0<=B?x<B:x>B;v=0<=B?++x:--x){r=a[v].start2+d;p=this.dmp.diff_text1(a[v].diffs);s=-1;if(p.length>this.dmp.Match_MaxBits){if(m=this.dmp.match_main(b,p.substring(0,this.dmp.Match_MaxBits),r),-1!==m&&(s=this.dmp.match_main(b,p.substring(p.length-this.dmp.Match_MaxBits),r+p.length-this.dmp.Match_MaxBits),-1===s||m>=s))m=-1}else m=this.dmp.match_main(b,p,r);if(-1===m)d-=a[v].length2-a[v].length1;else if(d=m-r,s=-1===s?b.substring(m,m+p.length):b.substring(m,s+this.dmp.Match_MaxBits),
s=this.dmp.diff_main(p,s,!1),!(p.length>this.dmp.Match_MaxBits&&this.dmp.diff_levenshtein(s)/p.length>this.dmp.Patch_DeleteThreshold))for(n=r=p=0,C=a[v].diffs.length;0<=C?r<C:r>C;n=0<=C?++r:--r){t=a[v].diffs[n];0!==t[0]&&(u=this.dmp.diff_xIndex(s,p));if(1===t[0])for(b=b.substring(0,m+u)+t[1]+b.substring(m+u),n=g=0,c=e.length;0<=c?g<c:g>c;n=0<=c?++g:--g)e[n]+q.length>m+u&&(e[n]+=t[1].length);else if(-1===t[0])for(c=m+u,g=m+this.dmp.diff_xIndex(s,p+t[1].length),b=b.substring(0,c)+b.substring(g),n=w=
0,y=e.length;0<=y?w<y:w>y;n=0<=y?++w:--w)e[n]+q.length>c&&(e[n]=e[n]+q.length<g?c-q.length:e[n]-(g-c));-1!==t[0]&&(p+=t[1].length)}}return b=b.substring(q.length,b.length-q.length)};return a}();window.jsondiff=a}).call(this);function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=0.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=0.5;this.Patch_Margin=4;this.Match_MaxBits=32}var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;
diff_match_patch.prototype.diff_main=function(a,c,b,d){"undefined"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==c)throw Error("Null input. (diff_main)");if(a==c)return a?[[DIFF_EQUAL,a]]:[];"undefined"==typeof b&&(b=!0);var h=b,f=this.diff_commonPrefix(a,c);b=a.substring(0,f);a=a.substring(f);c=c.substring(f);var f=this.diff_commonSuffix(a,c),e=a.substring(a.length-f);a=a.substring(0,a.length-f);c=c.substring(0,c.length-f);a=this.diff_compute_(a,
c,h,d);b&&a.unshift([DIFF_EQUAL,b]);e&&a.push([DIFF_EQUAL,e]);this.diff_cleanupMerge(a);return a};
diff_match_patch.prototype.diff_compute_=function(a,c,b,d){if(!a)return[[DIFF_INSERT,c]];if(!c)return[[DIFF_DELETE,a]];var h=a.length>c.length?a:c,f=a.length>c.length?c:a,e=h.indexOf(f);return-1!=e?(b=[[DIFF_INSERT,h.substring(0,e)],[DIFF_EQUAL,f],[DIFF_INSERT,h.substring(e+f.length)]],a.length>c.length&&(b[0][0]=b[2][0]=DIFF_DELETE),b):1==f.length?[[DIFF_DELETE,a],[DIFF_INSERT,c]]:(h=this.diff_halfMatch_(a,c))?(c=h[1],f=h[3],a=h[4],h=this.diff_main(h[0],h[2],b,d),b=this.diff_main(c,f,b,d),h.concat([[DIFF_EQUAL,
a]],b)):b&&100<a.length&&100<c.length?this.diff_lineMode_(a,c,d):this.diff_bisect_(a,c,d)};
diff_match_patch.prototype.diff_lineMode_=function(a,c,b){var d=this.diff_linesToChars_(a,c);a=d.chars1;c=d.chars2;d=d.lineArray;a=this.diff_main(a,c,!1,b);this.diff_charsToLines_(a,d);this.diff_cleanupSemantic(a);a.push([DIFF_EQUAL,""]);for(var h=d=c=0,f="",e="";c<a.length;){switch(a[c][0]){case DIFF_INSERT:h++;e+=a[c][1];break;case DIFF_DELETE:d++;f+=a[c][1];break;case DIFF_EQUAL:if(1<=d&&1<=h){a.splice(c-d-h,d+h);c=c-d-h;d=this.diff_main(f,e,!1,b);for(h=d.length-1;0<=h;h--)a.splice(c,0,d[h]);c+=
d.length}d=h=0;e=f=""}c++}a.pop();return a};
diff_match_patch.prototype.diff_bisect_=function(a,c,b){for(var d=a.length,h=c.length,f=Math.ceil((d+h)/2),e=2*f,g=Array(e),l=Array(e),k=0;k<e;k++)g[k]=-1,l[k]=-1;g[f+1]=0;l[f+1]=0;for(var k=d-h,s=0!=k%2,r=0,n=0,p=0,u=0,t=0;t<f&&!((new Date).getTime()>b);t++){for(var q=-t+r;q<=t-n;q+=2){var m=f+q,v;v=q==-t||q!=t&&g[m-1]<g[m+1]?g[m+1]:g[m-1]+1;for(var x=v-q;v<d&&x<h&&a.charAt(v)==c.charAt(x);)v++,x++;g[m]=v;if(v>d)n+=2;else if(x>h)r+=2;else if(s&&(m=f+k-q,0<=m&&m<e&&-1!=l[m])){var w=d-l[m];if(v>=w)return this.diff_bisectSplit_(a,
c,v,x,b)}}for(q=-t+p;q<=t-u;q+=2){m=f+q;w=q==-t||q!=t&&l[m-1]<l[m+1]?l[m+1]:l[m-1]+1;for(v=w-q;w<d&&v<h&&a.charAt(d-w-1)==c.charAt(h-v-1);)w++,v++;l[m]=w;if(w>d)u+=2;else if(v>h)p+=2;else if(!s&&(m=f+k-q,0<=m&&m<e&&-1!=g[m]&&(v=g[m],x=f+v-m,w=d-w,v>=w)))return this.diff_bisectSplit_(a,c,v,x,b)}}return[[DIFF_DELETE,a],[DIFF_INSERT,c]]};
diff_match_patch.prototype.diff_bisectSplit_=function(a,c,b,d,h){var f=a.substring(0,b),e=c.substring(0,d);a=a.substring(b);c=c.substring(d);f=this.diff_main(f,e,!1,h);h=this.diff_main(a,c,!1,h);return f.concat(h)};
diff_match_patch.prototype.diff_linesToChars_=function(a,c){function b(a){for(var b="",e=0,c=-1,f=d.length;c<a.length-1;){c=a.indexOf("\n",e);-1==c&&(c=a.length-1);var n=a.substring(e,c+1),e=c+1;(h.hasOwnProperty?h.hasOwnProperty(n):void 0!==h[n])?b+=String.fromCharCode(h[n]):(b+=String.fromCharCode(f),h[n]=f,d[f++]=n)}return b}var d=[],h={};d[0]="";var f=b(a),e=b(c);return{chars1:f,chars2:e,lineArray:d}};
diff_match_patch.prototype.diff_charsToLines_=function(a,c){for(var b=0;b<a.length;b++){for(var d=a[b][1],h=[],f=0;f<d.length;f++)h[f]=c[d.charCodeAt(f)];a[b][1]=h.join("")}};diff_match_patch.prototype.diff_commonPrefix=function(a,c){if(!a||!c||a.charAt(0)!=c.charAt(0))return 0;for(var b=0,d=Math.min(a.length,c.length),h=d,f=0;b<h;)a.substring(f,h)==c.substring(f,h)?f=b=h:d=h,h=Math.floor((d-b)/2+b);return h};
diff_match_patch.prototype.diff_commonSuffix=function(a,c){if(!a||!c||a.charAt(a.length-1)!=c.charAt(c.length-1))return 0;for(var b=0,d=Math.min(a.length,c.length),h=d,f=0;b<h;)a.substring(a.length-h,a.length-f)==c.substring(c.length-h,c.length-f)?f=b=h:d=h,h=Math.floor((d-b)/2+b);return h};
diff_match_patch.prototype.diff_commonOverlap_=function(a,c){var b=a.length,d=c.length;if(0==b||0==d)return 0;b>d?a=a.substring(b-d):b<d&&(c=c.substring(0,b));b=Math.min(b,d);if(a==c)return b;for(var d=0,h=1;;){var f=a.substring(b-h),f=c.indexOf(f);if(-1==f)return d;h+=f;if(0==f||a.substring(b-h)==c.substring(0,h))d=h,h++}};
diff_match_patch.prototype.diff_halfMatch_=function(a,c){function b(a,b,e){for(var c=a.substring(e,e+Math.floor(a.length/4)),g=-1,d="",l,h,m,v;-1!=(g=b.indexOf(c,g+1));){var x=f.diff_commonPrefix(a.substring(e),b.substring(g)),w=f.diff_commonSuffix(a.substring(0,e),b.substring(0,g));d.length<w+x&&(d=b.substring(g-w,g)+b.substring(g,g+x),l=a.substring(0,e-w),h=a.substring(e+x),m=b.substring(0,g-w),v=b.substring(g+x))}return 2*d.length>=a.length?[l,h,m,v,d]:null}if(0>=this.Diff_Timeout)return null;
var d=a.length>c.length?a:c,h=a.length>c.length?c:a;if(4>d.length||2*h.length<d.length)return null;var f=this,e=b(d,h,Math.ceil(d.length/4)),d=b(d,h,Math.ceil(d.length/2));if(e||d)e=d?e?e[4].length>d[4].length?e:d:d:e;else return null;var g,l;a.length>c.length?(d=e[0],h=e[1],g=e[2],l=e[3]):(g=e[0],l=e[1],d=e[2],h=e[3]);return[d,h,g,l,e[4]]};
diff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var c=!1,b=[],d=0,h=null,f=0,e=0,g=0,l=0,k=0;f<a.length;)a[f][0]==DIFF_EQUAL?(b[d++]=f,e=l,g=k,k=l=0,h=a[f][1]):(a[f][0]==DIFF_INSERT?l+=a[f][1].length:k+=a[f][1].length,h&&h.length<=Math.max(e,g)&&h.length<=Math.max(l,k)&&(a.splice(b[d-1],0,[DIFF_DELETE,h]),a[b[d-1]+1][0]=DIFF_INSERT,d--,d--,f=0<d?b[d-1]:-1,k=l=g=e=0,h=null,c=!0)),f++;c&&this.diff_cleanupMerge(a);this.diff_cleanupSemanticLossless(a);for(f=1;f<a.length;){if(a[f-1][0]==
DIFF_DELETE&&a[f][0]==DIFF_INSERT){c=a[f-1][1];b=a[f][1];d=this.diff_commonOverlap_(c,b);h=this.diff_commonOverlap_(b,c);if(d>=h){if(d>=c.length/2||d>=b.length/2)a.splice(f,0,[DIFF_EQUAL,b.substring(0,d)]),a[f-1][1]=c.substring(0,c.length-d),a[f+1][1]=b.substring(d),f++}else if(h>=c.length/2||h>=b.length/2)a.splice(f,0,[DIFF_EQUAL,c.substring(0,h)]),a[f-1][0]=DIFF_INSERT,a[f-1][1]=b.substring(0,b.length-h),a[f+1][0]=DIFF_DELETE,a[f+1][1]=c.substring(h),f++;f++}f++}};
diff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function c(a,b){if(!a||!b)return 6;var e=a.charAt(a.length-1),c=b.charAt(0),g=e.match(diff_match_patch.nonAlphaNumericRegex_),f=c.match(diff_match_patch.nonAlphaNumericRegex_),d=g&&e.match(diff_match_patch.whitespaceRegex_),k=f&&c.match(diff_match_patch.whitespaceRegex_),e=d&&e.match(diff_match_patch.linebreakRegex_),c=k&&c.match(diff_match_patch.linebreakRegex_),l=e&&a.match(diff_match_patch.blanklineEndRegex_),h=c&&b.match(diff_match_patch.blanklineStartRegex_);
return l||h?5:e||c?4:g&&!d&&k?3:d||k?2:g||f?1:0}for(var b=1;b<a.length-1;){if(a[b-1][0]==DIFF_EQUAL&&a[b+1][0]==DIFF_EQUAL){var d=a[b-1][1],h=a[b][1],f=a[b+1][1],e=this.diff_commonSuffix(d,h);if(e)var g=h.substring(h.length-e),d=d.substring(0,d.length-e),h=g+h.substring(0,h.length-e),f=g+f;for(var e=d,g=h,l=f,k=c(d,h)+c(h,f);h.charAt(0)===f.charAt(0);){var d=d+h.charAt(0),h=h.substring(1)+f.charAt(0),f=f.substring(1),s=c(d,h)+c(h,f);s>=k&&(k=s,e=d,g=h,l=f)}a[b-1][1]!=e&&(e?a[b-1][1]=e:(a.splice(b-
1,1),b--),a[b][1]=g,l?a[b+1][1]=l:(a.splice(b+1,1),b--))}b++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\s/;diff_match_patch.linebreakRegex_=/[\r\n]/;diff_match_patch.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/;
diff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var c=!1,b=[],d=0,h=null,f=0,e=!1,g=!1,l=!1,k=!1;f<a.length;)a[f][0]==DIFF_EQUAL?(a[f][1].length<this.Diff_EditCost&&(l||k)?(b[d++]=f,e=l,g=k,h=a[f][1]):(d=0,h=null),l=k=!1):(a[f][0]==DIFF_DELETE?k=!0:l=!0,h&&(e&&g&&l&&k||h.length<this.Diff_EditCost/2&&3==e+g+l+k)&&(a.splice(b[d-1],0,[DIFF_DELETE,h]),a[b[d-1]+1][0]=DIFF_INSERT,d--,h=null,e&&g?(l=k=!0,d=0):(d--,f=0<d?b[d-1]:-1,l=k=!1),c=!0)),f++;c&&this.diff_cleanupMerge(a)};
diff_match_patch.prototype.diff_cleanupMerge=function(a){a.push([DIFF_EQUAL,""]);for(var c=0,b=0,d=0,h="",f="",e;c<a.length;)switch(a[c][0]){case DIFF_INSERT:d++;f+=a[c][1];c++;break;case DIFF_DELETE:b++;h+=a[c][1];c++;break;case DIFF_EQUAL:1<b+d?(0!==b&&0!==d&&(e=this.diff_commonPrefix(f,h),0!==e&&(0<c-b-d&&a[c-b-d-1][0]==DIFF_EQUAL?a[c-b-d-1][1]+=f.substring(0,e):(a.splice(0,0,[DIFF_EQUAL,f.substring(0,e)]),c++),f=f.substring(e),h=h.substring(e)),e=this.diff_commonSuffix(f,h),0!==e&&(a[c][1]=f.substring(f.length-
e)+a[c][1],f=f.substring(0,f.length-e),h=h.substring(0,h.length-e))),0===b?a.splice(c-d,b+d,[DIFF_INSERT,f]):0===d?a.splice(c-b,b+d,[DIFF_DELETE,h]):a.splice(c-b-d,b+d,[DIFF_DELETE,h],[DIFF_INSERT,f]),c=c-b-d+(b?1:0)+(d?1:0)+1):0!==c&&a[c-1][0]==DIFF_EQUAL?(a[c-1][1]+=a[c][1],a.splice(c,1)):c++,b=d=0,f=h=""}""===a[a.length-1][1]&&a.pop();b=!1;for(c=1;c<a.length-1;)a[c-1][0]==DIFF_EQUAL&&a[c+1][0]==DIFF_EQUAL&&(a[c][1].substring(a[c][1].length-a[c-1][1].length)==a[c-1][1]?(a[c][1]=a[c-1][1]+a[c][1].substring(0,
a[c][1].length-a[c-1][1].length),a[c+1][1]=a[c-1][1]+a[c+1][1],a.splice(c-1,1),b=!0):a[c][1].substring(0,a[c+1][1].length)==a[c+1][1]&&(a[c-1][1]+=a[c+1][1],a[c][1]=a[c][1].substring(a[c+1][1].length)+a[c+1][1],a.splice(c+1,1),b=!0)),c++;b&&this.diff_cleanupMerge(a)};
diff_match_patch.prototype.diff_xIndex=function(a,c){var b=0,d=0,h=0,f=0,e;for(e=0;e<a.length;e++){a[e][0]!==DIFF_INSERT&&(b+=a[e][1].length);a[e][0]!==DIFF_DELETE&&(d+=a[e][1].length);if(b>c)break;h=b;f=d}return a.length!=e&&a[e][0]===DIFF_DELETE?f:f+(c-h)};
diff_match_patch.prototype.diff_prettyHtml=function(a){for(var c=[],b=/&/g,d=/</g,h=/>/g,f=/\n/g,e=0;e<a.length;e++){var g=a[e][0],l=a[e][1].replace(b,"&amp;").replace(d,"&lt;").replace(h,"&gt;").replace(f,"&para;<br>");switch(g){case DIFF_INSERT:c[e]='<ins style="background:#e6ffe6;">'+l+"</ins>";break;case DIFF_DELETE:c[e]='<del style="background:#ffe6e6;">'+l+"</del>";break;case DIFF_EQUAL:c[e]="<span>"+l+"</span>"}}return c.join("")};
diff_match_patch.prototype.diff_text1=function(a){for(var c=[],b=0;b<a.length;b++)a[b][0]!==DIFF_INSERT&&(c[b]=a[b][1]);return c.join("")};diff_match_patch.prototype.diff_text2=function(a){for(var c=[],b=0;b<a.length;b++)a[b][0]!==DIFF_DELETE&&(c[b]=a[b][1]);return c.join("")};
diff_match_patch.prototype.diff_levenshtein=function(a){for(var c=0,b=0,d=0,h=0;h<a.length;h++){var f=a[h][1];switch(a[h][0]){case DIFF_INSERT:b+=f.length;break;case DIFF_DELETE:d+=f.length;break;case DIFF_EQUAL:c+=Math.max(b,d),d=b=0}}return c+=Math.max(b,d)};
diff_match_patch.prototype.diff_toDelta=function(a){for(var c=[],b=0;b<a.length;b++)switch(a[b][0]){case DIFF_INSERT:c[b]="+"+encodeURI(a[b][1]);break;case DIFF_DELETE:c[b]="-"+a[b][1].length;break;case DIFF_EQUAL:c[b]="="+a[b][1].length}return c.join("\t").replace(/%20/g," ")};
diff_match_patch.prototype.diff_fromDelta=function(a,c){for(var b=[],d=0,h=0,f=c.split(/\t/g),e=0;e<f.length;e++){var g=f[e].substring(1);switch(f[e].charAt(0)){case "+":try{b[d++]=[DIFF_INSERT,decodeURI(g)]}catch(l){throw Error("Illegal escape in diff_fromDelta: "+g);}break;case "-":case "=":var k=parseInt(g,10);if(isNaN(k)||0>k)throw Error("Invalid number in diff_fromDelta: "+g);g=a.substring(h,h+=k);"="==f[e].charAt(0)?b[d++]=[DIFF_EQUAL,g]:b[d++]=[DIFF_DELETE,g];break;default:if(f[e])throw Error("Invalid diff operation in diff_fromDelta: "+
f[e]);}}if(h!=a.length)throw Error("Delta length ("+h+") does not equal source text length ("+a.length+").");return b};diff_match_patch.prototype.match_main=function(a,c,b){if(null==a||null==c||null==b)throw Error("Null input. (match_main)");b=Math.max(0,Math.min(b,a.length));return a==c?0:a.length?a.substring(b,b+c.length)==c?b:this.match_bitap_(a,c,b):-1};
diff_match_patch.prototype.match_bitap_=function(a,c,b){function d(a,e){var g=a/c.length,d=Math.abs(b-e);return f.Match_Distance?g+d/f.Match_Distance:d?1:g}if(c.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");var h=this.match_alphabet_(c),f=this,e=this.Match_Threshold,g=a.indexOf(c,b);-1!=g&&(e=Math.min(d(0,g),e),g=a.lastIndexOf(c,b+c.length),-1!=g&&(e=Math.min(d(0,g),e)));for(var l=1<<c.length-1,g=-1,k,s,r=c.length+a.length,n,p=0;p<c.length;p++){k=0;for(s=r;k<s;)d(p,b+
s)<=e?k=s:r=s,s=Math.floor((r-k)/2+k);r=s;k=Math.max(1,b-s+1);var u=Math.min(b+s,a.length)+c.length;s=Array(u+2);for(s[u+1]=(1<<p)-1;u>=k;u--){var t=h[a.charAt(u-1)];s[u]=0===p?(s[u+1]<<1|1)&t:(s[u+1]<<1|1)&t|(n[u+1]|n[u])<<1|1|n[u+1];if(s[u]&l&&(t=d(p,u-1),t<=e))if(e=t,g=u-1,g>b)k=Math.max(1,2*b-g);else break}if(d(p+1,b)>e)break;n=s}return g};
diff_match_patch.prototype.match_alphabet_=function(a){for(var c={},b=0;b<a.length;b++)c[a.charAt(b)]=0;for(b=0;b<a.length;b++)c[a.charAt(b)]|=1<<a.length-b-1;return c};
diff_match_patch.prototype.patch_addContext_=function(a,c){if(0!=c.length){for(var b=c.substring(a.start2,a.start2+a.length1),d=0;c.indexOf(b)!=c.lastIndexOf(b)&&b.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)d+=this.Patch_Margin,b=c.substring(a.start2-d,a.start2+a.length1+d);d+=this.Patch_Margin;(b=c.substring(a.start2-d,a.start2))&&a.diffs.unshift([DIFF_EQUAL,b]);(d=c.substring(a.start2+a.length1,a.start2+a.length1+d))&&a.diffs.push([DIFF_EQUAL,d]);a.start1-=b.length;a.start2-=
b.length;a.length1+=b.length+d.length;a.length2+=b.length+d.length}};
diff_match_patch.prototype.patch_make=function(a,c,b){var d;if("string"==typeof a&&"string"==typeof c&&"undefined"==typeof b)d=a,c=this.diff_main(d,c,!0),2<c.length&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(a&&"object"==typeof a&&"undefined"==typeof c&&"undefined"==typeof b)c=a,d=this.diff_text1(c);else if("string"==typeof a&&c&&"object"==typeof c&&"undefined"==typeof b)d=a;else if("string"==typeof a&&"string"==typeof c&&b&&"object"==typeof b)d=a,c=b;else throw Error("Unknown call format to patch_make.");
if(0===c.length)return[];b=[];a=new diff_match_patch.patch_obj;for(var h=0,f=0,e=0,g=d,l=0;l<c.length;l++){var k=c[l][0],s=c[l][1];h||k===DIFF_EQUAL||(a.start1=f,a.start2=e);switch(k){case DIFF_INSERT:a.diffs[h++]=c[l];a.length2+=s.length;d=d.substring(0,e)+s+d.substring(e);break;case DIFF_DELETE:a.length1+=s.length;a.diffs[h++]=c[l];d=d.substring(0,e)+d.substring(e+s.length);break;case DIFF_EQUAL:s.length<=2*this.Patch_Margin&&h&&c.length!=l+1?(a.diffs[h++]=c[l],a.length1+=s.length,a.length2+=s.length):
s.length>=2*this.Patch_Margin&&h&&(this.patch_addContext_(a,g),b.push(a),a=new diff_match_patch.patch_obj,h=0,g=d,f=e)}k!==DIFF_INSERT&&(f+=s.length);k!==DIFF_DELETE&&(e+=s.length)}h&&(this.patch_addContext_(a,g),b.push(a));return b};
diff_match_patch.prototype.patch_deepCopy=function(a){for(var c=[],b=0;b<a.length;b++){var d=a[b],h=new diff_match_patch.patch_obj;h.diffs=[];for(var f=0;f<d.diffs.length;f++)h.diffs[f]=d.diffs[f].slice();h.start1=d.start1;h.start2=d.start2;h.length1=d.length1;h.length2=d.length2;c[b]=h}return c};
diff_match_patch.prototype.patch_apply=function(a,c){if(0==a.length)return[c,[]];a=this.patch_deepCopy(a);var b=this.patch_addPadding(a);c=b+c+b;this.patch_splitMax(a);for(var d=0,h=[],f=0;f<a.length;f++){var e=a[f].start2+d,g=this.diff_text1(a[f].diffs),l,k=-1;if(g.length>this.Match_MaxBits){if(l=this.match_main(c,g.substring(0,this.Match_MaxBits),e),-1!=l&&(k=this.match_main(c,g.substring(g.length-this.Match_MaxBits),e+g.length-this.Match_MaxBits),-1==k||l>=k))l=-1}else l=this.match_main(c,g,e);
if(-1==l)h[f]=!1,d-=a[f].length2-a[f].length1;else if(h[f]=!0,d=l-e,e=-1==k?c.substring(l,l+g.length):c.substring(l,k+this.Match_MaxBits),g==e)c=c.substring(0,l)+this.diff_text2(a[f].diffs)+c.substring(l+g.length);else if(e=this.diff_main(g,e,!1),g.length>this.Match_MaxBits&&this.diff_levenshtein(e)/g.length>this.Patch_DeleteThreshold)h[f]=!1;else{this.diff_cleanupSemanticLossless(e);for(var g=0,s,k=0;k<a[f].diffs.length;k++){var r=a[f].diffs[k];r[0]!==DIFF_EQUAL&&(s=this.diff_xIndex(e,g));r[0]===
DIFF_INSERT?c=c.substring(0,l+s)+r[1]+c.substring(l+s):r[0]===DIFF_DELETE&&(c=c.substring(0,l+s)+c.substring(l+this.diff_xIndex(e,g+r[1].length)));r[0]!==DIFF_DELETE&&(g+=r[1].length)}}}c=c.substring(b.length,c.length-b.length);return[c,h]};
diff_match_patch.prototype.patch_addPadding=function(a){for(var c=this.Patch_Margin,b="",d=1;d<=c;d++)b+=String.fromCharCode(d);for(d=0;d<a.length;d++)a[d].start1+=c,a[d].start2+=c;var d=a[0],h=d.diffs;if(0==h.length||h[0][0]!=DIFF_EQUAL)h.unshift([DIFF_EQUAL,b]),d.start1-=c,d.start2-=c,d.length1+=c,d.length2+=c;else if(c>h[0][1].length){var f=c-h[0][1].length;h[0][1]=b.substring(h[0][1].length)+h[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];h=d.diffs;0==h.length||h[h.length-
1][0]!=DIFF_EQUAL?(h.push([DIFF_EQUAL,b]),d.length1+=c,d.length2+=c):c>h[h.length-1][1].length&&(f=c-h[h.length-1][1].length,h[h.length-1][1]+=b.substring(0,f),d.length1+=f,d.length2+=f);return b};
diff_match_patch.prototype.patch_splitMax=function(a){for(var c=this.Match_MaxBits,b=0;b<a.length;b++)if(!(a[b].length1<=c)){var d=a[b];a.splice(b--,1);for(var h=d.start1,f=d.start2,e="";0!==d.diffs.length;){var g=new diff_match_patch.patch_obj,l=!0;g.start1=h-e.length;g.start2=f-e.length;""!==e&&(g.length1=g.length2=e.length,g.diffs.push([DIFF_EQUAL,e]));for(;0!==d.diffs.length&&g.length1<c-this.Patch_Margin;){var e=d.diffs[0][0],k=d.diffs[0][1];e===DIFF_INSERT?(g.length2+=k.length,f+=k.length,g.diffs.push(d.diffs.shift()),
l=!1):e===DIFF_DELETE&&1==g.diffs.length&&g.diffs[0][0]==DIFF_EQUAL&&k.length>2*c?(g.length1+=k.length,h+=k.length,l=!1,g.diffs.push([e,k]),d.diffs.shift()):(k=k.substring(0,c-g.length1-this.Patch_Margin),g.length1+=k.length,h+=k.length,e===DIFF_EQUAL?(g.length2+=k.length,f+=k.length):l=!1,g.diffs.push([e,k]),k==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(k.length))}e=this.diff_text2(g.diffs);e=e.substring(e.length-this.Patch_Margin);k=this.diff_text1(d.diffs).substring(0,
this.Patch_Margin);""!==k&&(g.length1+=k.length,g.length2+=k.length,0!==g.diffs.length&&g.diffs[g.diffs.length-1][0]===DIFF_EQUAL?g.diffs[g.diffs.length-1][1]+=k:g.diffs.push([DIFF_EQUAL,k]));l||a.splice(++b,0,g)}}};diff_match_patch.prototype.patch_toText=function(a){for(var c=[],b=0;b<a.length;b++)c[b]=a[b];return c.join("")};
diff_match_patch.prototype.patch_fromText=function(a){var c=[];if(!a)return c;a=a.split("\n");for(var b=0,d=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;b<a.length;){var h=a[b].match(d);if(!h)throw Error("Invalid patch string: "+a[b]);var f=new diff_match_patch.patch_obj;c.push(f);f.start1=parseInt(h[1],10);""===h[2]?(f.start1--,f.length1=1):"0"==h[2]?f.length1=0:(f.start1--,f.length1=parseInt(h[2],10));f.start2=parseInt(h[3],10);""===h[4]?(f.start2--,f.length2=1):"0"==h[4]?f.length2=0:(f.start2--,f.length2=
parseInt(h[4],10));for(b++;b<a.length;){h=a[b].charAt(0);try{var e=decodeURI(a[b].substring(1))}catch(g){throw Error("Illegal escape in patch_fromText: "+e);}if("-"==h)f.diffs.push([DIFF_DELETE,e]);else if("+"==h)f.diffs.push([DIFF_INSERT,e]);else if(" "==h)f.diffs.push([DIFF_EQUAL,e]);else if("@"==h)break;else if(""!==h)throw Error('Invalid patch mode "'+h+'" in: '+e);b++}}return c};diff_match_patch.patch_obj=function(){this.diffs=[];this.start2=this.start1=null;this.length2=this.length1=0};
diff_match_patch.patch_obj.prototype.toString=function(){for(var a=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],c,b=0;b<this.diffs.length;b++){switch(this.diffs[b][0]){case DIFF_INSERT:c="+";break;case DIFF_DELETE:c="-";break;case DIFF_EQUAL:c=" "}a[b+1]=c+encodeURI(this.diffs[b][1])+"\n"}return a.join("").replace(/%20/g," ")};
this.diff_match_patch=diff_match_patch;this.DIFF_DELETE=DIFF_DELETE;this.DIFF_INSERT=DIFF_INSERT;this.DIFF_EQUAL=DIFF_EQUAL;var JSON;JSON||(JSON={});
(function(){function a(b,g){var d,h,p,u,t=f,q,m=g[b];m&&"object"==typeof m&&"function"==typeof m.toJSON&&(m=m.toJSON(b));"function"==typeof l&&(m=l.call(g,b,m));switch(typeof m){case "string":return c(m);case "number":return isFinite(m)?String(m):"null";case "boolean":case "null":return String(m);case "object":if(!m)return"null";f+=e;q=[];if("[object Array]"===Object.prototype.toString.apply(m)){u=m.length;for(d=0;d<u;d+=1)q[d]=a(d,m)||"null";p=0===q.length?"[]":f?"[\n"+f+q.join(",\n"+f)+"\n"+t+"]":
"["+q.join(",")+"]";f=t;return p}if(l&&"object"==typeof l)for(u=l.length,d=0;d<u;d+=1)"string"==typeof l[d]&&(h=l[d],p=a(h,m),p&&q.push(c(h)+(f?": ":":")+p));else for(h in m)Object.prototype.hasOwnProperty.call(m,h)&&(p=a(h,m),p&&q.push(c(h)+(f?": ":":")+p));p=0===q.length?"{}":f?"{\n"+f+q.join(",\n"+f)+"\n"+t+"}":"{"+q.join(",")+"}";f=t;return p}}function c(a){h.lastIndex=0;return h.test(a)?'"'+a.replace(h,function(a){var b=g[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+
'"':'"'+a+'"'}function b(a){return 10>a?"0"+a:a}"use strict";"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
h=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,e,g={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},l;"function"!=typeof JSON.stringify&&(JSON.stringify=function(b,c,g){var d;e=f="";if("number"==typeof g)for(d=0;d<g;d+=1)e+=" ";else"string"==typeof g&&(e=g);l=c;if(!c||"function"==typeof c||"object"==typeof c&&"number"==typeof c.length)return a("",{"":b});throw Error("JSON.stringify");});"function"!=
typeof JSON.parse&&(JSON.parse=function(a,b){function e(a,c){var g,f,d=a[c];if(d&&"object"==typeof d)for(g in d)Object.prototype.hasOwnProperty.call(d,g)&&(f=e(d,g),void 0!==f?d[g]=f:delete d[g]);return b.call(a,c,d)}var c;a=String(a);d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return c=eval("("+a+")"),"function"==typeof b?e({"":c},""):c;throw new SyntaxError("JSON.parse");})})();
SockJS=function(){var a=document,c=window,b={},d=function(){};d.prototype.addEventListener=function(a,e){this._listeners||(this._listeners={});a in this._listeners||(this._listeners[a]=[]);var c=this._listeners[a];-1===b.arrIndexOf(c,e)&&c.push(e)};d.prototype.removeEventListener=function(a,e){if(this._listeners&&a in this._listeners){var c=this._listeners[a],g=b.arrIndexOf(c,e);-1!==g&&(1<c.length?this._listeners[a]=c.slice(0,g).concat(c.slice(g+1)):delete this._listeners[a])}};d.prototype.dispatchEvent=
function(a){var b=a.type,e=Array.prototype.slice.call(arguments,0);this["on"+b]&&this["on"+b].apply(this,e);if(this._listeners&&b in this._listeners)for(var c=0;c<this._listeners[b].length;c++)this._listeners[b][c].apply(this,e)};var h=function(a,b){this.type=a;if("undefined"!==typeof b)for(var e in b)b.hasOwnProperty(e)&&(this[e]=b[e])};h.prototype.toString=function(){var a=[],b;for(b in this)if(this.hasOwnProperty(b)){var e=this[b];"function"===typeof e&&(e="[function]");a.push(b+"="+e)}return"SimpleEvent("+
a.join(", ")+")"};var f=function(a){this._events=a||[];this._listeners={}};f.prototype.emit=function(a){this._verifyType(a);if(!this._nuked){var b=Array.prototype.slice.call(arguments,1);this["on"+a]&&this["on"+a].apply(this,b);if(a in this._listeners)for(var e=0;e<this._listeners[a].length;e++)this._listeners[a][e].apply(this,b)}};f.prototype.on=function(a,b){this._verifyType(a);this._nuked||(a in this._listeners||(this._listeners[a]=[]),this._listeners[a].push(b))};f.prototype._verifyType=function(a){-1===
b.arrIndexOf(this._events,a)&&b.log("Event "+JSON.stringify(a)+" not listed "+JSON.stringify(this._events)+" in "+this)};f.prototype.nuke=function(){this._nuked=!0;for(var a=0;a<this._events.length;a++)delete this[this._events[a]];this._listeners={}};b.random_string=function(a,b){b=b||37;var e,c=[];for(e=0;e<a;e++)c.push("abcdefghijklmnopqrstuvwxyz0123456789_".substr(Math.floor(Math.random()*b),1));return c.join("")};b.random_number=function(a){return Math.floor(Math.random()*a)};b.random_number_string=
function(a){var e=(""+(a-1)).length;return(Array(e+1).join("0")+b.random_number(a)).slice(-e)};b.getOrigin=function(a){return(a+"/").split("/").slice(0,3).join("/")};b.isSameOriginUrl=function(a,b){b||(b=c.location.href);return a.split("/").slice(0,3).join("/")===b.split("/").slice(0,3).join("/")};b.getParentDomain=function(a){return/^[0-9.]*$/.test(a)||/^\[/.test(a)||!/[.]/.test(a)?a:a.split(".").slice(1).join(".")};b.objectExtend=function(a,b){for(var e in b)b.hasOwnProperty(e)&&(a[e]=b[e]);return a};
b.polluteGlobalNamespace=function(){"_jp"in c||(c._jp={})};b.closeFrame=function(a,b){return"c"+JSON.stringify([a,b])};b.userSetCode=function(a){return 1E3===a||3E3<=a&&4999>=a};b.countRTO=function(a){return 100<a?3*a:a+200};b.log=function(){c.console&&console.log&&console.log.apply&&console.log.apply(console,arguments)};b.bind=function(a,b){return a.bind?a.bind(b):function(){return a.apply(b,arguments)}};b.flatUrl=function(a){return-1===a.indexOf("?")&&-1===a.indexOf("#")};b.amendUrl=function(e){var c=
a.location;if(!e)throw Error("Wrong url for SockJS");if(!b.flatUrl(e))throw Error("Only basic urls are supported in SockJS");0===e.indexOf("//")&&(e=c.protocol+e);0===e.indexOf("/")&&(e=c.protocol+"//"+c.host+e);return e=e.replace(/[/]+$/,"")};b.arrIndexOf=function(a,b){for(var e=0;e<a.length;e++)if(a[e]===b)return e;return-1};b.arrSkip=function(a,e){var c=b.arrIndexOf(a,e);return-1===c?a.slice():a.slice(0,c).concat(a.slice(c+1))};b.isArray=Array.isArray||function(a){return 0<={}.toString.call(a).indexOf("Array")};
b.delay=function(a,b){"function"===typeof a&&(b=a,a=0);return setTimeout(b,a)};var e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\x00":"\\u0000","\u0001":"\\u0001","\u0002":"\\u0002","\u0003":"\\u0003","\u0004":"\\u0004","\u0005":"\\u0005","\u0006":"\\u0006","\u0007":"\\u0007","\b":"\\b","\t":"\\t","\n":"\\n","\x0B":"\\u000b","\f":"\\f","\r":"\\r","\u000e":"\\u000e","\u000f":"\\u000f","\u0010":"\\u0010","\u0011":"\\u0011",
"\u0012":"\\u0012","\u0013":"\\u0013","\u0014":"\\u0014","\u0015":"\\u0015","\u0016":"\\u0016","\u0017":"\\u0017","\u0018":"\\u0018","\u0019":"\\u0019","\u001a":"\\u001a","\u001b":"\\u001b","\u001c":"\\u001c","\u001d":"\\u001d","\u001e":"\\u001e","\u001f":"\\u001f",'"':'\\"',"\\":"\\\\","\u007f":"\\u007f","\u0080":"\\u0080","\u0081":"\\u0081","\u0082":"\\u0082","\u0083":"\\u0083","\u0084":"\\u0084","\u0085":"\\u0085","\u0086":"\\u0086","\u0087":"\\u0087","\u0088":"\\u0088","\u0089":"\\u0089","\u008a":"\\u008a",
"\u008b":"\\u008b","\u008c":"\\u008c","\u008d":"\\u008d","\u008e":"\\u008e","\u008f":"\\u008f","\u0090":"\\u0090","\u0091":"\\u0091","\u0092":"\\u0092","\u0093":"\\u0093","\u0094":"\\u0094","\u0095":"\\u0095","\u0096":"\\u0096","\u0097":"\\u0097","\u0098":"\\u0098","\u0099":"\\u0099","\u009a":"\\u009a","\u009b":"\\u009b","\u009c":"\\u009c","\u009d":"\\u009d","\u009e":"\\u009e","\u009f":"\\u009f","\u00ad":"\\u00ad","\u0600":"\\u0600","\u0601":"\\u0601","\u0602":"\\u0602","\u0603":"\\u0603","\u0604":"\\u0604",
"\u070f":"\\u070f","\u17b4":"\\u17b4","\u17b5":"\\u17b5","\u200c":"\\u200c","\u200d":"\\u200d","\u200e":"\\u200e","\u200f":"\\u200f","\u2028":"\\u2028","\u2029":"\\u2029","\u202a":"\\u202a","\u202b":"\\u202b","\u202c":"\\u202c","\u202d":"\\u202d","\u202e":"\\u202e","\u202f":"\\u202f","\u2060":"\\u2060","\u2061":"\\u2061","\u2062":"\\u2062","\u2063":"\\u2063","\u2064":"\\u2064","\u2065":"\\u2065","\u2066":"\\u2066","\u2067":"\\u2067","\u2068":"\\u2068","\u2069":"\\u2069","\u206a":"\\u206a","\u206b":"\\u206b",
"\u206c":"\\u206c","\u206d":"\\u206d","\u206e":"\\u206e","\u206f":"\\u206f","\ufeff":"\\ufeff","\ufff0":"\\ufff0","\ufff1":"\\ufff1","\ufff2":"\\ufff2","\ufff3":"\\ufff3","\ufff4":"\\ufff4","\ufff5":"\\ufff5","\ufff6":"\\ufff6","\ufff7":"\\ufff7","\ufff8":"\\ufff8","\ufff9":"\\ufff9","\ufffa":"\\ufffa","\ufffb":"\\ufffb","\ufffc":"\\ufffc","\ufffd":"\\ufffd","\ufffe":"\\ufffe","\uffff":"\\uffff"},l=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,
k,s=JSON&&JSON.stringify||function(a){e.lastIndex=0;e.test(a)&&(a=a.replace(e,function(a){return g[a]}));return'"'+a+'"'},r=function(a){var b,e={},c=[];for(b=0;65536>b;b++)c.push(String.fromCharCode(b));a.lastIndex=0;c.join("").replace(a,function(a){e[a]="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);return""});a.lastIndex=0;return e};b.quote=function(a){a=s(a);l.lastIndex=0;if(!l.test(a))return a;k||(k=r(l));return a.replace(l,function(a){return k[a]})};var n="websocket xdr-streaming xhr-streaming iframe-eventsource iframe-htmlfile xdr-polling xhr-polling iframe-xhr-polling jsonp-polling".split(" ");
b.probeProtocols=function(){for(var a={},b=0;b<n.length;b++){var e=n[b];a[e]=m[e]&&m[e].enabled()}return a};b.detectProtocols=function(a,b,e){var c={},g=[];b||(b=n);for(var f=0;f<b.length;f++){var d=b[f];c[d]=a[d]}var l=function(a){var b=a.shift();c[b]?g.push(b):0<a.length&&l(a)};!1!==e.websocket&&l(["websocket"]);c["xhr-streaming"]&&!e.null_origin?g.push("xhr-streaming"):!c["xdr-streaming"]||e.cookie_needed||e.null_origin?l(["iframe-eventsource","iframe-htmlfile"]):g.push("xdr-streaming");c["xhr-polling"]&&
!e.null_origin?g.push("xhr-polling"):!c["xdr-polling"]||e.cookie_needed||e.null_origin?l(["iframe-xhr-polling","jsonp-polling"]):g.push("xdr-polling");return g};b.createHook=function(){var a="a"+b.random_string(8);if(!("_sockjs_global"in c)){var e={};c._sockjs_global=function(a){a in e||(e[a]={id:a,del:function(){delete e[a]}});return e[a]}}return c._sockjs_global(a)};b.attachMessage=function(a){b.attachEvent("message",a)};b.attachEvent=function(b,e){"undefined"!==typeof c.addEventListener?c.addEventListener(b,
e,!1):(a.attachEvent("on"+b,e),c.attachEvent("on"+b,e))};b.detachMessage=function(a){b.detachEvent("message",a)};b.detachEvent=function(b,e){"undefined"!==typeof c.addEventListener?c.removeEventListener(b,e,!1):(a.detachEvent("on"+b,e),c.detachEvent("on"+b,e))};var p={},u=!1,t=function(){for(var a in p)p[a](),delete p[a]};b.attachEvent("unload",function(){u||(u=!0,t())});b.unload_add=function(a){var e=b.random_string(8);p[e]=a;u&&b.delay(t);return e};b.unload_del=function(a){a in p&&delete p[a]};
b.createIframe=function(e,c){var g=a.createElement("iframe"),f,d,l=function(){clearTimeout(f);try{g.onload=null}catch(a){}g.onerror=null},k=function(){g&&(l(),setTimeout(function(){g&&g.parentNode.removeChild(g);g=null},0),b.unload_del(d))},h=function(a){g&&(k(),c(a))};g.src=e;g.style.display="none";g.style.position="absolute";g.onerror=function(){h("onerror")};g.onload=function(){clearTimeout(f);f=setTimeout(function(){h("onload timeout")},2E3)};a.body.appendChild(g);f=setTimeout(function(){h("timeout")},
15E3);d=b.unload_add(k);return{post:function(a,b){try{g&&g.contentWindow&&g.contentWindow.postMessage(a,b)}catch(e){}},cleanup:k,loaded:l}};b.createHtmlfile=function(a,e){var g=new ActiveXObject("htmlfile"),f,d,l,k=function(){clearTimeout(f)},h=function(){g&&(k(),b.unload_del(d),l.parentNode.removeChild(l),l=g=null,CollectGarbage())};g.open();g.write('<html><script>document.domain="'+document.domain+'";\x3c/script></html>');g.close();g.parentWindow._jp=c._jp;var s=g.createElement("div");g.body.appendChild(s);
l=g.createElement("iframe");s.appendChild(l);l.src=a;f=setTimeout(function(){g&&(h(),e("timeout"))},15E3);d=b.unload_add(h);return{post:function(a,b){try{l&&l.contentWindow&&l.contentWindow.postMessage(a,b)}catch(e){}},cleanup:h,loaded:k}};var q=function(){};q.prototype=new f(["chunk","finish"]);q.prototype._start=function(a,e,g,f){var d=this;try{d.xhr=new XMLHttpRequest}catch(l){}if(!d.xhr)try{d.xhr=new c.ActiveXObject("Microsoft.XMLHTTP")}catch(k){}if(c.ActiveXObject||c.XDomainRequest)e+=(-1===
e.indexOf("?")?"?":"&")+"t="+ +new Date;d.unload_ref=b.unload_add(function(){d._cleanup(!0)});try{d.xhr.open(a,e,!0)}catch(h){d.emit("finish",0,"");d._cleanup();return}f&&f.no_credentials||(d.xhr.withCredentials="true");if(f&&f.headers)for(var s in f.headers)d.xhr.setRequestHeader(s,f.headers[s]);d.xhr.onreadystatechange=function(){if(d.xhr){var a=d.xhr;switch(a.readyState){case 3:try{var b=a.status,e=a.responseText}catch(c){}1223===b&&(b=204);e&&0<e.length&&d.emit("chunk",b,e);break;case 4:b=a.status,
1223===b&&(b=204),d.emit("finish",b,a.responseText),d._cleanup(!1)}}};d.xhr.send(g)};q.prototype._cleanup=function(a){if(this.xhr){b.unload_del(this.unload_ref);this.xhr.onreadystatechange=function(){};if(a)try{this.xhr.abort()}catch(e){}this.unload_ref=this.xhr=null}};q.prototype.close=function(){this.nuke();this._cleanup(!0)};(b.XHRCorsObject=function(){var a=this,e=arguments;b.delay(function(){a._start.apply(a,e)})}).prototype=new q;(b.XHRLocalObject=function(a,e,c){var g=this;b.delay(function(){g._start(a,
e,c,{no_credentials:!0})})}).prototype=new q;q=b.XDRObject=function(a,e,c){var g=this;b.delay(function(){g._start(a,e,c)})};q.prototype=new f(["chunk","finish"]);q.prototype._start=function(a,e,c){var g=this,d=new XDomainRequest;e+=(-1===e.indexOf("?")?"?":"&")+"t="+ +new Date;var f=d.ontimeout=d.onerror=function(){g.emit("finish",0,"");g._cleanup(!1)};d.onprogress=function(){g.emit("chunk",200,d.responseText)};d.onload=function(){g.emit("finish",200,d.responseText);g._cleanup(!1)};g.xdr=d;g.unload_ref=
b.unload_add(function(){g._cleanup(!0)});try{g.xdr.open(a,e),g.xdr.send(c)}catch(l){f()}};q.prototype._cleanup=function(a){if(this.xdr){b.unload_del(this.unload_ref);this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null;if(a)try{this.xdr.abort()}catch(e){}this.unload_ref=this.xdr=null}};q.prototype.close=function(){this.nuke();this._cleanup(!0)};b.isXHRCorsCapable=function(){return c.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?1:c.XDomainRequest&&a.domain?2:z.enabled()?
3:4};var m=function(a,e,g){if(this===c)return new m(a,e,g);var d=this,f;d._options={devel:!1,debug:!1,protocols_whitelist:[],info:void 0,rtt:void 0};g&&b.objectExtend(d._options,g);d._base_url=b.amendUrl(a);d._server=d._options.server||b.random_number_string(1E3);d._options.protocols_whitelist&&d._options.protocols_whitelist.length?f=d._options.protocols_whitelist:(f="string"===typeof e&&0<e.length?[e]:b.isArray(e)?e:null)&&d._debug('Deprecated API: Use "protocols_whitelist" option instead of supplying protocol list as a second parameter to SockJS constructor.');
d._protocols=[];d.protocol=null;d.readyState=m.CONNECTING;d._ir=O(d._base_url);d._ir.onfinish=function(a,e){d._ir=null;a?(d._options.info&&(a=b.objectExtend(a,d._options.info)),d._options.rtt&&(e=d._options.rtt),d._applyInfo(a,e,f),d._didClose()):d._didClose(1002,"Can't connect to server",!0)}};m.prototype=new d;m.version="0.3.4";m.CONNECTING=0;m.OPEN=1;m.CLOSING=2;m.CLOSED=3;m.prototype._debug=function(){this._options.debug&&b.log.apply(b,arguments)};m.prototype._dispatchOpen=function(){this.readyState===
m.CONNECTING?(this._transport_tref&&(clearTimeout(this._transport_tref),this._transport_tref=null),this.readyState=m.OPEN,this.dispatchEvent(new h("open"))):this._didClose(1006,"Server lost session")};m.prototype._dispatchMessage=function(a){this.readyState===m.OPEN&&this.dispatchEvent(new h("message",{data:a}))};m.prototype._dispatchHeartbeat=function(a){this.readyState===m.OPEN&&this.dispatchEvent(new h("heartbeat",{}))};m.prototype._didClose=function(a,e,g){var c=this;if(c.readyState!==m.CONNECTING&&
c.readyState!==m.OPEN&&c.readyState!==m.CLOSING)throw Error("INVALID_STATE_ERR");c._ir&&(c._ir.nuke(),c._ir=null);c._transport&&(c._transport.doCleanup(),c._transport=null);var d=new h("close",{code:a,reason:e,wasClean:b.userSetCode(a)});if(!b.userSetCode(a)&&c.readyState===m.CONNECTING&&!g){if(c._try_next_protocol(d))return;d=new h("close",{code:2E3,reason:"All transports failed",wasClean:!1,last_event:d})}c.readyState=m.CLOSED;b.delay(function(){c.dispatchEvent(d)})};m.prototype._didMessage=function(a){switch(a.slice(0,
1)){case "o":this._dispatchOpen();break;case "a":a=JSON.parse(a.slice(1)||"[]");for(var e=0;e<a.length;e++)this._dispatchMessage(a[e]);break;case "m":a=JSON.parse(a.slice(1)||"null");this._dispatchMessage(a);break;case "c":a=JSON.parse(a.slice(1)||"[]");this._didClose(a[0],a[1]);break;case "h":this._dispatchHeartbeat()}};m.prototype._try_next_protocol=function(e){var c=this;c.protocol&&(c._debug("Closed transport:",c.protocol,""+e),c.protocol=null);c._transport_tref&&(clearTimeout(c._transport_tref),
c._transport_tref=null);for(;;){e=c.protocol=c._protocols.shift();if(!e)return!1;if(m[e]&&!0===m[e].need_body&&(!a.body||"undefined"!==typeof a.readyState&&"complete"!==a.readyState))return c._protocols.unshift(e),c.protocol="waiting-for-load",b.attachEvent("load",function(){c._try_next_protocol()}),!0;if(m[e]&&m[e].enabled(c._options)){c._transport_tref=b.delay((c._options.rto||0)*(m[e].roundTrips||1)||5E3,function(){c.readyState===m.CONNECTING&&c._didClose(2007,"Transport timeouted")});var g=b.random_string(8),
g=c._base_url+"/"+c._server+"/"+g;c._debug("Opening transport:",e," url:"+g," RTO:"+c._options.rto);c._transport=new m[e](c,g,c._base_url);return!0}c._debug("Skipping transport:",e)}};m.prototype.close=function(a,e){if(a&&!b.userSetCode(a))throw Error("INVALID_ACCESS_ERR");if(this.readyState!==m.CONNECTING&&this.readyState!==m.OPEN)return!1;this.readyState=m.CLOSING;this._didClose(a||1E3,e||"Normal closure");return!0};m.prototype.send=function(a){if(this.readyState===m.CONNECTING)throw Error("INVALID_STATE_ERR");
this.readyState===m.OPEN&&this._transport.doSend(b.quote(""+a));return!0};m.prototype._applyInfo=function(e,c,g){this._options.info=e;this._options.rtt=c;this._options.rto=b.countRTO(c);this._options.info.null_origin=!a.domain;c=b.probeProtocols();this._protocols=b.detectProtocols(c,g,e)};q=m.websocket=function(a,e){var g=this,d=e+"/websocket",d="https"===d.slice(0,5)?"wss"+d.slice(5):"ws"+d.slice(4);g.ri=a;g.url=d;g.ws=new (c.WebSocket||c.MozWebSocket)(g.url);g.ws.onmessage=function(a){g.ri._didMessage(a.data)};
g.unload_ref=b.unload_add(function(){g.ws.close()});g.ws.onclose=function(){g.ri._didMessage(b.closeFrame(1006,"WebSocket connection broken"))}};q.prototype.doSend=function(a){this.ws.send("["+a+"]")};q.prototype.doCleanup=function(){var a=this.ws;a&&(a.onmessage=a.onclose=null,a.close(),b.unload_del(this.unload_ref),this.unload_ref=this.ri=this.ws=null)};q.enabled=function(){return!(!c.WebSocket&&!c.MozWebSocket)};q.roundTrips=2;var v=function(){};v.prototype.send_constructor=function(a){this.send_buffer=
[];this.sender=a};v.prototype.doSend=function(a){this.send_buffer.push(a);this.send_stop||this.send_schedule()};v.prototype.send_schedule_wait=function(){var a=this,e;a.send_stop=function(){a.send_stop=null;clearTimeout(e)};e=b.delay(25,function(){a.send_stop=null;a.send_schedule()})};v.prototype.send_schedule=function(){var a=this;if(0<a.send_buffer.length){var e="["+a.send_buffer.join(",")+"]";a.send_stop=a.sender(a.trans_url,e,function(e,b){a.send_stop=null;!1===e?a.ri._didClose(1006,"Sending error "+
b):a.send_schedule_wait()});a.send_buffer=[]}};v.prototype.send_destructor=function(){this._send_stop&&this._send_stop();this._send_stop=null};var x=function(e,c,g){if(!("_send_form"in this)){var d=this._send_form=a.createElement("form"),f=this._send_area=a.createElement("textarea");f.name="d";d.style.display="none";d.style.position="absolute";d.method="POST";d.enctype="application/x-www-form-urlencoded";d.acceptCharset="UTF-8";d.appendChild(f);a.body.appendChild(d)}var d=this._send_form,f=this._send_area,
l="a"+b.random_string(8);d.target=l;d.action=e+"/jsonp_send?i="+l;var k;try{k=a.createElement('<iframe name="'+l+'">')}catch(h){k=a.createElement("iframe"),k.name=l}k.id=l;d.appendChild(k);k.style.display="none";try{f.value=c}catch(s){b.log("Your browser is seriously broken. Go home! "+s.message)}d.submit();var r=function(a){k.onerror&&(k.onreadystatechange=k.onerror=k.onload=null,b.delay(500,function(){k.parentNode.removeChild(k);k=null}),f.value="",g(!0))};k.onerror=k.onload=r;k.onreadystatechange=
function(a){"complete"==k.readyState&&r()};return r},w=function(a){return function(e,b,c){(new a("POST",e+"/xhr_send",b)).onfinish=function(a,e){c(200===a||204===a,"http status "+a)};return function(a){c(!1,a)}}},B=function(e,c){var g,d=a.createElement("script"),f,l=function(a){f&&(f.parentNode.removeChild(f),f=null);d&&(clearTimeout(g),d.parentNode.removeChild(d),d=d.onreadystatechange=d.onerror=d.onload=d.onclick=null,c(a),c=null)},k=!1,h=null;d.id="a"+b.random_string(8);d.src=e;d.type="text/javascript";
d.charset="UTF-8";d.onerror=function(a){h||(h=setTimeout(function(){k||l(b.closeFrame(1006,"JSONP script loaded abnormally (onerror)"))},1E3))};d.onload=function(a){l(b.closeFrame(1006,"JSONP script loaded abnormally (onload)"))};d.onreadystatechange=function(a){if(/loaded|closed/.test(d.readyState)){if(d&&d.htmlFor&&d.onclick){k=!0;try{d.onclick()}catch(e){}}d&&l(b.closeFrame(1006,"JSONP script loaded abnormally (onreadystatechange)"))}};if("undefined"===typeof d.async&&a.attachEvent)if(/opera/i.test(navigator.userAgent))f=
a.createElement("script"),f.text="try{var a = document.getElementById('"+d.id+"'); if(a)a.onerror();}catch(x){};",d.async=f.async=!1;else{try{d.htmlFor=d.id,d.event="onclick"}catch(s){}d.async=!0}"undefined"!==typeof d.async&&(d.async=!0);g=setTimeout(function(){l(b.closeFrame(1006,"JSONP script loaded abnormally (timeout)"))},35E3);var r=a.getElementsByTagName("head")[0];r.insertBefore(d,r.firstChild);f&&r.insertBefore(f,r.firstChild);return l},q=m["jsonp-polling"]=function(a,e){b.polluteGlobalNamespace();
this.ri=a;this.trans_url=e;this.send_constructor(x);this._schedule_recv()};q.prototype=new v;q.prototype._schedule_recv=function(){var a=this;a._recv_stop=C(a.trans_url+"/jsonp",B,function(e){a._recv_stop=null;e&&(a._is_closing||a.ri._didMessage(e));a._is_closing||a._schedule_recv()})};q.enabled=function(){return!0};q.need_body=!0;q.prototype.doCleanup=function(){this._is_closing=!0;this._recv_stop&&this._recv_stop();this.ri=this._recv_stop=null;this.send_destructor()};var C=function(a,e,g){var d=
"a"+b.random_string(6);a=a+"?c="+escape("_jp."+d);var f=0;e=e(a,function(a){switch(f){case 0:delete c._jp[d];g(a);break;case 1:g(a);f=2;break;case 2:delete c._jp[d]}});c._jp[d]=e;return function(){c._jp[d]&&(f=1,c._jp[d](b.closeFrame(1E3,"JSONP user aborted read")))}},q=function(){};q.prototype=new v;q.prototype.run=function(a,e,b,c,g){this.ri=a;this.trans_url=e;this.send_constructor(w(g));this.poll=new G(a,c,e+b,g)};q.prototype.doCleanup=function(){this.poll&&(this.poll.abort(),this.poll=null)};
var y=m["xhr-streaming"]=function(a,e){this.run(a,e,"/xhr_streaming",D,b.XHRCorsObject)};y.prototype=new q;y.enabled=function(){return c.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest&&!/opera/i.test(navigator.userAgent)};y.roundTrips=2;y.need_body=!0;v=m["xdr-streaming"]=function(a,e){this.run(a,e,"/xhr_streaming",D,b.XDRObject)};v.prototype=new q;v.enabled=function(){return!!c.XDomainRequest};v.roundTrips=2;var H=m["xhr-polling"]=function(a,e){this.run(a,e,"/xhr",D,b.XHRCorsObject)};H.prototype=
new q;H.enabled=y.enabled;H.roundTrips=2;y=m["xdr-polling"]=function(a,e){this.run(a,e,"/xhr",D,b.XDRObject)};y.prototype=new q;y.enabled=v.enabled;y.roundTrips=2;var z=function(){};z.prototype.i_constructor=function(a,e,c){var g=this;g.ri=a;g.origin=b.getOrigin(c);g.base_url=c;g.trans_url=e;a=c+"/iframe.html";g.ri._options.devel&&(a+="?t="+ +new Date);g.window_id=b.random_string(8);a+="#"+g.window_id;g.iframeObj=b.createIframe(a,function(a){g.ri._didClose(1006,"Unable to load an iframe ("+a+")")});
g.onmessage_cb=b.bind(g.onmessage,g);b.attachMessage(g.onmessage_cb)};z.prototype.doCleanup=function(){if(this.iframeObj){b.detachMessage(this.onmessage_cb);try{this.iframeObj.iframe.contentWindow&&this.postMessage("c")}catch(a){}this.iframeObj.cleanup();this.onmessage_cb=this.iframeObj=this.iframeObj=null}};z.prototype.onmessage=function(a){if(a.origin===this.origin){var e=a.data.slice(0,8),b=a.data.slice(8,9);a=a.data.slice(9);if(e===this.window_id)switch(b){case "s":this.iframeObj.loaded();this.postMessage("s",
JSON.stringify([m.version,this.protocol,this.trans_url,this.base_url]));break;case "t":this.ri._didMessage(a)}}};z.prototype.postMessage=function(a,e){this.iframeObj.post(this.window_id+a+(e||""),this.origin)};z.prototype.doSend=function(a){this.postMessage("m",a)};z.enabled=function(){var a=navigator&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Konqueror");return("function"===typeof c.postMessage||"object"===typeof c.postMessage)&&!a};var I,J=function(a,e){parent!==c?parent.postMessage(I+
a+(e||""),"*"):b.log("Can't postMessage, no parent window.",a,e)},A=function(){};A.prototype._didClose=function(a,e){J("t",b.closeFrame(a,e))};A.prototype._didMessage=function(a){J("t",a)};A.prototype._doSend=function(a){this._transport.doSend(a)};A.prototype._doCleanup=function(){this._transport.doCleanup()};b.parent_origin=void 0;m.bootstrap_iframe=function(){var e;I=a.location.hash.slice(1);b.attachMessage(function(a){if(a.source===parent&&("undefined"===typeof b.parent_origin&&(b.parent_origin=
a.origin),a.origin===b.parent_origin)){var g=a.data.slice(0,8),d=a.data.slice(8,9);a=a.data.slice(9);if(g===I)switch(d){case "s":var f=JSON.parse(a),g=f[0],d=f[1];a=f[2];f=f[3];g!==m.version&&b.log('Incompatibile SockJS! Main site uses: "'+g+'", the iframe: "'+m.version+'".');if(!b.flatUrl(a)||!b.flatUrl(f)){b.log("Only basic urls are supported in SockJS");break}if(!b.isSameOriginUrl(a)||!b.isSameOriginUrl(f)){b.log("Can't connect to different domain from within an iframe. ("+JSON.stringify([c.location.href,
a,f])+")");break}e=new A;e._transport=new A[d](e,a,f);break;case "m":e._doSend(a);break;case "c":e&&e._doCleanup(),e=null}}});J("s")};var E=function(a,e){var g=this;b.delay(function(){g.doXhr(a,e)})};E.prototype=new f(["finish"]);E.prototype.doXhr=function(a,e){var g=this,c=(new Date).getTime(),d=new e("GET",a+"/info"),f=b.delay(8E3,function(){d.ontimeout()});d.onfinish=function(a,e){clearTimeout(f);f=null;if(200===a){var b=(new Date).getTime()-c,d=JSON.parse(e);"object"!==typeof d&&(d={});g.emit("finish",
d,b)}else g.emit("finish")};d.ontimeout=function(){d.close();g.emit("finish")}};var M=function(e){var g=this,c=function(){var a=new z;a.protocol="w-iframe-info-receiver";var b=function(e){"string"===typeof e&&"m"===e.substr(0,1)?(e=JSON.parse(e.substr(1)),g.emit("finish",e[0],e[1])):g.emit("finish");a.doCleanup();a=null};a.i_constructor({_options:{},_didClose:b,_didMessage:b},e,e)};a.body?c():b.attachEvent("load",c)};M.prototype=new f(["finish"]);var N=function(){var a=this;b.delay(function(){a.emit("finish",
{},2E3)})};N.prototype=new f(["finish"]);var O=function(a){if(b.isSameOriginUrl(a))return new E(a,b.XHRLocalObject);switch(b.isXHRCorsCapable()){case 1:return new E(a,b.XHRLocalObject);case 2:return new E(a,b.XDRObject);case 3:return new M(a);default:return new N}};(A["w-iframe-info-receiver"]=function(a,e,g){(new E(g,b.XHRLocalObject)).onfinish=function(e,b){a._didMessage("m"+JSON.stringify([e,b]));a._didClose()}}).prototype.doCleanup=function(){};f=m["iframe-eventsource"]=function(){this.protocol=
"w-iframe-eventsource";this.i_constructor.apply(this,arguments)};f.prototype=new z;f.enabled=function(){return"EventSource"in c&&z.enabled()};f.need_body=!0;f.roundTrips=3;(A["w-iframe-eventsource"]=function(a,e){this.run(a,e,"/eventsource",K,b.XHRLocalObject)}).prototype=new q;f=m["iframe-xhr-polling"]=function(){this.protocol="w-iframe-xhr-polling";this.i_constructor.apply(this,arguments)};f.prototype=new z;f.enabled=function(){return c.XMLHttpRequest&&z.enabled()};f.need_body=!0;f.roundTrips=3;
(A["w-iframe-xhr-polling"]=function(a,e){this.run(a,e,"/xhr",D,b.XHRLocalObject)}).prototype=new q;f=m["iframe-htmlfile"]=function(){this.protocol="w-iframe-htmlfile";this.i_constructor.apply(this,arguments)};f.prototype=new z;f.enabled=function(){return z.enabled()};f.need_body=!0;f.roundTrips=3;(A["w-iframe-htmlfile"]=function(a,e){this.run(a,e,"/htmlfile",L,b.XHRLocalObject)}).prototype=new q;var G=function(a,e,b,g){this.ri=a;this.Receiver=e;this.recv_url=b;this.AjaxObject=g;this._scheduleRecv()};
G.prototype._scheduleRecv=function(){var a=this,e=a.poll=new a.Receiver(a.recv_url,a.AjaxObject);e.onmessage=function(e){a.ri._didMessage(e.data)};e.onclose=function(b){a.poll=e=e.onmessage=e.onclose=null;a.poll_is_closing||("permanent"===b.reason?a.ri._didClose(1006,"Polling error ("+b.reason+")"):a._scheduleRecv())}};G.prototype.abort=function(){this.poll_is_closing=!0;this.poll&&this.poll.abort()};var K=function(a){var e=this,g=new EventSource(a);g.onmessage=function(a){e.dispatchEvent(new h("message",
{data:unescape(a.data)}))};e.es_close=g.onerror=function(a,c){var d=c?"user":2!==g.readyState?"network":"permanent";e.es_close=g.onmessage=g.onerror=null;g.close();g=null;b.delay(200,function(){e.dispatchEvent(new h("close",{reason:d}))})}};K.prototype=new d;K.prototype.abort=function(){this.es_close&&this.es_close({},!0)};var F,L=function(a){var e=this;b.polluteGlobalNamespace();e.id="a"+b.random_string(6,26);a+=(-1===a.indexOf("?")?"?":"&")+"c="+escape("_jp."+e.id);if(void 0===F)if("ActiveXObject"in
c)try{F=!!new ActiveXObject("htmlfile")}catch(g){}else F=!1;var d=F?b.createHtmlfile:b.createIframe,f;c._jp[e.id]={start:function(){f.loaded()},message:function(a){e.dispatchEvent(new h("message",{data:a}))},stop:function(){e.iframe_close({},"network")}};e.iframe_close=function(a,b){f.cleanup();e.iframe_close=f=null;delete c._jp[e.id];e.dispatchEvent(new h("close",{reason:b}))};f=d(a,function(a){e.iframe_close({},"permanent")})};L.prototype=new d;L.prototype.abort=function(){this.iframe_close&&this.iframe_close({},
"user")};var D=function(a,e){var b=this,g=0;b.xo=new e("POST",a,null);b.xo.onchunk=function(a,e){if(200===a)for(;;){var c=e.slice(g),d=c.indexOf("\n");if(-1===d)break;g+=d+1;c=c.slice(0,d);b.dispatchEvent(new h("message",{data:c}))}};b.xo.onfinish=function(a,e){b.xo.onchunk(a,e);b.xo=null;b.dispatchEvent(new h("close",{reason:200===a?"network":"permanent"}))}};D.prototype=new d;D.prototype.abort=function(){this.xo&&(this.xo.close(),this.dispatchEvent(new h("close",{reason:"user"})),this.xo=null)};
m.getUtils=function(){return b};m.getIframeTransport=function(){return z};return m}();"_sockjs_onload"in window&&setTimeout(_sockjs_onload,1);"function"===typeof define&&define.amd&&define("sockjs",[],function(){return SockJS});(function(){var a,c,b=function(a,e){return function(){return a.apply(e,arguments)}},d={}.hasOwnProperty,h=[].indexOf||function(a){for(var e=0,b=this.length;e<b;e++)if(e in this&&this[e]===a)return e;return-1};a=function(){function a(e,g,c){this.s=e;this.name=g;this._check_pending=b(this._check_pending,this);this.pending=b(this.pending,this);this.on_changes=b(this.on_changes,this);this.retrieve_changes=b(this.retrieve_changes,this);this._send_changes=b(this._send_changes,this);this._queue_change=b(this._queue_change,
this);this._make_change=b(this._make_change,this);this.update=b(this.update,this);this._check_update=b(this._check_update,this);this._notify_client=b(this._notify_client,this);this._index_loaded=b(this._index_loaded,this);this.on_entity_version=b(this.on_entity_version,this);this.get_version=b(this.get_version,this);this.load_versions=b(this.load_versions,this);this.on_index_error=b(this.on_index_error,this);this.on_index_page=b(this.on_index_page,this);this._refresh_store=b(this._refresh_store,this);
this.send=b(this.send,this);this.on_data=b(this.on_data,this);this.start=b(this.start,this);this._remove_entity=b(this._remove_entity,this);this._save_entity=b(this._save_entity,this);this._load_data=b(this._load_data,this);this._verify=b(this._verify,this);this._load_meta=b(this._load_meta,this);this.show_data=b(this.show_data,this);this.on=b(this.on,this);this.jd=this.s.jd;this.options=this.jd.deepCopy(this.s.options);for(g in c)d.call(c,g)&&(e=c[g],this.options[g]=e);this.chan=this.options.n;this.space=
""+this.options.app_id+"/"+this.name;this.username=this.options.username;this.namespace=""+this.username+":"+this.space;this.clientid=null;try{this.clientid=localStorage.getItem(""+this.namespace+"/clientid")}catch(f){this.clientid=null}if(null==this.clientid||0!==this.clientid.indexOf("sjs")){this.clientid="sjs-"+this.s.bversion+"-"+this.uuid(5);try{localStorage.setItem(""+this.namespace+"/clientid")}catch(h){}}this.cb_events="notify notify_init notify_version local get ready notify_pending error".split(" ");
this.cbs={};this.cb_e=this.cb_l=this.cb_ni=this.cb_np=null;this.cb_n=this.cb_nv=this.cb_r=function(){};this.authorized=this.initialized=!1;this.data={last_cv:0,ccid:this.uuid(),store:{},send_queue:[],send_queue_timer:null};this.started=!1;"nostore"in this.options?this.loaded=0:(this._load_meta(),this.loaded=this._load_data());this._last_pending=null;this._send_backoff=15E3;this._backoff_max=12E4;this._backoff_min=15E3}a.prototype.S4=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};
a.prototype.uuid=function(a){var b;a=a||8;for(b=this.S4();a-=1;)b+=this.S4();return b};a.prototype.now=function(){return(new Date).getTime()};a.prototype.on=function(a,b){if(0<=h.call(this.cb_events,a))switch(this.cbs[a]=b,a){case "get":case "local":return this.cb_l=b;case "notify":return this.cb_n=b;case "notify_version":return this.cb_nv=b;case "notify_pending":return this.cb_np=b;case "notify_init":return this.cb_ni=b;case "ready":return this.cb_r=b;case "error":return this.cb_e=b}else throw Error("unsupported callback event");
};a.prototype.show_data=function(){var a;if(this.s.supports_html5_storage()){for(a in localStorage)d.call(localStorage,a);return!1}};a.prototype._save_meta=function(){if(!this.s.supports_html5_storage())return!1;try{localStorage.setItem(""+this.namespace+"/ccid",this.data.ccid),localStorage.setItem(""+this.namespace+"/last_cv",this.data.last_cv)}catch(a){return!1}return!0};a.prototype._load_meta=function(){var a;if(this.s.supports_html5_storage())return this.data.ccid=localStorage.getItem(""+this.namespace+
"/ccid"),null==(a=this.data).ccid&&(a.ccid=1),this.data.last_cv=localStorage.getItem(""+this.namespace+"/last_cv"),null==(a=this.data).last_cv&&(a.last_cv=0),!1};a.prototype._verify=function(a){if(!("object"in a&&"version"in a))return!1;if(0===this.jd.entries(a.object)){if(!("last"in a&&0<this.jd.entries(a.last)))return!1}else if(null==a.version)return!1;return!0};a.prototype._load_data=function(){var a,b,c,d,f,h,n,p;if(this.s.supports_html5_storage()){h=""+this.namespace+"/e/";f=h.length;d=0;if(0===
localStorage.length)return 0;b=n=0;for(p=localStorage.length-1;0<=p?n<=p:n>=p;b=0<=p?++n:--n)if(c=localStorage.key(b),null!=c&&c.substr(0,f)===h){b=c.substr(f,c.length-f);try{a=JSON.parse(localStorage.getItem(c))}catch(u){a=null}null!=a&&(this._verify(a)?(a.check=null,this.data.store[b]=a,d+=1):this._remove_entity(b))}return d}};a.prototype._save_entity=function(a){var b,c;if(!this.s.supports_html5_storage())return!1;c=""+this.namespace+"/e/"+a;a=this.data.store[a];b=JSON.stringify(a);try{localStorage.setItem(c,
b)}catch(d){return!1}c=JSON.parse(localStorage.getItem(c));return this.jd.equals(a,c)?!0:!1};a.prototype._remove_entity=function(a){if(!this.s.supports_html5_storage())return!1;a=""+this.namespace+"/e/"+a;try{localStorage.removeItem(a)}catch(b){return!1}return!0};a.prototype.start=function(){var a,b;this.namespace=""+this.username+":"+this.space;this.started=!0;this.first=!1;if(this.authorized){if(this.initialized)return this.retrieve_changes();if(!this.first)return this.notify_index={},this._refresh_store()}else this.s.connected&&
(this.first=!0,a="limit"in this.options?"i:1:::"+this.options.limit:"i:1:::40",this.irequest_time=this.now(),this.index_request=!0,this.notify_index={},b={app_id:this.options.app_id,token:this.options.token,name:this.name,clientid:this.clientid,build:this.s.bversion},this.initialized||(b.cmd=a),this.send("init:"+JSON.stringify(b)))};a.prototype.on_data=function(a){var b,c,d,f=this;if("auth:"===a.substr(0,5))if(b=a.substr(5),"expired"===b)this.started=!1,null!=this.cb_e&&this.cb_e("auth");else{if(this.username=
b,this.authorized=!0,this.initialized)return this.start()}else{if("cv:?"===a.substr(0,4))return setTimeout(function(){return f._refresh_store()});if("c:"===a.substr(0,2))return b=JSON.parse(a.substr(2)),"0"!==this.data.last_cv||0!==b.length||this.cv_check||(this.cv_check=!0,this._refresh_store()),this.on_changes(b);if("i:"===a.substr(0,2))return this.on_index_page(JSON.parse(a.substr(2)));if("e:"===a.substr(0,2)){d=a.indexOf("\n");c=a.substr(2,d-2);b=c.substr(c.lastIndexOf(".")+1);c=c.substr(0,c.lastIndexOf("."));
a=a.substr(d+1);if("?"===a)return this.on_entity_version(null,c,b);a=JSON.parse(a);return this.on_entity_version(a.data,c,b)}return!1}};a.prototype.send=function(a){return this.s.send(""+this.chan+":"+a)};a.prototype._refresh_store=function(){this.send("limit"in this.options?"i:1:::"+this.options.limit:"i:1:::40");this.irequest_time=this.now();this.index_request=!0};a.prototype.on_index_page=function(a){var b,c,d,f,h,n,p=this;this.now();c=0;n=a.index;f=0;for(h=n.length;f<h;f++)b=n[f],this.notify_index[b.id]=
!1,c++,setTimeout(function(a){return function(){return p.on_entity_version(a.d,a.id,a.v)}}(b));if(!("mark"in a)||"limit"in this.options){if(this.index_request=!1,"current"in a?(this.data.last_cv=a.current,this._save_meta()):this.data.last_cv=0,0===c)return this._index_loaded()}else return this.index_request=!0,a=a.mark,d=function(a){p.send("i:1:"+a+"::100");return p.irequest_time=p.now()},setTimeout(function(a){return function(){return d(a)}}(a),this.options.page_delay)};a.prototype.on_index_error=
function(){return!1};a.prototype.load_versions=function(a,b){var c,d,f,h,n;if(!(a in this.data.store))return!1;c=Math.max(this.data.store[a].version-(b+1),1);n=[];d=f=c;for(h=this.data.store[a].version-1;c<=h?f<=h:f>=h;d=c<=h?++f:--f)n.push(this.send("e:"+a+"."+d));return n};a.prototype.get_version=function(a,b){return this.send("e:"+(""+a+"."+b))};a.prototype.on_entity_version=function(a,b,c){var f,h,r;f=null!=a?this.jd.deepCopy(a):null;r=!1===this.initialized&&null!=this.cb_ni?this.cb_ni:this.cb_n;
if(b in this.data.store&&"last"in this.data.store[b]&&this.jd.entries(this.data.store[b].last))return f=this.jd.deepCopy(this.data.store[b].last),r(b,f,null),this.notify_index[b]=!0,this._check_update(b);if(b in this.data.store&&c<this.data.store[b].version)return this.cb_nv(b,f,c);b in this.data.store||(this.data.store[b]={});this.data.store[b].id=b;this.data.store[b].object=a;this.data.store[b].version=parseInt(c);r(b,f,c);this.notify_index[b]=!0;a=0;b=this.notify_index;for(h in b)d.call(b,h)&&
!1===this.notify_index[h]&&a++;if(0===a&&!1===this.index_request)return this._index_loaded()};a.prototype._index_loaded=function(){!1===this.initialized&&this.cb_r();this.initialized=!0;return this.retrieve_changes()};a.prototype._notify_client=function(a,b,c,d,f){var h,n,p,u,t;if(null==this.cb_l)this.cb_n(a,b,f);else return h=this.cb_l(a),n=null,t=[],"array"===this.jd.typeOf(h)&&(p=h[2],u=h[1],h=h[0],n=this.s._captureCursor(p))&&(t[0]=n.startOffset,"endOffset"in n&&(t[1]=n.endOffset)),null!=h&&null!=
c?(h=this.jd.object_diff(c,h),0===this.jd.entries(h)?b=c:d=this.jd.transform_object_diff(h,d,c),n?(b=this.jd.apply_object_diff_with_offsets(b,d,u,t),null!=p&&"value"in p&&(p.value=b[u]),n.startOffset=t[0],1<t.length&&(n.endOffset=t[1],n.startOffset>=n.endOffset&&(n.collapsed=!0)),this.s._restoreCursor(p,n)):b=this.jd.apply_object_diff(b,d),this.cb_n(a,b,f)):b?this.cb_n(a,b,f):this.cb_n(a,null,null)};a.prototype._check_update=function(a){var b,c,d,f,h;if(!(a in this.data.store))return!1;c=this.data.store[a];
if(c.change){a=!1;h=this.data.send_queue;d=0;for(f=h.length;d<f;d++)b=h[d],b.id===c.change.id&&b.ccid===c.change.ccid&&(a=!0);return a?!1:(this._queue_change(c.change),!0)}if(null!=c.check)return!1;if("last"in c&&this.jd.equals(c.object,c.last))return delete c.last,this._remove_entity(a),!1;b=this._make_change(a);null!=b?(c.change=b,this._queue_change(b)):this._remove_entity(a);return!0};a.prototype.update=function(a,b){var c,d,f,h,n,p=this;if(1===arguments.length)if(null!=this.cb_l)b=this.cb_l(a),
"array"===this.jd.typeOf(b)&&(b=b[0]);else throw Error("missing 'local' callback");if(null==a&&null==b)return!1;if(null!=a){if(0===a.length||-1!==a.indexOf("/"))return!1}else a=this.uuid();a in this.data.store||(this.data.store[a]={id:a,object:{},version:null,change:null,check:null});d=this.data.store[a];d.last=this.jd.deepCopy(b);d.modified=this.s._time();this._save_entity(a);n=this.data.send_queue;f=0;for(h=n.length;f<h;f++)if(c=n[f],String(a)===c.id)return null;null!=d.check&&clearTimeout(d.check);
d.check=setTimeout(function(a,b){return function(){b.check=null;b.change=p._make_change(a);delete b.last;p._save_entity(a);return p._queue_change(b.change)}}(a,d),this.options.update_delay);return a};a.prototype._make_change=function(a){var b,c;c=this.data.store[a];b={id:String(a),ccid:this.uuid()};if(this.initialized)if(null!=this.cb_l)a=this.cb_l(a),"array"===this.jd.typeOf(a)&&(a=a[0]);else if("last"in c)a=c.last;else return null;else if("last"in c)a=c.last;else return null;null!=c.version&&(b.sv=
c.version);null===a&&null!=c.version?b.o="-":null!=a&&null!=c.object?(b.o="M","sendfull"in c?(b.d=this.jd.deepCopy(a),delete c.sendfull):(b.v=this.jd.object_diff(c.object,a),0===this.jd.entries(b.v)&&(b=null))):b=null;return b};a.prototype._queue_change=function(a){if(null!=a)return this.data.send_queue.push(a),this.send("c:"+JSON.stringify(a)),this._check_pending(),null!=this.data.send_queue_timer&&clearTimeout(this.data.send_queue_timer),this.data.send_queue_timer=setTimeout(this._send_changes,
this._send_backoff)};a.prototype._send_changes=function(){var a,b,c,d;if(0===this.data.send_queue.length)this.data.send_queue_timer=null;else{if(this.s.connected)for(d=this.data.send_queue,b=0,c=d.length;b<c;b++)a=d[b],this.send("c:"+JSON.stringify(a));this._send_backoff*=2;this._send_backoff>this._backoff_max&&(this._send_backoff=this._backoff_max);return this.data.send_queue_timer=setTimeout(this._send_changes,this._send_backoff)}};a.prototype.retrieve_changes=function(){this.send("cv:"+this.data.last_cv)};
a.prototype.on_changes=function(a){var b,c,d,f,h,n,p,u,t,q,m,v,x,w=this;c=[];u=!1;this._send_backoff=this._backoff_min;t=0;for(m=a.length;t<m;t++){b=a[t];d=b.id;f=[];x=this.data.send_queue;q=0;for(v=x.length;q<v;q++)p=x[q],b.clientid===this.clientid&&d===p.id&&(b.local=!0,f.push(p),c.push(d));p=0;for(q=f.length;p<q;p++)n=f[p],this.data.store[n.id].change=null,this._save_entity(n.id),this.data.send_queue=function(){var a,b,c,e;c=this.data.send_queue;e=[];a=0;for(b=c.length;a<b;a++)h=c[a],h!==n&&e.push(h);
return e}.call(this);0<f.length&&this._check_pending();if("error"in b)switch(b.error){case 412:d=c.indexOf(b.id);-1<d&&c.splice(d,1);break;case 409:break;case 405:b.id in this.data.store&&(this.data.store[b.id].version=null);u=!0;break;case 440:this.data.store[d].sendfull=!0;break;default:b.id in this.data.store&&(this.data.store[b.id].version=null),u=!0}else f=b.o,"-"===f?(delete this.data.store[d],this._remove_entity(d),"local"in b||this._notify_client(b.id,null,null,null,null)):"M"===f&&(f=this.data.store[d],
"sv"in b&&null!=f&&null!=f.version&&f.version===b.sv||!("sv"in b)||1===b.ev?(null==f&&(this.data.store[d]={id:d,object:{},version:null,change:null,check:null},f=this.data.store[d]),d=this.jd.deepCopy(f.object),f.object=this.jd.apply_object_diff(f.object,b.v),f.version=b.ev,f=this.jd.deepCopy(f.object),"local"in b||this._notify_client(b.id,f,d,b.v,b.ev)):null!=f&&null!=f.version&&b.ev<=f.version||(null!=f&&(this.data.store[d].version=null),u=!0)),u||(this.data.last_cv=b.cv,this._save_meta())}if(u)setTimeout(function(){return w._refresh_store()});
else for(a=function(a){return setTimeout(function(){return w._check_update(a)},w.options.update_delay)},u=0,t=c.length;u<t;u++)d=c[u],a(d)};a.prototype.pending=function(){var a,b,c,d,f;d=this.data.send_queue;f=[];b=0;for(c=d.length;b<c;b++)a=d[b],f.push(a.id);d=this.data.send_queue;f=[];b=0;for(c=d.length;b<c;b++)a=d[b],f.push(a.id);return f};a.prototype._check_pending=function(){var a,b,c,d,f,h;if(null!=this.cb_np){a=this.pending();b=!0;if(this._last_pending)if(b=!1,this._last_pending.length===a.length)for(h=
this._last_pending,d=0,f=h.length;d<f;d++)c=h[d],-1===a.indexOf(c)&&(b=!0);else b=!0;if(b)return this._last_pending=a,this.cb_np(a)}};return a}();c=function(){function c(a,g){var f,h,s;this.app_id=a;this.options=g;this._restoreCursor=b(this._restoreCursor,this);this._captureCursor=b(this._captureCursor,this);this._sock_message=b(this._sock_message,this);this._sock_hb_check=b(this._sock_hb_check,this);this._sock_closed=b(this._sock_closed,this);this._sock_opened=b(this._sock_opened,this);this._sock_connect=
b(this._sock_connect,this);this.synced=b(this.synced,this);this.send=b(this.send,this);this.stop=b(this.stop,this);this.start=b(this.start,this);this.on=b(this.on,this);this.bucket=b(this.bucket,this);this.bversion=2014030401;this.jd=new jsondiff;this.dmp=this.jd.dmp;this.auth_token=null;this.options=this.options||{};this.options.app_id=this.app_id;this.sock_opts={debug:!1};if("sockjs"in this.options)for(f in s=this.options.sockjs,s)d.call(s,f)&&(h=s[f],this.sock_opts[f]=h);"host"in this.options||
(this.options.host="api.simperium.com");"port"in this.options||(this.options.port=80);"token"in this.options&&(this.auth_token=this.options.token);f=-1!==this.options.host.indexOf("simperium.com")?"https":"http";this.buckets={};this.channels=0;"update_delay"in this.options||(this.options.update_delay=0);"page_delay"in this.options||(this.options.page_delay=0);this.options.prefix="sock/1/"+this.app_id;this.options.port=parseInt(this.options.port);this.sock_url=80!==this.options.port&&443!==this.options.port?
""+f+"://"+this.options.host+":"+this.options.port+"/"+this.options.prefix:""+f+"://"+this.options.host+"/"+this.options.prefix;this.stopped=!1;this._sock_backoff=3E3;this._sock_hb=1;this._sock_connect()}c.prototype.lowerstrip=function(a){a=a.toLowerCase();return null!=String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")};c.prototype._time=function(){var a;a=new Date;return Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds())/
1E3};c.prototype.supports_html5_storage=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(a){return!1}};c.prototype.bucket=function(b,c){var d;b=this.lowerstrip(b);c=c||{};c.n=this.channels++;d=new a(this,b,c);return this.buckets[c.n]=d};c.prototype.on=function(a,b,c){return this.buckets[a].on(b,c)};c.prototype.start=function(){var b,c,f;this.stopped=!1;c=this.buckets;f=[];for(b in c)d.call(c,b)&&(a=c[b],f.push(a.start()));return f};c.prototype.stop=function(){this.stopped=
!0;if(null!=this.sock)return this.sock.close()};c.prototype.send=function(a){return this.sock.send(a)};c.prototype.synced=function(){var b,c;c=this.buckets;for(b in c)if(d.call(c,b)&&(a=c[b],0<a.pending().length))return!1;return!0};c.prototype._sock_connect=function(){this.authorized=this.connected=!1;this.sock=new SockJS(this.sock_url,void 0,this.sock_opts);this.sock.onopen=this._sock_opened;this.sock.onmessage=this._sock_message;return this.sock.onclose=this._sock_closed};c.prototype._sock_opened=
function(){var b,c,f;this._sock_backoff=3E3;this.connected=!0;this._sock_hb_timer=setTimeout(this._sock_hb_check,2E4);c=this.buckets;f=[];for(b in c)d.call(c,b)&&(a=c[b],a.started?f.push(a.start()):f.push(void 0));return f};c.prototype._sock_closed=function(){var b,c;this.connected=!1;c=this.buckets;for(b in c)d.call(c,b)&&(a=c[b],a.authorized=!1);this._sock_backoff=4E3>this._sock_backoff?this._sock_backoff+1:15E3;this._sock_hb_timer&&(clearTimeout(this._sock_hb_timer),this._sock_hb_timer=null);if(!this.stopped)return setTimeout(this._sock_connect,
this._sock_backoff)};c.prototype._sock_hb_check=function(){var a;a=(new Date).getTime()-this._sock_msg_time;if(!1!==this.connected)return 4E4<a?this.sock.close():15E3<a&&this.sock.send("h:"+this._sock_hb),this._sock_hb_timer=setTimeout(this._sock_hb_check,2E4)};c.prototype._sock_message=function(a){var b,c;this._sock_msg_time=(new Date).getTime();b=a.data;c=b.indexOf(":");a=null;if(1===c&&"h"===b.charAt(0))this._sock_hb=b.substr(2);else{try{a=parseInt(b.substr(0,c)),b=b.substr(c+1)}catch(d){a=null}if(null!==
a&&a in this.buckets)return this.buckets[a].on_data(b)}};c.prototype._captureCursor=function(a){};c.prototype._captureCursor=function(a){if("activeElement"in a&&!a.activeElement)return null;var b=this.dmp.Match_MaxBits/2,c=a.value,d={};if("selectionStart"in a){try{var f=a.selectionStart,h=a.selectionEnd}catch(n){return null}d.startPrefix=c.substring(f-b,f);d.startSuffix=c.substring(f,f+b);d.startOffset=f;d.collapsed=f==h;d.collapsed||(d.endPrefix=c.substring(h-b,h),d.endSuffix=c.substring(h,h+b),
d.endOffset=h)}else{for(f=a;f.parentNode;)f=f.parentNode;if(!f.selection||!f.selection.createRange)return null;c=f.selection.createRange();if(c.parentElement()!=a)return null;f=f.body.createTextRange();d.collapsed=""==c.text;f.moveToElementText(a);d.collapsed||(f.setEndPoint("EndToEnd",c),d.endPrefix=f.text,d.endOffset=d.endPrefix.length,d.endPrefix=d.endPrefix.substring(d.endPrefix.length-b));f.setEndPoint("EndToStart",c);d.startPrefix=f.text;d.startOffset=d.startPrefix.length;d.startPrefix=d.startPrefix.substring(d.startPrefix.length-
b);f.moveToElementText(a);f.setEndPoint("StartToStart",c);d.startSuffix=f.text.substring(0,b);d.collapsed||(f.setEndPoint("StartToEnd",c),d.endSuffix=f.text.substring(0,b))}"scrollTop"in a&&(d.scrollTop=a.scrollTop/a.scrollHeight,d.scrollLeft=a.scrollLeft/a.scrollWidth);return d};c.prototype._restoreCursor=function(a,b){};c.prototype._restoreCursor=function(a,b){this.dmp.Match_Distance=1E3;this.dmp.Match_Threshold=0.9;var c=this.dmp.Match_MaxBits/2,d=a.value,f=b.startPrefix+b.startSuffix,h,n=this.dmp.match_main(d,
f,b.startOffset-c);null!==n&&(h=d.substring(n,n+f.length),f=this.dmp.diff_main(f,h,!1),n+=this.dmp.diff_xIndex(f,b.startPrefix.length));var p=null;b.collapsed||(f=b.endPrefix+b.endSuffix,p=this.dmp.match_main(d,f,b.endOffset-c),null!==p&&(h=d.substring(p,p+f.length),f=this.dmp.diff_main(f,h,!1),p+=this.dmp.diff_xIndex(f,b.endPrefix.length)));null===n&&null!==p?n=p:null===n&&null===p&&(n=b.startOffset);null===p&&(p=n);if("selectionStart"in a)a.selectionStart=n,a.selectionEnd=p;else{for(c=a;c.parentNode;)c=
c.parentNode;if(!c.selection||!c.selection.createRange)return;d=a.value.substring(0,n);d=d.replace(/\r\n/g,"\n").length;c=c.body.createTextRange();c.moveToElementText(a);c.collapse(!0);c.moveStart("character",d);b.collapsed||(d=a.value.substring(n,p),n=d.replace(/\r\n/g,"\n").length,c.moveEnd("character",n));c.select()}"scrollTop"in b&&(a.scrollTop=b.scrollTop*a.scrollHeight,a.scrollLeft=b.scrollLeft*a.scrollWidth)};return c}();window.Simperium=c;a.prototype.on=a.prototype.on;a.prototype.start=a.prototype.start;
a.prototype.load_versions=a.prototype.load_versions;a.prototype.pending=a.prototype.pending;c.prototype.on=c.prototype.on;c.prototype.start=c.prototype.start;c.prototype.bucket=c.prototype.bucket;c.prototype.synced=c.prototype.synced}).call(this);
