.Zero,c=this.field.One;o.Degree>=Math.floor(n/2);){var l=r,d=a,h=u;if(r=o,a=s,u=c,r.Zero)throw"r_{i-1} was zero";o=l;for(var f=this.field.Zero,p=r.getCoefficient(r.Degree),g=this.field.inverse(p);o.Degree>=r.Degree&&!o.Zero;){
var m=o.Degree-r.Degree,v=this.field.multiply(o.getCoefficient(o.Degree),g);f=f.addOrSubtract(this.field.buildMonomial(m,v)),o=o.addOrSubtract(r.multiplyByMonomial(m,v))}s=f.multiply1(a).addOrSubtract(d),c=f.multiply1(u).addOrSubtract(h)}var y=c.getCoefficient(0);if(0==y)throw"ReedSolomonException sigmaTilde(0) was zero";var b=this.field.inverse(y),w=c.multiply2(b),_=o.multiply2(b);return new Array(w,_)},this.findErrorLocations=function(e){var t=e.Degree;if(1==t)return new Array(e.getCoefficient(1));for(var n=new Array(t),i=0,r=1;256>r&&t>i;r++)0==e.evaluateAt(r)&&(n[i]=this.field.inverse(r),i++);if(i!=t)throw"Error locator degree does not match number of roots";return n},this.findErrorMagnitudes=function(e,t,n){for(var i=t.length,r=new Array(i),o=0;i>o;o++){for(var a=this.field.inverse(t[o]),s=1,u=0;i>u;u++)o!=u&&(s=this.field.multiply(s,GF256.addOrSubtract(1,this.field.multiply(t[u],a))));r[o]=this.field.multiply(e.evaluateAt(a),this.field.inverse(s)),n&&(r[o]=this.field.multiply(r[o],a))}return r}}function GF256Poly(e,t){if(null==t||0==t.length)throw"System.ArgumentException";this.field=e;var n=t.length;if(n>1&&0==t[0]){for(var i=1;n>i&&0==t[i];)i++;if(i==n)this.coefficients=e.Zero.coefficients;else{this.coefficients=new Array(n-i);for(var r=0;r<this.coefficients.length;r++)this.coefficients[r]=0;for(var o=0;o<this.coefficients.length;o++)this.coefficients[o]=t[i+o]}}else this.coefficients=t;this.__defineGetter__("Zero",function(){return 0==this.coefficients[0]}),this.__defineGetter__("Degree",function(){return this.coefficients.length-1}),this.__defineGetter__("Coefficients",function(){return this.coefficients}),this.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},this.evaluateAt=function(e){if(0==e)return this.getCoefficient(0);var t=this.coefficients.length;if(1==e){for(var n=0,i=0;t>i;i++)n=GF256.addOrSubtract(n,this.coefficients[i]);return n}for(var r=this.coefficients[0],i=1;t>i;i++)r=GF256.addOrSubtract(this.field.multiply(e,r),this.coefficients[i]);return r},this.addOrSubtract=function(t){if(this.field!=t.field)throw"GF256Polys do not have same GF256 field";if(this.Zero)return t;if(t.Zero)return this;var n=this.coefficients,i=t.coefficients;if(n.length>i.length){var r=n;n=i,i=r}for(var o=new Array(i.length),a=i.length-n.length,s=0;a>s;s++)o[s]=i[s];for(var u=a;u<i.length;u++)o[u]=GF256.addOrSubtract(n[u-a],i[u]);return new GF256Poly(e,o)},this.multiply1=function(e){if(this.field!=e.field)throw"GF256Polys do not have same GF256 field";if(this.Zero||e.Zero)return this.field.Zero;for(var t=this.coefficients,n=t.length,i=e.coefficients,r=i.length,o=new Array(n+r-1),a=0;n>a;a++)for(var s=t[a],u=0;r>u;u++)o[a+u]=GF256.addOrSubtract(o[a+u],this.field.multiply(s,i[u]));return new GF256Poly(this.field,o)},this.multiply2=function(e){if(0==e)return this.field.Zero;if(1==e)return this;for(var t=this.coefficients.length,n=new Array(t),i=0;t>i;i++)n[i]=this.field.multiply(this.coefficients[i],e);return new GF256Poly(this.field,n)},this.multiplyByMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return this.field.Zero;for(var n=this.coefficients.length,i=new Array(n+e),r=0;r<i.length;r++)i[r]=0;for(var r=0;n>r;r++)i[r]=this.field.multiply(this.coefficients[r],t);return new GF256Poly(this.field,i)},this.divide=function(e){if(this.field!=e.field)throw"GF256Polys do not have same GF256 field";if(e.Zero)throw"Divide by 0";for(var t=this.field.Zero,n=this,i=e.getCoefficient(e.Degree),r=this.field.inverse(i);n.Degree>=e.Degree&&!n.Zero;){var o=n.Degree-e.Degree,a=this.field.multiply(n.getCoefficient(n.Degree),r),s=e.multiplyByMonomial(o,a),u=this.field.buildMonomial(o,a);t=t.addOrSubtract(u),n=n.addOrSubtract(s)}return new Array(t,n)}}function GF256(e){this.expTable=new Array(256),this.logTable=new Array(256);for(var t=1,n=0;256>n;n++)this.expTable[n]=t,t<<=1,t>=256&&(t^=e);for(var n=0;255>n;n++)this.logTable[this.expTable[n]]=n;var i=new Array(1);i[0]=0,this.zero=new GF256Poly(this,new Array(i));var r=new Array(1);r[0]=1,this.one=new GF256Poly(this,new Array(r)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this.buildMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return zero;for(var n=new Array(e+1),i=0;i<n.length;i++)n[i]=0;return n[0]=t,new GF256Poly(this,n)},this.exp=function(e){return this.expTable[e]},this.log=function(e){if(0==e)throw"System.ArgumentException";return this.logTable[e]},this.inverse=function(e){if(0==e)throw"System.ArithmeticException";return this.expTable[255-this.logTable[e]]},this.multiply=function(e,t){return 0==e||0==t?0:1==e?t:1==t?e:this.expTable[(this.logTable[e]+this.logTable[t])%255]}}function URShift(e,t){return e>=0?e>>t:(e>>t)+(2<<~t)}function FinderPattern(e,t,n){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=n,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,n){if(Math.abs(t-this.y)<=e&&Math.abs(n-this.x)<=e){var i=Math.abs(e-this.estimatedModuleSize);return 1>=i||i/this.estimatedModuleSize<=1}return!1}}function FinderPatternInfo(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2],this.__defineGetter__("BottomLeft",function(){return this.bottomLeft}),this.__defineGetter__("TopLeft",function(){return this.topLeft}),this.__defineGetter__("TopRight",function(){return this.topRight})}function FinderPatternFinder(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=new Array(0,0,0,0,0),this.resultPointCallback=null,this.__defineGetter__("CrossCheckStateCount",function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}),this.foundPatternCross=function(e){for(var t=0,n=0;5>n;n++){var i=e[n];if(0==i)return!1;t+=i}if(7>t)return!1;var r=Math.floor((t<<INTEGER_MATH_SHIFT)/7),o=Math.floor(r/2);return Math.abs(r-(e[0]<<INTEGER_MATH_SHIFT))<o&&Math.abs(r-(e[1]<<INTEGER_MATH_SHIFT))<o&&Math.abs(3*r-(e[2]<<INTEGER_MATH_SHIFT))<3*o&&Math.abs(r-(e[3]<<INTEGER_MATH_SHIFT))<o&&Math.abs(r-(e[4]<<INTEGER_MATH_SHIFT))<o},this.centerFromEnd=function(e,t){return t-e[4]-e[3]-e[2]/2},this.crossCheckVertical=function(e,t,n,i){for(var r=this.image,o=qrcode.height,a=this.CrossCheckStateCount,s=e;s>=0&&r[t+s*qrcode.width];)a[2]++,s--;if(0>s)return NaN;for(;s>=0&&!r[t+s*qrcode.width]&&a[1]<=n;)a[1]++,s--;if(0>s||a[1]>n)return NaN;for(;s>=0&&r[t+s*qrcode.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=e+1;o>s&&r[t+s*qrcode.width];)a[2]++,s++;if(s==o)return NaN;for(;o>s&&!r[t+s*qrcode.width]&&a[3]<n;)a[3]++,s++;if(s==o||a[3]>=n)return NaN;for(;o>s&&r[t+s*qrcode.width]&&a[4]<n;)a[4]++,s++;if(a[4]>=n)return NaN;var u=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(u-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},this.crossCheckHorizontal=function(e,t,n,i){for(var r=this.image,o=qrcode.width,a=this.CrossCheckStateCount,s=e;s>=0&&r[s+t*qrcode.width];)a[2]++,s--;if(0>s)return NaN;for(;s>=0&&!r[s+t*qrcode.width]&&a[1]<=n;)a[1]++,s--;if(0>s||a[1]>n)return NaN;for(;s>=0&&r[s+t*qrcode.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=e+1;o>s&&r[s+t*qrcode.width];)a[2]++,s++;if(s==o)return NaN;for(;o>s&&!r[s+t*qrcode.width]&&a[3]<n;)a[3]++,s++;if(s==o||a[3]>=n)return NaN;for(;o>s&&r[s+t*qrcode.width]&&a[4]<n;)a[4]++,s++;if(a[4]>=n)return NaN;var u=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(u-i)>=i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},this.handlePossibleCenter=function(e,t,n){var i=e[0]+e[1]+e[2]+e[3]+e[4],r=this.centerFromEnd(e,n),o=this.crossCheckVertical(t,Math.floor(r),e[2],i);if(!isNaN(o)&&(r=this.crossCheckHorizontal(Math.floor(r),Math.floor(o),e[2],i),!isNaN(r))){for(var a=i/7,s=!1,u=this.possibleCenters.length,c=0;u>c;c++){var l=this.possibleCenters[c];if(l.aboutEquals(a,o,r)){l.incrementCount(),s=!0;break}}if(!s){var d=new FinderPattern(r,o,a);this.possibleCenters.push(d),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(d)}return!0}return!1},this.selectBestPatterns=function(){var e=this.possibleCenters.length;if(3>e)throw"Couldn't find enough finder patterns";if(e>3){for(var t=0,n=0,i=0;e>i;i++){var r=this.possibleCenters[i].EstimatedModuleSize;t+=r,n+=r*r}var o=t/e;this.possibleCenters.sort(function(e,t){var n=Math.abs(t.EstimatedModuleSize-o),i=Math.abs(e.EstimatedModuleSize-o);return i>n?-1:n==i?0:1});for(var a=Math.sqrt(n/e-o*o),s=Math.max(.2*o,a),i=0;i<this.possibleCenters.length&&this.possibleCenters.length>3;i++){var u=this.possibleCenters[i];Math.abs(u.EstimatedModuleSize-o)>s&&(this.possibleCenters.remove(i),i--)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(e,t){return e.count>t.count?-1:e.count<t.count?1:0}),new Array(this.possibleCenters[0],this.possibleCenters[1],this.possibleCenters[2])},this.findRowSkip=function(){var e=this.possibleCenters.length;if(1>=e)return 0;for(var t=null,n=0;e>n;n++){var i=this.possibleCenters[n];if(i.Count>=CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.X-i.X)-Math.abs(t.Y-i.Y))/2);t=i}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var e=0,t=0,n=this.possibleCenters.length,i=0;n>i;i++){var r=this.possibleCenters[i];r.Count>=CENTER_QUORUM&&(e++,t+=r.EstimatedModuleSize)}if(3>e)return!1;for(var o=t/n,a=0,i=0;n>i;i++)r=this.possibleCenters[i],a+=Math.abs(r.EstimatedModuleSize-o);return.05*t>=a},this.findFinderPattern=function(e){var t=!1;this.image=e;var n=qrcode.height,i=qrcode.width,r=Math.floor(3*n/(4*MAX_MODULES));(MIN_SKIP>r||t)&&(r=MIN_SKIP);for(var o=!1,a=new Array(5),s=r-1;n>s&&!o;s+=r){a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0;for(var u=0,c=0;i>c;c++)if(e[c+s*qrcode.width])1==(1&u)&&u++,a[u]++;else if(0==(1&u))if(4==u)if(this.foundPatternCross(a)){var l=this.handlePossibleCenter(a,s,c);if(l)if(r=2,this.hasSkipped)o=this.haveMultiplyConfirmedCenters();else{var d=this.findRowSkip();d>a[2]&&(s+=d-a[2]-r,c=i-1)}else{do c++;while(i>c&&!e[c+s*qrcode.width]);c--}u=0,a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0}else a[0]=a[2],a[1]=a[3],a[2]=a[4],a[3]=1,a[4]=0,u=3;else a[++u]++;else a[u]++;if(this.foundPatternCross(a)){var l=this.handlePossibleCenter(a,s,i);l&&(r=a[0],this.hasSkipped&&(o=haveMultiplyConfirmedCenters()))}}var h=this.selectBestPatterns();return qrcode.orderBestPatterns(h),new FinderPatternInfo(h)}}function AlignmentPattern(e,t,n){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=n,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,n){if(Math.abs(t-this.y)<=e&&Math.abs(n-this.x)<=e){var i=Math.abs(e-this.estimatedModuleSize);return 1>=i||i/this.estimatedModuleSize<=1}return!1}}function AlignmentPatternFinder(e,t,n,i,r,o,a){this.image=e,this.possibleCenters=new Array,this.startX=t,this.startY=n,this.width=i,this.height=r,this.moduleSize=o,this.crossCheckStateCount=new Array(0,0,0),this.resultPointCallback=a,this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize,n=t/2,i=0;3>i;i++)if(Math.abs(t-e[i])>=n)return!1;return!0},this.crossCheckVertical=function(e,t,n,i){var r=this.image,o=qrcode.height,a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;for(var s=e;s>=0&&r[t+s*qrcode.width]&&a[1]<=n;)a[1]++,s--;if(0>s||a[1]>n)return NaN;for(;s>=0&&!r[t+s*qrcode.width]&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=e+1;o>s&&r[t+s*qrcode.width]&&a[1]<=n;)a[1]++,s++;if(s==o||a[1]>n)return NaN;for(;o>s&&!r[t+s*qrcode.width]&&a[2]<=n;)a[2]++,s++;if(a[2]>n)return NaN;var u=a[0]+a[1]+a[2];return 5*Math.abs(u-i)>=2*i?NaN:this.foundPatternCross(a)?this.centerFromEnd(a,s):NaN},this.handlePossibleCenter=function(e,t,n){var i=e[0]+e[1]+e[2],r=this.centerFromEnd(e,n),o=this.crossCheckVertical(t,Math.floor(r),2*e[1],i);if(!isNaN(o)){for(var a=(e[0]+e[1]+e[2])/3,s=this.possibleCenters.length,u=0;s>u;u++){var c=this.possibleCenters[u];if(c.aboutEquals(a,o,r))return new AlignmentPattern(r,o,a)}var l=new AlignmentPattern(r,o,a);this.possibleCenters.push(l),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(l)}return null},this.find=function(){for(var t=this.startX,r=this.height,o=t+i,a=n+(r>>1),s=new Array(0,0,0),u=0;r>u;u++){var c=a+(0==(1&u)?u+1>>1:-(u+1>>1));s[0]=0,s[1]=0,s[2]=0;for(var l=t;o>l&&!e[l+qrcode.width*c];)l++;for(var d=0;o>l;){if(e[l+c*qrcode.width])if(1==d)s[d]++;else if(2==d){if(this.foundPatternCross(s)){var h=this.handlePossibleCenter(s,c,l);if(null!=h)return h}s[0]=s[2],s[1]=1,s[2]=0,d=1}else s[++d]++;else 1==d&&d++,s[d]++;l++}if(this.foundPatternCross(s)){var h=this.handlePossibleCenter(s,c,o);if(null!=h)return h}}if(0!=this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}function QRCodeDataBlockReader(e,t,n){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=n,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t=0;if(e<this.bitPointer+1){for(var n=0,i=0;e>i;i++)n+=1<<i;return n<<=this.bitPointer-e+1,t=(this.blocks[this.blockPointer]&n)>>this.bitPointer-e+1,this.bitPointer-=e,t}if(e<this.bitPointer+1+8){for(var r=0,i=0;i<this.bitPointer+1;i++)r+=1<<i;return t=(this.blocks[this.blockPointer]&r)<<e-(this.bitPointer+1),this.blockPointer++,t+=this.blocks[this.blockPointer]>>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}if(e<this.bitPointer+1+16){for(var r=0,o=0,i=0;i<this.bitPointer+1;i++)r+=1<<i;var a=(this.blocks[this.blockPointer]&r)<<e-(this.bitPointer+1);this.blockPointer++;var s=this.blocks[this.blockPointer]<<e-(this.bitPointer+1+8);this.blockPointer++;for(var i=0;i<e-(this.bitPointer+1+8);i++)o+=1<<i;o<<=8-(e-(this.bitPointer+1+8));var u=(this.blocks[this.blockPointer]&o)>>8-(e-(this.bitPointer+1+8));return t=a+s+u,this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;;){if(e>>t==1)break;t++}return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,n=0,i="",r=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(t>1){n=this.getNextBits(11);var o=Math.floor(n/45),a=n%45;i+=r[o],i+=r[a],t-=2}else 1==t&&(n=this.getNextBits(6),i+=r[n],t-=1);while(t>0);return i},this.getFigureString=function(e){var t=e,n=0,i="";do t>=3?(n=this.getNextBits(10),100>n&&(i+="0"),10>n&&(i+="0"),t-=3):2==t?(n=this.getNextBits(7),10>n&&(i+="0"),t-=2):1==t&&(n=this.getNextBits(4),t-=1),i+=n;while(t>0);return i},this.get8bitByteArray=function(e){var t=e,n=0,i=new Array;do n=this.getNextBits(8),i.push(n),t--;while(t>0);return i},this.getKanjiString=function(e){var t=e,n=0,i="";do{n=getNextBits(13);var r=n%192,o=n/192,a=(o<<8)+r,s=0;s=40956>=a+33088?a+33088:a+49472,i+=String.fromCharCode(s),t--}while(t>0);return i},this.__defineGetter__("DataByte",function(){for(var e=new Array,t=1,n=2,i=4,r=8;;){var o=this.NextMode();if(0==o){if(e.length>0)break;throw"Empty data block"}if(o!=t&&o!=n&&o!=i&&o!=r)throw"Invalid mode: "+o+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(dataLength=this.getDataLength(o),dataLength<1)throw"Invalid data length: "+dataLength;switch(o){case t:for(var a=this.getFigureString(dataLength),s=new Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);e.push(s);break;case n:for(var a=this.getRomanAndFigureString(dataLength),s=new Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);e.push(s);break;case i:var c=this.get8bitByteArray(dataLength);e.push(c);break;case r:var a=this.getKanjiString(dataLength);e.push(a)}}return e})}!function(e,t){var n=function(){var t=e._data(document,"events");return t&&t.click&&e.grep(t.click,function(e){return"rails"===e.namespace}).length};n()&&e.error("jquery-ujs has already been loaded!");var i;e.rails=i={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input:file",linkDisableSelector:"a[data-disable-with]",CSRFProtection:function(t){var n=e('meta[name="csrf-token"]').attr("content");n&&t.setRequestHeader("X-CSRF-Token",n)},fire:function(t,n,i){var r=e.Event(n);return t.trigger(r,i),r.result!==!1},confirm:function(e){try{return confirm(e)}catch(t){return!1}},ajax:function(t){return e.ajax(t)},href:function(e){return e.attr("href")},handleRemote:function(n){var r,o,a,s,u,c,l,d;if(i.fire(n,"ajax:before")){if(s=n.data("cross-domain"),u=s===t?null:s,c=n.data("with-credentials")||null,l=n.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType,n.is("form")){r=n.attr("method"),o=n.attr("action"),a=n.serializeArray();var h=n.data("ujs:submit-button");h&&(a.push(h),n.data("ujs:submit-button",null))}else n.is(i.inputChangeSelector)?(r=n.data("method"),o=n.data("url"),a=n.serialize(),n.data("params")&&(a=a+"&"+n.data("params"))):(r=n.data("method"),o=i.href(n),a=n.data("params")||null);d={type:r||"GET",data:a,dataType:l,beforeSend:function(e,r){return r.dataType===t&&e.setRequestHeader("accept","*/*;q=0.5, "+r.accepts.script),i.fire(n,"ajax:beforeSend",[e,r])},success:function(e,t,i){n.trigger("ajax:success",[e,t,i])},complete:function(e,t){n.trigger("ajax:complete",[e,t])},error:function(e,t,i){n.trigger("ajax:error",[e,t,i])},xhrFields:{withCredentials:c},crossDomain:u},o&&(d.url=o);var f=i.ajax(d);return n.trigger("ajax:send",f),f}return!1},handleMethod:function(n){var r=i.href(n),o=n.data("method"),a=n.attr("target"),s=e("meta[name=csrf-token]").attr("content"),u=e("meta[name=csrf-param]").attr("content"),c=e('<form method="post" action="'+r+'"></form>'),l='<input name="_method" value="'+o+'" type="hidden" />';u!==t&&s!==t&&(l+='<input name="'+u+'" value="'+s+'" type="hidden" />'),a&&c.attr("target",a),c.hide().append(l).appendTo("body"),c.submit()},disableFormElements:function(t){t.find(i.disableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with",t[n]()),t[n](t.data("disable-with")),t.prop("disabled",!0)})},enableFormElements:function(t){t.find(i.enableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with")&&t[n](t.data("ujs:enable-with")),t.prop("disabled",!1)})},allowAction:function(e){var t,n=e.data("confirm"),r=!1;return n?(i.fire(e,"confirm")&&(r=i.confirm(n),t=i.fire(e,"confirm:complete",[r])),r&&t):!0},blankInputs:function(t,n,i){var r,o,a=e(),s=n||"input,textarea",u=t.find(s);return u.each(function(){if(r=e(this),o=r.is(":checkbox,:radio")?r.is(":checked"):r.val(),!o==!i){if(r.is(":radio")&&u.filter('input:radio:checked[name="'+r.attr("name")+'"]').length)return!0;a=a.add(r)}}),a.length?a:!1},nonBlankInputs:function(e,t){return i.blankInputs(e,t,!0)},stopEverything:function(t){return e(t.target).trigger("ujs:everythingStopped"),t.stopImmediatePropagation(),!1},callFormSubmitBindings:function(n,i){var r=n.data("events"),o=!0;return r!==t&&r.submit!==t&&e.each(r.submit,function(e,t){return"function"==typeof t.handler?o=t.handler(i):void 0}),o},disableElement:function(e){e.data("ujs:enable-with",e.html()),e.html(e.data("disable-with")),e.addClass("disabled"),e.bind("click.railsDisable",function(e){return i.stopEverything(e)})},enableElement:function(e){e.data("ujs:enable-with")!==t&&(e.html(e.data("ujs:enable-with")),e.removeClass("disabled"),e.data("ujs:enable-with",!1)),e.unbind("click.railsDisable")}},i.fire(e(document),"rails:attachBindings")&&(e.ajaxPrefilter(function(e,t,n){e.crossDomain||i.CSRFProtection(n)}),e(document).delegate(i.linkDisableSelector,"ajax:complete",function(){i.enableElement(e(this))}),e(document).delegate(i.linkClickSelector,"click.rails",function(n){var r=e(this),o=r.data("method"),a=r.data("params");if(!i.allowAction(r))return i.stopEverything(n);if(r.is(i.linkDisableSelector)&&i.disableElement(r),r.data("remote")!==t){if((n.metaKey||n.ctrlKey)&&(!o||"GET"===o)&&!a)return!0;var s=i.handleRemote(r);return s===!1?i.enableElement(r):s.error(function(){i.enableElement(r)}),!1}return r.data("method")?(i.handleMethod(r),!1):void 0}),e(document).delegate(i.inputChangeSelector,"change.rails",function(t){var n=e(this);return i.allowAction(n)?(i.handleRemote(n),!1):i.stopEverything(t)}),e(document).delegate(i.formSubmitSelector,"submit.rails",function(n){var r=e(this),o=r.data("remote")!==t,a=i.blankInputs(r,i.requiredInputSelector),s=i.nonBlankInputs(r,i.fileInputSelector);if(!i.allowAction(r))return i.stopEverything(n);if(a&&r.attr("novalidate")==t&&i.fire(r,"ajax:aborted:required",[a]))return i.stopEverything(n);if(o){if(s){setTimeout(function(){i.disableFormElements(r)},13);var u=i.fire(r,"ajax:aborted:file",[s]);return u||setTimeout(function(){i.enableFormElements(r)},13),u}return!e.support.submitBubbles&&e().jquery<"1.7"&&i.callFormSubmitBindings(r,n)===!1?i.stopEverything(n):(i.handleRemote(r),!1)}setTimeout(function(){i.disableFormElements(r)},13)}),e(document).delegate(i.formInputClickSelector,"click.rails",function(t){var n=e(this);if(!i.allowAction(n))return i.stopEverything(t);var r=n.attr("name"),o=r?{name:r,value:n.val()}:null;n.closest("form").data("ujs:submit-button",o)}),e(document).delegate(i.formSubmitSelector,"ajax:beforeSend.rails",function(t){this==t.target&&i.disableFormElements(e(this))}),e(document).delegate(i.formSubmitSelector,"ajax:complete.rails",function(t){this==t.target&&i.enableFormElements(e(this))}),e(function(){csrf_token=e("meta[name=csrf-token]").attr("content"),csrf_param=e("meta[name=csrf-param]").attr("content"),e('form input[name="'+csrf_param+'"]').val(csrf_token)}))}(jQuery),function(e,t){function n(e,t){return e&&t&&e.type===t.type&&e.name===t.name&&h(e.metaData,t.metaData)}function i(e){try{if("function"!=typeof e)return e;if(!e.bugsnag){var t=u();e.bugsnag=function(){if(D=t,!M){var n=e.apply(this,arguments);return D=null,n}try{return e.apply(this,arguments)}catch(i){throw C("autoNotify",!0)&&($.notifyException(i,null,null,"error"),P()),i}finally{D=null}},e.bugsnag.bugsnag=e.bugsnag}return e.bugsnag}catch(n){return e}}function r(){if(L){var t=function(e){if(E("autoBreadcrumbsClicks")){var t,n;try{t=f(e.target),n=p(e.target)}catch(i){t="[hidden]",n="[hidden]",d("Cross domain error when tracking click event. See https://docs.bugsnag.com/platforms/browsers/faq/#3-cross-origin-script-errors")}$.leaveBreadcrumb({type:"user",name:"UI click",metaData:{targetText:t,targetSelector:n}})}};e.addEventListener("click",t,!0)}}function o(){function t(e,t){E("autoBreadcrumbsConsole")&&$.leaveBreadcrumb({type:"log",name:"Console output",metaData:{severity:e,message:Array.prototype.slice.call(t).join(", ")}})}if("undefined"!=typeof e.console){var n=console.log,i=console.warn,r=console.error;$.enableAutoBreadcrumbsConsole=function(){$.autoBreadcrumbsConsole=!0,l(console,"log",function(){t("log",arguments)}),l(console,"warn",function(){t("warn",arguments)}),l(console,"error",function(){t("error",arguments)})},$.disableAutoBreadcrumbsConsole=function(){$.autoBreadcrumbsConsole=!1,console.log=n,console.warn=i,console.error=r},E("autoBreadcrumbsConsole")&&$.enableAutoBreadcrumbsConsole()}}function a(){function t(e){return e.split("#")[1]||""}function n(e){var n=e.oldURL,i=e.newURL,r={};return n&&i?(r.from=t(n),r.to=t(i)):r.to=location.hash,{type:"navigation",name:"Hash changed",metaData:r}}function i(){return{type:"navigation",name:"Navigated back"}}function r(){return{type:"navigation",name:"Page hidden"}}function o(){return{type:"navigation",name:"Page shown"}}function a(){return{type:"navigation",name:"Page loaded"}}function s(){return{type:"navigation",name:"DOMContentLoaded"}}function u(e,t,n,i){var r=location.pathname+location.search+location.hash;return{type:"navigation",name:"History "+e,metaData:{from:r,to:i||r,prevState:history.state,nextState:t}}}function c(e,t,n){return u("pushState",e,t,n)}function d(e,t,n){return u("replaceState",e,t,n)}function h(e){return function(){E("autoBreadcrumbsNavigation")&&$.leaveBreadcrumb(e.apply(null,arguments))}}if(L&&e.history&&e.history.state&&e.history.pushState&&e.history.pushState.bind){var f=history.pushState,p=history.replaceState;$.enableAutoBreadcrumbsNavigation=function(){$.autoBreadcrumbsNavigation=!0,l(history,"pushState",h(c)),l(history,"replaceState",h(d))},$.disableAutoBreadcrumbsNavigation=function(){$.autoBreadcrumbsNavigation=!1,history.pushState=f,history.replaceState=p},e.addEventListener("hashchange",h(n),!0),e.addEventListener("popstate",h(i),!0),e.addEventListener("pagehide",h(r),!0),e.addEventListener("pageshow",h(o),!0),e.addEventListener("load",h(a),!0),e.addEventListener("DOMContentLoaded",h(s),!0),E("autoBreadcrumbsNavigation")&&$.enableAutoBreadcrumbsNavigation()}}function s(){V=!1}function u(){var e=document.currentScript||D;if(!e&&V){var t=document.scripts||document.getElementsByTagName("script");e=t[t.length-1]}return e}function c(e){var t=u();t&&(e.script={src:t.src,content:C("inlineScript",!0)?t.innerHTML:""})}function l(e,t,n){var i=e[t];e[t]=function(){n.apply(this,arguments),"function"==typeof i&&i.apply(this,arguments)}}function d(t){var n=C("disableLog"),i=e.console;void 0===i||void 0===i.log||n||i.log("[Bugsnag] "+t)}function h(e,t){return y(e)===y(t)}function f(e){var t=e.textContent||e.innerText||"";return("submit"===e.type||"button"===e.type)&&(t=e.value),t=t.replace(/^\s+|\s+$/g,""),g(t,140)}function p(e){var t=[e.tagName];if(e.id&&t.push("#"+e.id),e.className&&e.className.length){var n="."+e.className.split(" ").join(".");t.push(n)}var i=t.join("");if(!document.querySelectorAll||!Array.prototype.indexOf)return i;try{if(1===document.querySelectorAll(i).length)return i}catch(r){return i}if(e.parentNode.childNodes.length>1){var o=Array.prototype.indexOf.call(e.parentNode.childNodes,e)+1;i=i+":nth-child("+o+")"}return 1===document.querySelectorAll(i).length?i:e.parentNode?p(e.parentNode)+" > "+i:i}function g(e,t){var n="(...)";return e&&e.length>t?e.slice(0,t-n.length)+n:e}function m(e){return"[object Array]"===Object.prototype.toString.call(e)}function v(e,t,n){var i=(n||0)+1,r=C("maxDepth",U);if(n>r)return"[RECURSIVE]";if("string"==typeof e)return g(e,t);if(m(e)){for(var o=[],a=0;a<e.length;a++)o[a]=v(e[a],t,i);return o}if("object"==typeof e&&null!=e){var s={};for(var u in e)e.hasOwnProperty(u)&&(s[u]=v(e[u],t,i));return s}return e}function y(t,n,i){var r=C("maxDepth",U);if(i>=r)return encodeURIComponent(n)+"=[RECURSIVE]";i=i+1||1;try{if(e.Node&&t instanceof e.Node)return encodeURIComponent(n)+"="+encodeURIComponent(B(t));var o=[];for(var a in t)if(t.hasOwnProperty(a)&&null!=a&&null!=t[a]){var s=n?n+"["+a+"]":a,u=t[a];o.push("object"==typeof u?y(u,s,i):encodeURIComponent(s)+"="+encodeURIComponent(u))}return o.sort().join("&")}catch(c){return encodeURIComponent(n)+"="+encodeURIComponent(""+c)}}function b(e,t,n){if(null==t)return e;if(n>=C("maxDepth",U))return"[RECURSIVE]";e=e||{};for(var i in t)if(t.hasOwnProperty(i))try{t[i].constructor===Object?e[i]=b(e[i],t[i],n+1||1):e[i]=t[i]}catch(r){e[i]=t[i]}return e}function w(e,t){if(e+="?"+y(t)+"&ct=img&cb="+(new Date).getTime(),"undefined"!=typeof BUGSNAG_TESTING&&$.testRequest)$.testRequest(e,t);else{var n=C("notifyHandler");if("xhr"===n){var i=new XMLHttpRequest;i.open("GET",e,!0),i.send()}else{var r=new Image;r.src=e}}}function _(e){var t={},n=/^data\-([\w\-]+)$/;if(e)for(var i=e.attributes,r=0;r<i.length;r++){var o=i[r];if(n.test(o.nodeName)){var a=o.nodeName.match(n)[1];t[a]=o.value||o.nodeValue}}return t}function C(e,t){W=W||_(Y);var n=void 0!==$[e]?$[e]:W[e.toLowerCase()];return"false"===n&&(n=!1),void 0!==n?n:t}function k(e){return e&&e.match(H)?!0:(d("Invalid API key '"+e+"'"),!1)}function E(e){var t=C("autoBreadcrumbs",!0);return C(e,t)}function S(t,n){var i=C("apiKey");if(k(i)&&N){N-=1;var r=C("releaseStage","production"),o=C("notifyReleaseStages");if(o){for(var a=!1,s=0;s<o.length;s++)if(r===o[s]){a=!0;break}if(!a)return}var u=[t.name,t.message,t.stacktrace].join("|");if(u!==O){O=u;var c={device:{time:(new Date).getTime()}},l={notifierVersion:X,apiKey:i,projectRoot:C("projectRoot")||e.location.protocol+"//"+e.location.host,context:C("context")||e.location.pathname,user:C("user"),metaData:b(b(c,C("metaData")),n),releaseStage:r,appVersion:C("appVersion"),url:e.location.href,userAgent:navigator.userAgent,language:navigator.language||navigator.userLanguage,severity:t.severity,name:t.name,message:t.message,stacktrace:t.stacktrace,file:t.file,lineNumber:t.lineNumber,columnNumber:t.columnNumber,breadcrumbs:I,payloadVersion:"3"},h=$.beforeNotify;if("function"==typeof h){var f=h(l,l.metaData);if(f===!1)return}return 0===l.lineNumber&&/Script error\.?/.test(l.message)?d("Ignoring cross-domain or eval script error. See https://docs.bugsnag.com/platforms/browsers/faq/#3-cross-origin-script-errors"):void w(C("endpoint")||z,l)}}}function x(){var e,t,n=10,i="[anonymous]";try{throw new Error("")}catch(r){e="<generated>\n",t=T(r)}if(!t){e="<generated-ie>\n";var o=[];try{for(var a=arguments.callee.caller.caller;a&&o.length<n;){var s=q.test(a.toString())?RegExp.$1||i:i;o.push(s),a=a.caller}}catch(u){d(u)}t=o.join("\n")}return e+t}function T(e){return e.stack||e.backtrace||e.stacktrace}function B(e){if(e){var t=e.attributes;if(t){for(var n="<"+e.nodeName.toLowerCase(),i=0;i<t.length;i++)t[i].value&&"null"!==t[i].value.toString()&&(n+=" "+t[i].name+'="'+t[i].value+'"');return n+">"}return e.nodeName}}function P(){F+=1,e.setTimeout(function(){F-=1})}function A(t,n,i){var r=t[n],o=i(r);t[n]=o,"undefined"!=typeof BUGSNAG_TESTING&&e.undo&&e.undo.push(function(){t[n]=r})}var D,O,$={},M=!0,F=0,I=[],R=40,j="BugsnagNotify",N=10,U=5;$.breadcrumbLimit=20,$.noConflict=function(){return e.Bugsnag=t,"undefined"==typeof t&&delete e.Bugsnag,$},$.refresh=function(){N=10},$.notifyException=function(e,t,n,i){if(!e){var r="Bugsnag.notifyException() was called with no arguments";return d(r),void $.notify(j,r)}return"string"==typeof e?(d("Bugsnag.notifyException() was called with a string. Expected instance of Error. To send a custom message instantiate a new Error or use Bugsnag.notify('<string>'). see https://docs.bugsnag.com/platforms/browsers/#reporting-handled-exceptions"),void $.notify.apply(null,arguments)):(t&&"string"!=typeof t&&(n=t,t=void 0),n||(n={}),c(n),void S({name:t||e.name,message:e.message||e.description,stacktrace:T(e)||x(),file:e.fileName||e.sourceURL,lineNumber:e.lineNumber||e.line,columnNumber:e.columnNumber?e.columnNumber+1:void 0,severity:i||"warning"},n))},$.notify=function(t,n,i,r){t||(t=j,n="Bugsnag.notify() was called with no arguments",d(n)),S({name:t,message:n,stacktrace:x(),file:e.location.toString(),lineNumber:1,severity:r||"warning"},i)},$.leaveBreadcrumb=function(e,t){var i="manual",r={type:i,name:"Manual",timestamp:(new Date).getTime()};switch(typeof e){case"object":r=b(r,e);break;case"string":t&&"object"==typeof t?r=b(r,{name:e,metaData:t}):r.metaData={message:e};break;default:return void d("expecting 1st argument to leaveBreadcrumb to be a 'string' or 'object', got "+typeof e)}for(var o=[i,"error","log","navigation","process","request","state","user"],a=!1,s=0;s<o.length;s++)if(o[s]===r.type){a=!0;break}a||(d("Converted invalid breadcrumb type '"+r.type+"' to '"+i+"'"),r.type=i);var u=I.slice(-1)[0];if(n(r,u))u.count=u.count||1,u.count++;else{var c=Math.min($.breadcrumbLimit,R);r.name=g(r.name,32),
I.push(v(r,140)),I.length>c&&(I=I.slice(-c))}};var L="undefined"!=typeof e.addEventListener;$.enableAutoBreadcrumbsConsole=function(){},$.disableAutoBreadcrumbsConsole=function(){},$.enableAutoBreadcrumbsNavigation=function(){},$.disableAutoBreadcrumbsNavigation=function(){},$.enableAutoBreadcrumbsErrors=function(){$.autoBreadcrumbsErrors=!0},$.disableAutoBreadcrumbsErrors=function(){$.autoBreadcrumbsErrors=!1},$.enableAutoBreadcrumbsClicks=function(){$.autoBreadcrumbsClicks=!0},$.disableAutoBreadcrumbsClicks=function(){$.autoBreadcrumbsClicks=!1},$.enableAutoBreadcrumbs=function(){$.enableAutoBreadcrumbsClicks(),$.enableAutoBreadcrumbsConsole(),$.enableAutoBreadcrumbsErrors(),$.enableAutoBreadcrumbsNavigation()},$.disableAutoBreadcrumbs=function(){$.disableAutoBreadcrumbsClicks(),$.disableAutoBreadcrumbsConsole(),$.disableAutoBreadcrumbsErrors(),$.disableAutoBreadcrumbsNavigation()},$.enableNotifyUnhandledRejections=function(){$.notifyUnhandledRejections=!0},$.disableNotifyUnhandledRejections=function(){$.notifyUnhandledRejections=!1};var V="complete"!==document.readyState;document.addEventListener?(document.addEventListener("DOMContentLoaded",s,!0),e.addEventListener("load",s,!0)):e.attachEvent("onload",s);var W,H=/^[0-9a-f]{32}$/i,q=/function\s*([\w\-$]+)?\s*\(/i,G="https://notify.bugsnag.com/",z=G+"js",X="3.2.0",K=document.getElementsByTagName("script"),Y=K[K.length-1];if(e.atob){if(e.ErrorEvent)try{0===new e.ErrorEvent("test").colno&&(M=!1)}catch(Q){}}else M=!1;if(C("autoNotify",!0)){A(e,"onerror",function(t){return"undefined"!=typeof BUGSNAG_TESTING&&($._onerror=t),function(n,i,r,o,a){var s=C("autoNotify",!0),u={};if(!o&&e.event&&(o=e.event.errorCharacter),c(u),D=null,s&&!F){var l=a&&a.name||"window.onerror";S({name:l,message:n,file:i,lineNumber:r,columnNumber:o,stacktrace:a&&T(a)||x(),severity:"error"},u),E("autoBreadcrumbsErrors")&&$.leaveBreadcrumb({type:"error",name:l,metaData:{severity:"error",file:i,message:n,line:r}})}"undefined"!=typeof BUGSNAG_TESTING&&(t=$._onerror),t&&t(n,i,r,o,a)}});var J=function(e){return function(t,n){if("function"==typeof t){t=i(t);var r=Array.prototype.slice.call(arguments,2);return e(function(){t.apply(this,r)},n)}return e(t,n)}};A(e,"setTimeout",J),A(e,"setInterval",J),e.requestAnimationFrame&&A(e,"requestAnimationFrame",function(e){return function(t){return e(i(t))}}),e.setImmediate&&A(e,"setImmediate",function(e){return function(){var t=Array.prototype.slice.call(arguments);return t[0]=i(t[0]),e.apply(this,t)}}),"onunhandledrejection"in e&&e.addEventListener("unhandledrejection",function(e){if(C("notifyUnhandledRejections",!1)){var t=e.reason;t&&(t instanceof Error||t.message)?$.notifyException(t):$.notify("UnhandledRejection",t)}}),"EventTarget Window Node ApplicationCache AudioTrackList ChannelMergerNode CryptoOperation EventSource FileReader HTMLUnknownElement IDBDatabase IDBRequest IDBTransaction KeyOperation MediaController MessagePort ModalWindow Notification SVGElementInstance Screen TextTrack TextTrackCue TextTrackList WebSocket WebSocketWorker Worker XMLHttpRequest XMLHttpRequestEventTarget XMLHttpRequestUpload".replace(/\w+/g,function(t){var n=e[t]&&e[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(A(n,"addEventListener",function(e){return function(t,n,r,o){try{n&&n.handleEvent&&(n.handleEvent=i(n.handleEvent))}catch(a){d(a)}return e.call(this,t,i(n),r,o)}}),A(n,"removeEventListener",function(e){return function(t,n,r,o){return e.call(this,t,n,r,o),e.call(this,t,i(n),r,o)}}))})}r(),o(),a(),C("autoBreadcrumbs",!0)&&$.leaveBreadcrumb({type:"navigation",name:"Bugsnag Loaded"}),e.Bugsnag=$,"function"==typeof define&&define.amd?define([],function(){return $}):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=$)}(window,window.Bugsnag),function(){var e;Coinbase.constants.BUGSNAG_JS_API_KEY&&(null==window.Bugsnag&&(window.Bugsnag={}),Bugsnag.endpoint="https://exceptions.coinbase.com/js",Bugsnag.apiKey=Coinbase.constants.BUGSNAG_JS_API_KEY,Coinbase.constants.USER&&(Bugsnag.user={id:Coinbase.constants.USER.id}),e=function(){var e;return Bugsnag.metaData={state:{turbolinksIsDefined:"undefined"!=typeof Turbolinks&&null!==Turbolinks,turbolinksIsSupported:"undefined"!=typeof Turbolinks&&null!==Turbolinks?Turbolinks.supported:void 0,jqueryTurbolinksIsDefined:null!=$.turbo,jqueryTurbolinksIsReady:null!=(e=$.turbo)?e.isReady:void 0}}},Bugsnag.beforeNotify=function(){var t,n,i;if(t=Coinbase.metrics.browser){if(n=t.name,i=parseInt(t.version,10),"Internet Explorer"===n&&8>=i)return!1}else console.warn("`Coinbase.metrics.browser` is missing. Skipping old browser filter.");return e(),!0})}.call(this);try{!Object.prototype.__defineGetter__&&Object.defineProperty({},"x",{get:function(){return!0}}).x&&(Object.defineProperty(Object.prototype,"__defineGetter__",{enumerable:!1,configurable:!0,value:function(e,t){Object.defineProperty(this,e,{get:t,enumerable:!0,configurable:!0})}}),Object.defineProperty(Object.prototype,"__defineSetter__",{enumerable:!1,configurable:!0,value:function(e,t){Object.defineProperty(this,e,{set:t,enumerable:!0,configurable:!0})}}))}catch(defPropException){}!function(){function e(e){this.message=e}var t="undefined"!=typeof exports?exports:this,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",t.btoa||(t.btoa=function(t){for(var i,r,o=String(t),a=0,s=n,u="";o.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&i>>8-a%1*8)){if(r=o.charCodeAt(a+=.75),r>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");i=i<<8|r}return u}),t.atob||(t.atob=function(t){var i=String(t).replace(/=+$/,"");if(i.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,a=0,s=0,u="";o=i.charAt(s++);~o&&(r=a%4?64*r+o:o,a++%4)?u+=String.fromCharCode(255&r>>(-2*a&6)):0)o=n.indexOf(o);return u})}(),function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.returnExports=t()}(this,function(){function e(e){return e=+e,e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function t(e){var t=typeof e;return null===e||"undefined"===t||"boolean"===t||"number"===t||"string"===t}function n(e){var n,i,r;if(t(e))return e;if(i=e.valueOf,g(i)&&(n=i.call(e),t(n)))return n;if(r=e.toString,g(r)&&(n=r.call(e),t(n)))return n;throw new TypeError}function i(){}var r,o=Array.prototype,a=Object.prototype,s=Function.prototype,u=String.prototype,c=Number.prototype,l=o.slice,d=o.splice,h=(o.push,o.unshift),f=s.call,p=a.toString,g=function(e){return"[object Function]"===a.toString.call(e)},m=function(e){return"[object RegExp]"===a.toString.call(e)},v=function(e){return"[object Array]"===p.call(e)},y=function(e){return"[object String]"===p.call(e)},b=function(e){var t=p.call(e),n="[object Arguments]"===t;return n||(n=!v(e)&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&g(e.callee)),n},w=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(e){return!1}}();r=w?function(e,t,n,i){!i&&t in e||Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(e,t,n,i){!i&&t in e||(e[t]=n)};var _=function(e,t,n){for(var i in t)a.hasOwnProperty.call(t,i)&&r(e,i,t[i],n)},C=function(e){if(null==e)throw new TypeError("can't convert "+e+" to object");return Object(e)},k=function(e){return e>>>0};_(s,{bind:function(e){var t=this;if(!g(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var n=l.call(arguments,1),r=function(){if(this instanceof u){var i=t.apply(this,n.concat(l.call(arguments)));return Object(i)===i?i:this}return t.apply(e,n.concat(l.call(arguments)))},o=Math.max(0,t.length-n.length),a=[],s=0;o>s;s++)a.push("$"+s);var u=Function("binder","return function ("+a.join(",")+"){return binder.apply(this,arguments)}")(r);return t.prototype&&(i.prototype=t.prototype,u.prototype=new i,i.prototype=null),u}});var E,S,x,T,B,P=f.bind(a.hasOwnProperty);(B=P(a,"__defineGetter__"))&&(E=f.bind(a.__defineGetter__),S=f.bind(a.__defineSetter__),x=f.bind(a.__lookupGetter__),T=f.bind(a.__lookupSetter__));var A=function(){var e=[1,2],t=e.splice();return 2===e.length&&v(t)&&0===t.length}();_(o,{splice:function(e,t){return 0===arguments.length?[]:d.apply(this,arguments)}},A);var D=function(){var e={};return o.splice.call(e,0,0,1),1===e.length}();_(o,{splice:function(t,n){if(0===arguments.length)return[];var i=arguments;return this.length=Math.max(e(this.length),0),arguments.length>0&&"number"!=typeof n&&(i=l.call(arguments),i.length<2?i.push(this.length-t):i[1]=e(n)),d.apply(this,i)}},!D);var O=1!==[].unshift(0);_(o,{unshift:function(){return h.apply(this,arguments),this.length}},O),_(Array,{isArray:v});var $=Object("a"),M="a"!==$[0]||!(0 in $),F=function(e){var t=!0,n=!0;return e&&(e.call("foo",function(e,n,i){"object"!=typeof i&&(t=!1)}),e.call([1],function(){"use strict";n="string"==typeof this},"x")),!!e&&t&&n};_(o,{forEach:function(e){var t=C(this),n=M&&y(this)?this.split(""):t,i=arguments[1],r=-1,o=n.length>>>0;if(!g(e))throw new TypeError;for(;++r<o;)r in n&&e.call(i,n[r],r,t)}},!F(o.forEach)),_(o,{map:function(e){var t=C(this),n=M&&y(this)?this.split(""):t,i=n.length>>>0,r=Array(i),o=arguments[1];if(!g(e))throw new TypeError(e+" is not a function");for(var a=0;i>a;a++)a in n&&(r[a]=e.call(o,n[a],a,t));return r}},!F(o.map)),_(o,{filter:function(e){var t,n=C(this),i=M&&y(this)?this.split(""):n,r=i.length>>>0,o=[],a=arguments[1];if(!g(e))throw new TypeError(e+" is not a function");for(var s=0;r>s;s++)s in i&&(t=i[s],e.call(a,t,s,n)&&o.push(t));return o}},!F(o.filter)),_(o,{every:function(e){var t=C(this),n=M&&y(this)?this.split(""):t,i=n.length>>>0,r=arguments[1];if(!g(e))throw new TypeError(e+" is not a function");for(var o=0;i>o;o++)if(o in n&&!e.call(r,n[o],o,t))return!1;return!0}},!F(o.every)),_(o,{some:function(e){var t=C(this),n=M&&y(this)?this.split(""):t,i=n.length>>>0,r=arguments[1];if(!g(e))throw new TypeError(e+" is not a function");for(var o=0;i>o;o++)if(o in n&&e.call(r,n[o],o,t))return!0;return!1}},!F(o.some));var I=!1;o.reduce&&(I="object"==typeof o.reduce.call("es5",function(e,t,n,i){return i})),_(o,{reduce:function(e){var t=C(this),n=M&&y(this)?this.split(""):t,i=n.length>>>0;if(!g(e))throw new TypeError(e+" is not a function");if(!i&&1===arguments.length)throw new TypeError("reduce of empty array with no initial value");var r,o=0;if(arguments.length>=2)r=arguments[1];else for(;;){if(o in n){r=n[o++];break}if(++o>=i)throw new TypeError("reduce of empty array with no initial value")}for(;i>o;o++)o in n&&(r=e.call(void 0,r,n[o],o,t));return r}},!I);var R=!1;o.reduceRight&&(R="object"==typeof o.reduceRight.call("es5",function(e,t,n,i){return i})),_(o,{reduceRight:function(e){var t=C(this),n=M&&y(this)?this.split(""):t,i=n.length>>>0;if(!g(e))throw new TypeError(e+" is not a function");if(!i&&1===arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var r,o=i-1;if(arguments.length>=2)r=arguments[1];else for(;;){if(o in n){r=n[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}if(0>o)return r;do o in n&&(r=e.call(void 0,r,n[o],o,t));while(o--);return r}},!R);var j=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);_(o,{indexOf:function(t){var n=M&&y(this)?this.split(""):C(this),i=n.length>>>0;if(!i)return-1;var r=0;for(arguments.length>1&&(r=e(arguments[1])),r=r>=0?r:Math.max(0,i+r);i>r;r++)if(r in n&&n[r]===t)return r;return-1}},j);var N=Array.prototype.lastIndexOf&&-1!==[0,1].lastIndexOf(0,-3);_(o,{lastIndexOf:function(t){var n=M&&y(this)?this.split(""):C(this),i=n.length>>>0;if(!i)return-1;var r=i-1;for(arguments.length>1&&(r=Math.min(r,e(arguments[1]))),r=r>=0?r:i-Math.abs(r);r>=0;r--)if(r in n&&t===n[r])return r;return-1}},N);var U=!{toString:null}.propertyIsEnumerable("toString"),L=function(){}.propertyIsEnumerable("prototype"),V=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],W=V.length;_(Object,{keys:function(e){var t=g(e),n=b(e),i=null!==e&&"object"==typeof e,r=i&&y(e);if(!i&&!t&&!n)throw new TypeError("Object.keys called on a non-object");var o=[],a=L&&t;if(r||n)for(var s=0;s<e.length;++s)o.push(String(s));else for(var u in e)a&&"prototype"===u||!P(e,u)||o.push(String(u));if(U)for(var c=e.constructor,l=c&&c.prototype===e,d=0;W>d;d++){var h=V[d];l&&"constructor"===h||!P(e,h)||o.push(h)}return o}});var H=Object.keys&&function(){return 2===Object.keys(arguments).length}(1,2),q=Object.keys;_(Object,{keys:function(e){return q(b(e)?o.slice.call(e):e)}},!H);var G=-621987552e5,z="-000001",X=Date.prototype.toISOString&&-1===new Date(G).toISOString().indexOf(z);_(Date.prototype,{toISOString:function(){var e,t,n,i,r;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");for(i=this.getUTCFullYear(),r=this.getUTCMonth(),i+=Math.floor(r/12),r=(r%12+12)%12,e=[r+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],i=(0>i?"-":i>9999?"+":"")+("00000"+Math.abs(i)).slice(i>=0&&9999>=i?-4:-6),t=e.length;t--;)n=e[t],10>n&&(e[t]="0"+n);return i+"-"+e.slice(0,2).join("-")+"T"+e.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}},X);var K=!1;try{K=Date.prototype.toJSON&&null===new Date(NaN).toJSON()&&-1!==new Date(G).toJSON().indexOf(z)&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(Y){}K||(Date.prototype.toJSON=function(e){var t,i=Object(this),r=n(i);if("number"==typeof r&&!isFinite(r))return null;if(t=i.toISOString,"function"!=typeof t)throw new TypeError("toISOString property is not callable");return t.call(i)});var Q=1e15===Date.parse("+033658-09-27T01:46:40.000Z"),J=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z")),Z=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));(!Date.parse||Z||J||!Q)&&(Date=function(e){function t(n,i,r,o,a,s,u){var c=arguments.length;if(this instanceof e){var l=1===c&&String(n)===n?new e(t.parse(n)):c>=7?new e(n,i,r,o,a,s,u):c>=6?new e(n,i,r,o,a,s):c>=5?new e(n,i,r,o,a):c>=4?new e(n,i,r,o):c>=3?new e(n,i,r):c>=2?new e(n,i):c>=1?new e(n):new e;return l.constructor=t,l}return e.apply(this,arguments)}function n(e,t){var n=t>1?1:0;return o[t]+Math.floor((e-1969+n)/4)-Math.floor((e-1901+n)/100)+Math.floor((e-1601+n)/400)+365*(e-1970)}function i(t){return Number(new e(1970,0,1,0,0,0,t))}var r=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),o=[0,31,59,90,120,151,181,212,243,273,304,334,365];for(var a in e)t[a]=e[a];return t.now=e.now,t.UTC=e.UTC,t.prototype=e.prototype,t.prototype.constructor=t,t.parse=function(t){var o=r.exec(t);if(o){var a,s=Number(o[1]),u=Number(o[2]||1)-1,c=Number(o[3]||1)-1,l=Number(o[4]||0),d=Number(o[5]||0),h=Number(o[6]||0),f=Math.floor(1e3*Number(o[7]||0)),p=Boolean(o[4]&&!o[8]),g="-"===o[9]?1:-1,m=Number(o[10]||0),v=Number(o[11]||0);return(d>0||h>0||f>0?24:25)>l&&60>d&&60>h&&1e3>f&&u>-1&&12>u&&24>m&&60>v&&c>-1&&c<n(s,u+1)-n(s,u)&&(a=60*(24*(n(s,u)+c)+l+m*g),a=1e3*(60*(a+d+v*g)+h)+f,p&&(a=i(a)),a>=-864e13&&864e13>=a)?a:NaN}return e.parse.apply(this,arguments)},t}(Date)),Date.now||(Date.now=function(){return(new Date).getTime()});var ee=c.toFixed&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==0xde0b6b3a7640080.toFixed(0)),te={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function(e,t){for(var n=-1;++n<te.size;)t+=e*te.data[n],te.data[n]=t%te.base,t=Math.floor(t/te.base)},divide:function(e){for(var t=te.size,n=0;--t>=0;)n+=te.data[t],te.data[t]=Math.floor(n/e),n=n%e*te.base},numToString:function(){for(var e=te.size,t="";--e>=0;)if(""!==t||0===e||0!==te.data[e]){var n=String(te.data[e]);""===t?t=n:t+="0000000".slice(0,7-n.length)+n}return t},pow:function fe(e,t,n){return 0===t?n:t%2===1?fe(e,t-1,n*e):fe(e*e,t/2,n)},log:function(e){for(var t=0;e>=4096;)t+=12,e/=4096;for(;e>=2;)t+=1,e/=2;return t}};_(c,{toFixed:function(e){var t,n,i,r,o,a,s,u;if(t=Number(e),t=t!==t?0:Math.floor(t),0>t||t>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(n=Number(this),n!==n)return"NaN";if(-1e21>=n||n>=1e21)return String(n);if(i="",0>n&&(i="-",n=-n),r="0",n>1e-21)if(o=te.log(n*te.pow(2,69,1))-69,a=0>o?n*te.pow(2,-o,1):n/te.pow(2,o,1),a*=4503599627370496,o=52-o,o>0){for(te.multiply(0,a),s=t;s>=7;)te.multiply(1e7,0),s-=7;for(te.multiply(te.pow(10,s,1),0),s=o-1;s>=23;)te.divide(1<<23),s-=23;te.divide(1<<s),te.multiply(1,1),te.divide(2),r=te.numToString()}else te.multiply(0,a),te.multiply(1<<-o,0),r=te.numToString()+"0.00000000000000000000".slice(2,2+t);return t>0?(u=r.length,r=t>=u?i+"0.0000000000000000000".slice(0,t-u+2)+r:i+r.slice(0,u-t)+"."+r.slice(u-t)):r=i+r,r}},ee);var ne=u.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var e=void 0===/()??/.exec("")[1];u.split=function(t,n){var i=this;if(void 0===t&&0===n)return[];if("[object RegExp]"!==p.call(t))return ne.call(this,t,n);var r,a,s,u,c=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),d=0;for(t=new RegExp(t.source,l+"g"),i+="",e||(r=new RegExp("^"+t.source+"$(?!\\s)",l)),n=void 0===n?-1>>>0:k(n);(a=t.exec(i))&&(s=a.index+a[0].length,!(s>d&&(c.push(i.slice(d,a.index)),!e&&a.length>1&&a[0].replace(r,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(a[e]=void 0)}),a.length>1&&a.index<i.length&&o.push.apply(c,a.slice(1)),u=a[0].length,d=s,c.length>=n)));)t.lastIndex===a.index&&t.lastIndex++;return d===i.length?(u||!t.test(""))&&c.push(""):c.push(i.slice(d)),c.length>n?c.slice(0,n):c}}():"0".split(void 0,0).length&&(u.split=function(e,t){return void 0===e&&0===t?[]:ne.call(this,e,t)});var ie=u.replace,re=function(){var e=[];return"x".replace(/x(.)?/g,function(t,n){e.push(n)}),1===e.length&&"undefined"==typeof e[0]}();re||(u.replace=function(e,t){var n=g(t),i=m(e)&&/\)[*?]/.test(e.source);if(n&&i){var r=function(n){var i=arguments.length,r=e.lastIndex;e.lastIndex=0;var o=e.exec(n);return e.lastIndex=r,o.push(arguments[i-2],arguments[i-1]),t.apply(this,o)};return ie.call(this,e,r)}return ie.call(this,e,t)});var oe=u.substr,ae="".substr&&"b"!=="0b".substr(-1);_(u,{substr:function(e,t){return oe.call(this,0>e&&(e=this.length+e)<0?0:e,t)}},ae);var se="	\n