UNPKG

155 kBJavaScriptView Raw
1/**
2 * @license
3 * https://github.com/bitcoincashjs/bchaddr
4 * Copyright (c) 2018 Emilio Almansi
5 * Distributed under the MIT software license, see the accompanying
6 * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
7 */
8!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).bchaddr=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var Buffer=require("safe-buffer").Buffer;module.exports=function(ALPHABET){for(var ALPHABET_MAP={},BASE=ALPHABET.length,LEADER=ALPHABET.charAt(0),z=0;z<ALPHABET.length;z++){var x=ALPHABET.charAt(z);if(void 0!==ALPHABET_MAP[x])throw new TypeError(x+" is ambiguous");ALPHABET_MAP[x]=z}function decodeUnsafe(string){if("string"!=typeof string)throw new TypeError("Expected String");if(0===string.length)return Buffer.allocUnsafe(0);for(var bytes=[0],i=0;i<string.length;i++){var value=ALPHABET_MAP[string[i]];if(void 0===value)return;for(var j=0,carry=value;j<bytes.length;++j)carry+=bytes[j]*BASE,bytes[j]=255&carry,carry>>=8;for(;0<carry;)bytes.push(255&carry),carry>>=8}for(var k=0;string[k]===LEADER&&k<string.length-1;++k)bytes.push(0);return Buffer.from(bytes.reverse())}return{encode:function(source){if(0===source.length)return"";for(var digits=[0],i=0;i<source.length;++i){for(var j=0,carry=source[i];j<digits.length;++j)carry+=digits[j]<<8,digits[j]=carry%BASE,carry=carry/BASE|0;for(;0<carry;)digits.push(carry%BASE),carry=carry/BASE|0}for(var string="",k=0;0===source[k]&&k<source.length-1;++k)string+=LEADER;for(var q=digits.length-1;0<=q;--q)string+=ALPHABET[digits[q]];return string},decodeUnsafe:decodeUnsafe,decode:function(string){var buffer=decodeUnsafe(string);if(buffer)return buffer;throw new Error("Non-base"+BASE+" character")}}}},{"safe-buffer":41}],2:[function(require,module,exports){"use strict";exports.byteLength=function(b64){return 3*b64.length/4-placeHoldersCount(b64)},exports.toByteArray=function(b64){var i,l,tmp,placeHolders,arr,len=b64.length;placeHolders=placeHoldersCount(b64),arr=new Arr(3*len/4-placeHolders),l=0<placeHolders?len-4:len;var L=0;for(i=0;i<l;i+=4)tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)],arr[L++]=tmp>>16&255,arr[L++]=tmp>>8&255,arr[L++]=255&tmp;2===placeHolders?(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[L++]=255&tmp):1===placeHolders&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[L++]=tmp>>8&255,arr[L++]=255&tmp);return arr},exports.fromByteArray=function(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,output="",parts=[],i=0,len2=len-extraBytes;i<len2;i+=16383)parts.push(encodeChunk(uint8,i,len2<i+16383?len2:i+16383));1===extraBytes?(tmp=uint8[len-1],output+=lookup[tmp>>2],output+=lookup[tmp<<4&63],output+="=="):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],output+=lookup[tmp>>10],output+=lookup[tmp>>4&63],output+=lookup[tmp<<2&63],output+="=");return parts.push(output),parts.join("")};for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;function placeHoldersCount(b64){var len=b64.length;if(0<len%4)throw new Error("Invalid string. Length must be a multiple of 4");return"="===b64[len-2]?2:"="===b64[len-1]?1:0}function encodeChunk(uint8,start,end){for(var tmp,num,output=[],i=start;i<end;i+=3)tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2],output.push(lookup[(num=tmp)>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]);return output.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},{}],3:[function(require,module,exports){var bigInt=function(undefined){"use strict";var BASE=1e7,LOG_BASE=7,MAX_INT=9007199254740992,MAX_INT_ARR=smallToArray(MAX_INT),LOG_MAX_INT=Math.log(MAX_INT);function Integer(v,radix){return void 0===v?Integer[0]:void 0!==radix?10==+radix?parseValue(v):parseBase(v,radix):parseValue(v)}function BigInteger(value,sign){this.value=value,this.sign=sign,this.isSmall=!1}function SmallInteger(value){this.value=value,this.sign=value<0,this.isSmall=!0}function isPrecise(n){return-MAX_INT<n&&n<MAX_INT}function smallToArray(n){return n<1e7?[n]:n<1e14?[n%1e7,Math.floor(n/1e7)]:[n%1e7,Math.floor(n/1e7)%1e7,Math.floor(n/1e14)]}function arrayToSmall(arr){trim(arr);var length=arr.length;if(length<4&&compareAbs(arr,MAX_INT_ARR)<0)switch(length){case 0:return 0;case 1:return arr[0];case 2:return arr[0]+arr[1]*BASE;default:return arr[0]+(arr[1]+arr[2]*BASE)*BASE}return arr}function trim(v){for(var i=v.length;0===v[--i];);v.length=i+1}function createArray(length){for(var x=new Array(length),i=-1;++i<length;)x[i]=0;return x}function truncate(n){return 0<n?Math.floor(n):Math.ceil(n)}function add(a,b){var sum,i,l_a=a.length,l_b=b.length,r=new Array(l_a),carry=0,base=BASE;for(i=0;i<l_b;i++)carry=base<=(sum=a[i]+b[i]+carry)?1:0,r[i]=sum-carry*base;for(;i<l_a;)carry=(sum=a[i]+carry)===base?1:0,r[i++]=sum-carry*base;return 0<carry&&r.push(carry),r}function addAny(a,b){return a.length>=b.length?add(a,b):add(b,a)}function addSmall(a,carry){var sum,i,l=a.length,r=new Array(l),base=BASE;for(i=0;i<l;i++)sum=a[i]-base+carry,carry=Math.floor(sum/base),r[i]=sum-carry*base,carry+=1;for(;0<carry;)r[i++]=carry%base,carry=Math.floor(carry/base);return r}function subtract(a,b){var i,difference,a_l=a.length,b_l=b.length,r=new Array(a_l),borrow=0,base=BASE;for(i=0;i<b_l;i++)(difference=a[i]-borrow-b[i])<0?(difference+=base,borrow=1):borrow=0,r[i]=difference;for(i=b_l;i<a_l;i++){if(!((difference=a[i]-borrow)<0)){r[i++]=difference;break}difference+=base,r[i]=difference}for(;i<a_l;i++)r[i]=a[i];return trim(r),r}function subtractSmall(a,b,sign){var i,difference,l=a.length,r=new Array(l),carry=-b,base=BASE;for(i=0;i<l;i++)difference=a[i]+carry,carry=Math.floor(difference/base),difference%=base,r[i]=difference<0?difference+base:difference;return"number"==typeof(r=arrayToSmall(r))?(sign&&(r=-r),new SmallInteger(r)):new BigInteger(r,sign)}function multiplyLong(a,b){var product,carry,i,a_i,a_l=a.length,b_l=b.length,r=createArray(a_l+b_l),base=BASE;for(i=0;i<a_l;++i){a_i=a[i];for(var j=0;j<b_l;++j)product=a_i*b[j]+r[i+j],carry=Math.floor(product/base),r[i+j]=product-carry*base,r[i+j+1]+=carry}return trim(r),r}function multiplySmall(a,b){var product,i,l=a.length,r=new Array(l),base=BASE,carry=0;for(i=0;i<l;i++)product=a[i]*b+carry,carry=Math.floor(product/base),r[i]=product-carry*base;for(;0<carry;)r[i++]=carry%base,carry=Math.floor(carry/base);return r}function shiftLeft(x,n){for(var r=[];0<n--;)r.push(0);return r.concat(x)}function multiplySmallAndArray(a,b,sign){return new BigInteger(a<BASE?multiplySmall(b,a):multiplyLong(b,smallToArray(a)),sign)}function square(a){var product,carry,i,a_i,l=a.length,r=createArray(l+l),base=BASE;for(i=0;i<l;i++){carry=0-(a_i=a[i])*a_i;for(var j=i;j<l;j++)product=a_i*a[j]*2+r[i+j]+carry,carry=Math.floor(product/base),r[i+j]=product-carry*base;r[i+l]=carry}return trim(r),r}function divModSmall(value,lambda){var i,q,remainder,divisor,length=value.length,quotient=createArray(length),base=BASE;for(remainder=0,i=length-1;0<=i;--i)remainder=(divisor=remainder*base+value[i])-(q=truncate(divisor/lambda))*lambda,quotient[i]=0|q;return[quotient,0|remainder]}function divModAny(self,v){var value,quotient,n=parseValue(v),a=self.value,b=n.value;if(0===b)throw new Error("Cannot divide by zero");if(self.isSmall)return n.isSmall?[new SmallInteger(truncate(a/b)),new SmallInteger(a%b)]:[Integer[0],self];if(n.isSmall){if(1===b)return[self,Integer[0]];if(-1==b)return[self.negate(),Integer[0]];var abs=Math.abs(b);if(abs<BASE){quotient=arrayToSmall((value=divModSmall(a,abs))[0]);var remainder=value[1];return self.sign&&(remainder=-remainder),"number"==typeof quotient?(self.sign!==n.sign&&(quotient=-quotient),[new SmallInteger(quotient),new SmallInteger(remainder)]):[new BigInteger(quotient,self.sign!==n.sign),new SmallInteger(remainder)]}b=smallToArray(abs)}var comparison=compareAbs(a,b);if(-1===comparison)return[Integer[0],self];if(0===comparison)return[Integer[self.sign===n.sign?1:-1],Integer[0]];quotient=(value=a.length+b.length<=200?function(a,b){var quotientDigit,shift,carry,borrow,i,l,q,a_l=a.length,b_l=b.length,base=BASE,result=createArray(b.length),divisorMostSignificantDigit=b[b_l-1],lambda=Math.ceil(base/(2*divisorMostSignificantDigit)),remainder=multiplySmall(a,lambda),divisor=multiplySmall(b,lambda);for(remainder.length<=a_l&&remainder.push(0),divisor.push(0),divisorMostSignificantDigit=divisor[b_l-1],shift=a_l-b_l;0<=shift;shift--){for(quotientDigit=base-1,remainder[shift+b_l]!==divisorMostSignificantDigit&&(quotientDigit=Math.floor((remainder[shift+b_l]*base+remainder[shift+b_l-1])/divisorMostSignificantDigit)),borrow=carry=0,l=divisor.length,i=0;i<l;i++)carry+=quotientDigit*divisor[i],q=Math.floor(carry/base),borrow+=remainder[shift+i]-(carry-q*base),carry=q,borrow<0?(remainder[shift+i]=borrow+base,borrow=-1):(remainder[shift+i]=borrow,borrow=0);for(;0!==borrow;){for(quotientDigit-=1,i=carry=0;i<l;i++)(carry+=remainder[shift+i]-base+divisor[i])<0?(remainder[shift+i]=carry+base,carry=0):(remainder[shift+i]=carry,carry=1);borrow+=carry}result[shift]=quotientDigit}return remainder=divModSmall(remainder,lambda)[0],[arrayToSmall(result),arrayToSmall(remainder)]}(a,b):function(a,b){for(var guess,xlen,highx,highy,check,a_l=a.length,b_l=b.length,result=[],part=[],base=BASE;a_l;)if(part.unshift(a[--a_l]),trim(part),compareAbs(part,b)<0)result.push(0);else{highx=part[(xlen=part.length)-1]*base+part[xlen-2],highy=b[b_l-1]*base+b[b_l-2],b_l<xlen&&(highx=(highx+1)*base),guess=Math.ceil(highx/highy);do{if(compareAbs(check=multiplySmall(b,guess),part)<=0)break;guess--}while(guess);result.push(guess),part=subtract(part,check)}return result.reverse(),[arrayToSmall(result),arrayToSmall(part)]}(a,b))[0];var qSign=self.sign!==n.sign,mod=value[1],mSign=self.sign;return"number"==typeof quotient?(qSign&&(quotient=-quotient),quotient=new SmallInteger(quotient)):quotient=new BigInteger(quotient,qSign),"number"==typeof mod?(mSign&&(mod=-mod),mod=new SmallInteger(mod)):mod=new BigInteger(mod,mSign),[quotient,mod]}function compareAbs(a,b){if(a.length!==b.length)return a.length>b.length?1:-1;for(var i=a.length-1;0<=i;i--)if(a[i]!==b[i])return a[i]>b[i]?1:-1;return 0}function isBasicPrime(v){var n=v.abs();return!n.isUnit()&&(!!(n.equals(2)||n.equals(3)||n.equals(5))||!(n.isEven()||n.isDivisibleBy(3)||n.isDivisibleBy(5))&&(!!n.lesser(49)||void 0))}function millerRabinTest(n,a){for(var d,i,x,nPrev=n.prev(),b=nPrev,r=0;b.isEven();)b=b.divide(2),r++;next:for(i=0;i<a.length;i++)if(!n.lesser(a[i])&&!(x=bigInt(a[i]).modPow(b,n)).equals(Integer[1])&&!x.equals(nPrev)){for(d=r-1;0!=d;d--){if((x=x.square().mod(n)).isUnit())return!1;if(x.equals(nPrev))continue next}return!1}return!0}BigInteger.prototype=Object.create(Integer.prototype),SmallInteger.prototype=Object.create(Integer.prototype),BigInteger.prototype.plus=BigInteger.prototype.add=function(v){var n=parseValue(v);if(this.sign!==n.sign)return this.subtract(n.negate());var a=this.value,b=n.value;return n.isSmall?new BigInteger(addSmall(a,Math.abs(b)),this.sign):new BigInteger(addAny(a,b),this.sign)},SmallInteger.prototype.plus=SmallInteger.prototype.add=function(v){var n=parseValue(v),a=this.value;if(a<0!==n.sign)return this.subtract(n.negate());var b=n.value;if(n.isSmall){if(isPrecise(a+b))return new SmallInteger(a+b);b=smallToArray(Math.abs(b))}return new BigInteger(addSmall(b,Math.abs(a)),a<0)},BigInteger.prototype.minus=BigInteger.prototype.subtract=function(v){var n=parseValue(v);if(this.sign!==n.sign)return this.add(n.negate());var a=this.value,b=n.value;return n.isSmall?subtractSmall(a,Math.abs(b),this.sign):function(a,b,sign){var value;return 0<=compareAbs(a,b)?value=subtract(a,b):(value=subtract(b,a),sign=!sign),"number"==typeof(value=arrayToSmall(value))?(sign&&(value=-value),new SmallInteger(value)):new BigInteger(value,sign)}(a,b,this.sign)},SmallInteger.prototype.minus=SmallInteger.prototype.subtract=function(v){var n=parseValue(v),a=this.value;if(a<0!==n.sign)return this.add(n.negate());var b=n.value;return n.isSmall?new SmallInteger(a-b):subtractSmall(b,Math.abs(a),0<=a)},BigInteger.prototype.negate=function(){return new BigInteger(this.value,!this.sign)},SmallInteger.prototype.negate=function(){var sign=this.sign,small=new SmallInteger(-this.value);return small.sign=!sign,small},BigInteger.prototype.abs=function(){return new BigInteger(this.value,!1)},SmallInteger.prototype.abs=function(){return new SmallInteger(Math.abs(this.value))},BigInteger.prototype.times=BigInteger.prototype.multiply=function(v){var abs,l1,l2,n=parseValue(v),a=this.value,b=n.value,sign=this.sign!==n.sign;if(n.isSmall){if(0===b)return Integer[0];if(1===b)return this;if(-1===b)return this.negate();if((abs=Math.abs(b))<BASE)return new BigInteger(multiplySmall(a,abs),sign);b=smallToArray(abs)}return l1=a.length,l2=b.length,new BigInteger(0<-.012*l1-.012*l2+15e-6*l1*l2?function multiplyKaratsuba(x,y){var n=Math.max(x.length,y.length);if(n<=30)return multiplyLong(x,y);n=Math.ceil(n/2);var b=x.slice(n),a=x.slice(0,n),d=y.slice(n),c=y.slice(0,n),ac=multiplyKaratsuba(a,c),bd=multiplyKaratsuba(b,d),product=addAny(addAny(ac,shiftLeft(subtract(subtract(multiplyKaratsuba(addAny(a,b),addAny(c,d)),ac),bd),n)),shiftLeft(bd,2*n));return trim(product),product}(a,b):multiplyLong(a,b),sign)},SmallInteger.prototype._multiplyBySmall=function(a){return isPrecise(a.value*this.value)?new SmallInteger(a.value*this.value):multiplySmallAndArray(Math.abs(a.value),smallToArray(Math.abs(this.value)),this.sign!==a.sign)},BigInteger.prototype._multiplyBySmall=function(a){return 0===a.value?Integer[0]:1===a.value?this:-1===a.value?this.negate():multiplySmallAndArray(Math.abs(a.value),this.value,this.sign!==a.sign)},SmallInteger.prototype.times=SmallInteger.prototype.multiply=function(v){return parseValue(v)._multiplyBySmall(this)},BigInteger.prototype.square=function(){return new BigInteger(square(this.value),!1)},SmallInteger.prototype.square=function(){var value=this.value*this.value;return isPrecise(value)?new SmallInteger(value):new BigInteger(square(smallToArray(Math.abs(this.value))),!1)},SmallInteger.prototype.divmod=BigInteger.prototype.divmod=function(v){var result=divModAny(this,v);return{quotient:result[0],remainder:result[1]}},SmallInteger.prototype.over=SmallInteger.prototype.divide=BigInteger.prototype.over=BigInteger.prototype.divide=function(v){return divModAny(this,v)[0]},SmallInteger.prototype.remainder=SmallInteger.prototype.mod=BigInteger.prototype.remainder=BigInteger.prototype.mod=function(v){return divModAny(this,v)[1]},BigInteger.prototype.pow=function(v){var value,x,y,n=parseValue(v),a=this.value,b=n.value;if(0===b)return Integer[1];if(0===a)return Integer[0];if(1===a)return Integer[1];if(-1===a)return n.isEven()?Integer[1]:Integer[-1];if(n.sign)return Integer[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&isPrecise(value=Math.pow(a,b)))return new SmallInteger(truncate(value));for(x=this,y=Integer[1];!0&b&&(y=y.times(x),--b),0!==b;)b/=2,x=x.square();return y},SmallInteger.prototype.pow=BigInteger.prototype.pow,SmallInteger.prototype.modPow=BigInteger.prototype.modPow=function(exp,mod){if(exp=parseValue(exp),(mod=parseValue(mod)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var r=Integer[1],base=this.mod(mod);exp.isPositive();){if(base.isZero())return Integer[0];exp.isOdd()&&(r=r.multiply(base).mod(mod)),exp=exp.divide(2),base=base.square().mod(mod)}return r},BigInteger.prototype.compareAbs=function(v){var n=parseValue(v),a=this.value,b=n.value;return n.isSmall?1:compareAbs(a,b)},SmallInteger.prototype.compareAbs=function(v){var n=parseValue(v),a=Math.abs(this.value),b=n.value;return n.isSmall?a===(b=Math.abs(b))?0:b<a?1:-1:-1},BigInteger.prototype.compareTo=BigInteger.prototype.compare=function(v){if(v===1/0)return-1;if(v===-1/0)return 1;var n=parseValue(v),a=this.value,b=n.value;return this.sign!==n.sign?n.sign?1:-1:n.isSmall?this.sign?-1:1:compareAbs(a,b)*(this.sign?-1:1)},SmallInteger.prototype.compareTo=SmallInteger.prototype.compare=function(v){if(v===1/0)return-1;if(v===-1/0)return 1;var n=parseValue(v),a=this.value,b=n.value;return n.isSmall?a==b?0:b<a?1:-1:a<0!==n.sign?a<0?-1:1:a<0?1:-1},SmallInteger.prototype.eq=SmallInteger.prototype.equals=BigInteger.prototype.eq=BigInteger.prototype.equals=function(v){return 0===this.compare(v)},SmallInteger.prototype.neq=SmallInteger.prototype.notEquals=BigInteger.prototype.neq=BigInteger.prototype.notEquals=function(v){return 0!==this.compare(v)},SmallInteger.prototype.gt=SmallInteger.prototype.greater=BigInteger.prototype.gt=BigInteger.prototype.greater=function(v){return 0<this.compare(v)},SmallInteger.prototype.lt=SmallInteger.prototype.lesser=BigInteger.prototype.lt=BigInteger.prototype.lesser=function(v){return this.compare(v)<0},SmallInteger.prototype.geq=SmallInteger.prototype.greaterOrEquals=BigInteger.prototype.geq=BigInteger.prototype.greaterOrEquals=function(v){return 0<=this.compare(v)},SmallInteger.prototype.leq=SmallInteger.prototype.lesserOrEquals=BigInteger.prototype.leq=BigInteger.prototype.lesserOrEquals=function(v){return this.compare(v)<=0},BigInteger.prototype.isEven=function(){return 0==(1&this.value[0])},SmallInteger.prototype.isEven=function(){return 0==(1&this.value)},BigInteger.prototype.isOdd=function(){return 1==(1&this.value[0])},SmallInteger.prototype.isOdd=function(){return 1==(1&this.value)},BigInteger.prototype.isPositive=function(){return!this.sign},SmallInteger.prototype.isPositive=function(){return 0<this.value},BigInteger.prototype.isNegative=function(){return this.sign},SmallInteger.prototype.isNegative=function(){return this.value<0},BigInteger.prototype.isUnit=function(){return!1},SmallInteger.prototype.isUnit=function(){return 1===Math.abs(this.value)},BigInteger.prototype.isZero=function(){return!1},SmallInteger.prototype.isZero=function(){return 0===this.value},SmallInteger.prototype.isDivisibleBy=BigInteger.prototype.isDivisibleBy=function(v){var n=parseValue(v),value=n.value;return 0!==value&&(1===value||(2===value?this.isEven():this.mod(n).equals(Integer[0])))},SmallInteger.prototype.isPrime=BigInteger.prototype.isPrime=function(strict){var isPrime=isBasicPrime(this);if(void 0!==isPrime)return isPrime;var n=this.abs(),bits=n.bitLength();if(bits<=64)return millerRabinTest(n,[2,325,9375,28178,450775,9780504,1795265022]);for(var logN=Math.log(2)*bits,t=Math.ceil(!0===strict?2*Math.pow(logN,2):logN),a=[],i=0;i<t;i++)a.push(bigInt(i+2));return millerRabinTest(n,a)},SmallInteger.prototype.isProbablePrime=BigInteger.prototype.isProbablePrime=function(iterations){var isPrime=isBasicPrime(this);if(void 0!==isPrime)return isPrime;for(var n=this.abs(),t=void 0===iterations?5:iterations,a=[],i=0;i<t;i++)a.push(bigInt.randBetween(2,n.minus(2)));return millerRabinTest(n,a)},SmallInteger.prototype.modInv=BigInteger.prototype.modInv=function(n){for(var q,lastT,lastR,t=bigInt.zero,newT=bigInt.one,r=parseValue(n),newR=this.abs();!newR.equals(bigInt.zero);)q=r.divide(newR),lastT=t,lastR=r,t=newT,r=newR,newT=lastT.subtract(q.multiply(newT)),newR=lastR.subtract(q.multiply(newR));if(!r.equals(1))throw new Error(this.toString()+" and "+n.toString()+" are not co-prime");return-1===t.compare(0)&&(t=t.add(n)),this.isNegative()?t.negate():t},BigInteger.prototype.next=function(){var value=this.value;return this.sign?subtractSmall(value,1,this.sign):new BigInteger(addSmall(value,1),this.sign)},SmallInteger.prototype.next=function(){var value=this.value;return value+1<MAX_INT?new SmallInteger(value+1):new BigInteger(MAX_INT_ARR,!1)},BigInteger.prototype.prev=function(){var value=this.value;return this.sign?new BigInteger(addSmall(value,1),!0):subtractSmall(value,1,this.sign)},SmallInteger.prototype.prev=function(){var value=this.value;return-MAX_INT<value-1?new SmallInteger(value-1):new BigInteger(MAX_INT_ARR,!0)};for(var powersOfTwo=[1];2*powersOfTwo[powersOfTwo.length-1]<=BASE;)powersOfTwo.push(2*powersOfTwo[powersOfTwo.length-1]);var powers2Length=powersOfTwo.length,highestPower2=powersOfTwo[powers2Length-1];function shift_isSmall(n){return("number"==typeof n||"string"==typeof n)&&+Math.abs(n)<=BASE||n instanceof BigInteger&&n.value.length<=1}function bitwise(x,y,fn){y=parseValue(y);for(var xSign=x.isNegative(),ySign=y.isNegative(),xRem=xSign?x.not():x,yRem=ySign?y.not():y,xDigit=0,yDigit=0,xDivMod=null,yDivMod=null,result=[];!xRem.isZero()||!yRem.isZero();)xDigit=(xDivMod=divModAny(xRem,highestPower2))[1].toJSNumber(),xSign&&(xDigit=highestPower2-1-xDigit),yDigit=(yDivMod=divModAny(yRem,highestPower2))[1].toJSNumber(),ySign&&(yDigit=highestPower2-1-yDigit),xRem=xDivMod[0],yRem=yDivMod[0],result.push(fn(xDigit,yDigit));for(var sum=0!==fn(xSign?1:0,ySign?1:0)?bigInt(-1):bigInt(0),i=result.length-1;0<=i;i-=1)sum=sum.multiply(highestPower2).add(bigInt(result[i]));return sum}SmallInteger.prototype.shiftLeft=BigInteger.prototype.shiftLeft=function(n){if(!shift_isSmall(n))throw new Error(String(n)+" is too large for shifting.");if((n=+n)<0)return this.shiftRight(-n);var result=this;if(result.isZero())return result;for(;powers2Length<=n;)result=result.multiply(highestPower2),n-=powers2Length-1;return result.multiply(powersOfTwo[n])},SmallInteger.prototype.shiftRight=BigInteger.prototype.shiftRight=function(n){var remQuo;if(!shift_isSmall(n))throw new Error(String(n)+" is too large for shifting.");if((n=+n)<0)return this.shiftLeft(-n);for(var result=this;powers2Length<=n;){if(result.isZero()||result.isNegative()&&result.isUnit())return result;result=(remQuo=divModAny(result,highestPower2))[1].isNegative()?remQuo[0].prev():remQuo[0],n-=powers2Length-1}return(remQuo=divModAny(result,powersOfTwo[n]))[1].isNegative()?remQuo[0].prev():remQuo[0]},SmallInteger.prototype.not=BigInteger.prototype.not=function(){return this.negate().prev()},SmallInteger.prototype.and=BigInteger.prototype.and=function(n){return bitwise(this,n,function(a,b){return a&b})},SmallInteger.prototype.or=BigInteger.prototype.or=function(n){return bitwise(this,n,function(a,b){return a|b})},SmallInteger.prototype.xor=BigInteger.prototype.xor=function(n){return bitwise(this,n,function(a,b){return a^b})};var LOBMASK_I=1<<30,LOBMASK_BI=(BASE&-BASE)*(BASE&-BASE)|LOBMASK_I;function roughLOB(n){var v=n.value,x="number"==typeof v?v|LOBMASK_I:v[0]+v[1]*BASE|LOBMASK_BI;return x&-x}function max(a,b){return a=parseValue(a),b=parseValue(b),a.greater(b)?a:b}function min(a,b){return a=parseValue(a),b=parseValue(b),a.lesser(b)?a:b}function gcd(a,b){if(a=parseValue(a).abs(),b=parseValue(b).abs(),a.equals(b))return a;if(a.isZero())return b;if(b.isZero())return a;for(var d,t,c=Integer[1];a.isEven()&&b.isEven();)d=Math.min(roughLOB(a),roughLOB(b)),a=a.divide(d),b=b.divide(d),c=c.multiply(d);for(;a.isEven();)a=a.divide(roughLOB(a));do{for(;b.isEven();)b=b.divide(roughLOB(b));a.greater(b)&&(t=b,b=a,a=t),b=b.subtract(a)}while(!b.isZero());return c.isUnit()?a:a.multiply(c)}SmallInteger.prototype.bitLength=BigInteger.prototype.bitLength=function(){var n=this;return n.compareTo(bigInt(0))<0&&(n=n.negate().subtract(bigInt(1))),0===n.compareTo(bigInt(0))?bigInt(0):bigInt(function integerLogarithm(value,base){if(base.compareTo(value)<=0){var tmp=integerLogarithm(value,base.square(base)),p=tmp.p,e=tmp.e,t=p.multiply(base);return t.compareTo(value)<=0?{p:t,e:2*e+1}:{p:p,e:2*e}}return{p:bigInt(1),e:0}}(n,bigInt(2)).e).add(bigInt(1))};var parseBase=function(text,base){for(var length=text.length,absBase=Math.abs(base),i=0;i<length;i++){if("-"!==(c=text[i].toLowerCase())&&/[a-z0-9]/.test(c)){if(/[0-9]/.test(c)&&absBase<=+c){if("1"===c&&1===absBase)continue;throw new Error(c+" is not a valid digit in base "+base+".")}if(c.charCodeAt(0)-87>=absBase)throw new Error(c+" is not a valid digit in base "+base+".")}}if(2<=base&&base<=36&&length<=LOG_MAX_INT/Math.log(base)){var result=parseInt(text,base);if(isNaN(result))throw new Error(c+" is not a valid digit in base "+base+".");return new SmallInteger(parseInt(text,base))}base=parseValue(base);var digits=[],isNegative="-"===text[0];for(i=isNegative?1:0;i<text.length;i++){var c,charCode=(c=text[i].toLowerCase()).charCodeAt(0);if(48<=charCode&&charCode<=57)digits.push(parseValue(c));else if(97<=charCode&&charCode<=122)digits.push(parseValue(c.charCodeAt(0)-87));else{if("<"!==c)throw new Error(c+" is not a valid character");for(var start=i;">"!==text[++i];);digits.push(parseValue(text.slice(start+1,i)))}}return parseBaseFromArray(digits,base,isNegative)};function parseBaseFromArray(digits,base,isNegative){var i,val=Integer[0],pow=Integer[1];for(i=digits.length-1;0<=i;i--)val=val.add(digits[i].times(pow)),pow=pow.times(base);return isNegative?val.negate():val}function stringify(digit){return digit<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(digit):"<"+digit+">"}function toBase(n,base){if((base=bigInt(base)).isZero()){if(n.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(base.equals(-1)){if(n.isZero())return{value:[0],isNegative:!1};if(n.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-n)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var arr=Array.apply(null,Array(+n-1)).map(Array.prototype.valueOf,[0,1]);return arr.unshift([1]),{value:[].concat.apply([],arr),isNegative:!1}}var neg=!1;if(n.isNegative()&&base.isPositive()&&(neg=!0,n=n.abs()),base.equals(1))return n.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+n)).map(Number.prototype.valueOf,1),isNegative:neg};for(var divmod,out=[],left=n;left.isNegative()||0<=left.compareAbs(base);){left=(divmod=left.divmod(base)).quotient;var digit=divmod.remainder;digit.isNegative()&&(digit=base.minus(digit).abs(),left=left.next()),out.push(digit.toJSNumber())}return out.push(left.toJSNumber()),{value:out.reverse(),isNegative:neg}}function toBaseString(n,base){var arr=toBase(n,base);return(arr.isNegative?"-":"")+arr.value.map(stringify).join("")}function parseStringValue(v){if(isPrecise(+v)){var x=+v;if(x===truncate(x))return new SmallInteger(x);throw new Error("Invalid integer: "+v)}var sign="-"===v[0];sign&&(v=v.slice(1));var split=v.split(/e/i);if(2<split.length)throw new Error("Invalid integer: "+split.join("e"));if(2===split.length){var exp=split[1];if("+"===exp[0]&&(exp=exp.slice(1)),(exp=+exp)!==truncate(exp)||!isPrecise(exp))throw new Error("Invalid integer: "+exp+" is not a valid exponent.");var text=split[0],decimalPlace=text.indexOf(".");if(0<=decimalPlace&&(exp-=text.length-decimalPlace-1,text=text.slice(0,decimalPlace)+text.slice(decimalPlace+1)),exp<0)throw new Error("Cannot include negative exponent part for integers");v=text+=new Array(exp+1).join("0")}if(!/^([0-9][0-9]*)$/.test(v))throw new Error("Invalid integer: "+v);for(var r=[],max=v.length,l=LOG_BASE,min=max-l;0<max;)r.push(+v.slice(min,max)),(min-=l)<0&&(min=0),max-=l;return trim(r),new BigInteger(r,sign)}function parseValue(v){return"number"==typeof v?function(v){if(isPrecise(v)){if(v!==truncate(v))throw new Error(v+" is not an integer.");return new SmallInteger(v)}return parseStringValue(v.toString())}(v):"string"==typeof v?parseStringValue(v):v}BigInteger.prototype.toArray=function(radix){return toBase(this,radix)},SmallInteger.prototype.toArray=function(radix){return toBase(this,radix)},BigInteger.prototype.toString=function(radix){if(void 0===radix&&(radix=10),10!==radix)return toBaseString(this,radix);for(var digit,v=this.value,l=v.length,str=String(v[--l]);0<=--l;)digit=String(v[l]),str+="0000000".slice(digit.length)+digit;return(this.sign?"-":"")+str},SmallInteger.prototype.toString=function(radix){return void 0===radix&&(radix=10),10!=radix?toBaseString(this,radix):String(this.value)},BigInteger.prototype.toJSON=SmallInteger.prototype.toJSON=function(){return this.toString()},BigInteger.prototype.toJSNumber=BigInteger.prototype.valueOf=function(){return parseInt(this.toString(),10)},SmallInteger.prototype.toJSNumber=SmallInteger.prototype.valueOf=function(){return this.value};for(var i=0;i<1e3;i++)Integer[i]=new SmallInteger(i),0<i&&(Integer[-i]=new SmallInteger(-i));return Integer.one=Integer[1],Integer.zero=Integer[0],Integer.minusOne=Integer[-1],Integer.max=max,Integer.min=min,Integer.gcd=gcd,Integer.lcm=function(a,b){return a=parseValue(a).abs(),b=parseValue(b).abs(),a.divide(gcd(a,b)).multiply(b)},Integer.isInstance=function(x){return x instanceof BigInteger||x instanceof SmallInteger},Integer.randBetween=function(a,b){var low=min(a=parseValue(a),b=parseValue(b)),range=max(a,b).subtract(low).add(1);if(range.isSmall)return low.add(Math.floor(Math.random()*range));for(var result=[],restricted=!0,i=range.value.length-1;0<=i;i--){var top=restricted?range.value[i]:BASE,digit=truncate(Math.random()*top);result.unshift(digit),digit<top&&(restricted=!1)}return result=arrayToSmall(result),low.add("number"==typeof result?new SmallInteger(result):new BigInteger(result,!1))},Integer.fromArray=function(digits,base,isNegative){return parseBaseFromArray(digits.map(parseValue),parseValue(base||10),isNegative)},Integer}();void 0!==module&&module.hasOwnProperty("exports")&&(module.exports=bigInt)},{}],4:[function(require,module,exports){},{}],5:[function(require,module,exports){var basex=require("base-x");module.exports=basex("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":1}],6:[function(require,module,exports){"use strict";var base58=require("bs58"),Buffer=require("safe-buffer").Buffer;module.exports=function(checksumFn){function decodeRaw(buffer){var payload=buffer.slice(0,-4),checksum=buffer.slice(-4),newChecksum=checksumFn(payload);if(!(checksum[0]^newChecksum[0]|checksum[1]^newChecksum[1]|checksum[2]^newChecksum[2]|checksum[3]^newChecksum[3]))return payload}return{encode:function(payload){var checksum=checksumFn(payload);return base58.encode(Buffer.concat([payload,checksum],payload.length+4))},decode:function(string){var payload=decodeRaw(base58.decode(string));if(!payload)throw new Error("Invalid checksum");return payload},decodeUnsafe:function(string){var buffer=base58.decodeUnsafe(string);if(buffer)return decodeRaw(buffer)}}}},{bs58:5,"safe-buffer":8}],7:[function(require,module,exports){"use strict";var createHash=require("create-hash"),bs58checkBase=require("./base");module.exports=bs58checkBase(function(buffer){var tmp=createHash("sha256").update(buffer).digest();return createHash("sha256").update(tmp).digest()})},{"./base":6,"create-hash":16}],8:[function(require,module,exports){var buffer=require("buffer"),Buffer=buffer.Buffer;function copyProps(src,dst){for(var key in src)dst[key]=src[key]}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?module.exports=buffer:(copyProps(buffer,exports),exports.Buffer=SafeBuffer),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(arg,encodingOrOffset,length){if("number"==typeof arg)throw new TypeError("Argument must not be a number");return Buffer(arg,encodingOrOffset,length)},SafeBuffer.alloc=function(size,fill,encoding){if("number"!=typeof size)throw new TypeError("Argument must be a number");var buf=Buffer(size);return void 0!==fill?"string"==typeof encoding?buf.fill(fill,encoding):buf.fill(fill):buf.fill(0),buf},SafeBuffer.allocUnsafe=function(size){if("number"!=typeof size)throw new TypeError("Argument must be a number");return Buffer(size)},SafeBuffer.allocUnsafeSlow=function(size){if("number"!=typeof size)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(size)}},{buffer:9}],9:[function(require,module,exports){"use strict";var base64=require("base64-js"),ieee754=require("ieee754");exports.Buffer=Buffer,exports.SlowBuffer=function(length){+length!=length&&(length=0);return Buffer.alloc(+length)},exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;function createBuffer(length){if(K_MAX_LENGTH<length)throw new RangeError("Invalid typed array length");var buf=new Uint8Array(length);return buf.__proto__=Buffer.prototype,buf}function Buffer(arg,encodingOrOffset,length){if("number"==typeof arg){if("string"==typeof encodingOrOffset)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}function from(value,encodingOrOffset,length){if("number"==typeof value)throw new TypeError('"value" argument must not be a number');return isArrayBuffer(value)?function(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset)throw new RangeError("'offset' is out of bounds");if(array.byteLength<byteOffset+(length||0))throw new RangeError("'length' is out of bounds");var buf;buf=void 0===byteOffset&&void 0===length?new Uint8Array(array):void 0===length?new Uint8Array(array,byteOffset):new Uint8Array(array,byteOffset,length);return buf.__proto__=Buffer.prototype,buf}(value,encodingOrOffset,length):"string"==typeof value?function(string,encoding){"string"==typeof encoding&&""!==encoding||(encoding="utf8");if(!Buffer.isEncoding(encoding))throw new TypeError('"encoding" must be a valid string encoding');var length=0|byteLength(string,encoding),buf=createBuffer(length),actual=buf.write(string,encoding);actual!==length&&(buf=buf.slice(0,actual));return buf}(value,encodingOrOffset):function(obj){if(Buffer.isBuffer(obj)){var len=0|checked(obj.length),buf=createBuffer(len);return 0===buf.length||obj.copy(buf,0,0,len),buf}if(obj){if(isArrayBufferView(obj)||"length"in obj)return"number"!=typeof obj.length||numberIsNaN(obj.length)?createBuffer(0):fromArrayLike(obj);if("Buffer"===obj.type&&Array.isArray(obj.data))return fromArrayLike(obj.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(value)}function assertSize(size){if("number"!=typeof size)throw new TypeError('"size" argument must be a number');if(size<0)throw new RangeError('"size" argument must not be negative')}function allocUnsafe(size){return assertSize(size),createBuffer(size<0?0:0|checked(size))}function fromArrayLike(array){for(var length=array.length<0?0:0|checked(array.length),buf=createBuffer(length),i=0;i<length;i+=1)buf[i]=255&array[i];return buf}function checked(length){if(K_MAX_LENGTH<=length)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|length}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if(isArrayBufferView(string)||isArrayBuffer(string))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):2147483647<byteOffset?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),numberIsNaN(byteOffset=+byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val&=255,"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var i,indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&("ucs2"===(encoding=String(encoding).toLowerCase())||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;arrLength/=indexSize=2,valLength/=2,byteOffset/=2}function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++)if(read(arr,i)===read(val,-1===foundIndex?0:i-foundIndex)){if(-1===foundIndex&&(foundIndex=i),i-foundIndex+1===valLength)return foundIndex*indexSize}else-1!==foundIndex&&(i-=i-foundIndex),foundIndex=-1}else for(arrLength<byteOffset+valLength&&(byteOffset=arrLength-valLength),i=byteOffset;0<=i;i--){for(var found=!0,j=0;j<valLength;j++)if(read(arr,i+j)!==read(val,j)){found=!1;break}if(found)return i}return-1}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;length?remaining<(length=Number(length))&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new TypeError("Invalid hex string");strLen/2<length&&(length=strLen/2);for(var i=0;i<length;++i){var parsed=parseInt(string.substr(2*i,2),16);if(numberIsNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(function(str){for(var byteArray=[],i=0;i<str.length;++i)byteArray.push(255&str.charCodeAt(i));return byteArray}(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(function(str,units){for(var c,hi,lo,byteArray=[],i=0;i<str.length&&!((units-=2)<0);++i)c=str.charCodeAt(i),hi=c>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i<end;){var secondByte,thirdByte,fourthByte,tempCodePoint,firstByte=buf[i],codePoint=null,bytesPerSequence=239<firstByte?4:223<firstByte?3:191<firstByte?2:1;if(i+bytesPerSequence<=end)switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:128==(192&(secondByte=buf[i+1]))&&127<(tempCodePoint=(31&firstByte)<<6|63&secondByte)&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&2047<(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)&&(tempCodePoint<55296||57343<tempCodePoint)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&65535<(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}null===codePoint?(codePoint=65533,bytesPerSequence=1):65535<codePoint&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return function(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);var res="",i=0;for(;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));return res}(res)}exports.kMaxLength=K_MAX_LENGTH,(Buffer.TYPED_ARRAY_SUPPORT=function(){try{var arr=new Uint8Array(1);return arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===arr.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),Buffer.poolSize=8192,Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(size,fill,encoding){return function(size,fill,encoding){return assertSize(size),size<=0?createBuffer(size):void 0!==fill?"string"==typeof encoding?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill):createBuffer(size)}(size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)},Buffer.isBuffer=function(b){return null!=b&&!0===b._isBuffer},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i<len;++i)if(a[i]!==b[i]){x=a[i],y=b[i];break}return x<y?-1:y<x?1:0},Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(list,length){if(!Array.isArray(list))throw new TypeError('"list" argument must be an Array of Buffers');if(0===list.length)return Buffer.alloc(0);var i;if(void 0===length)for(i=length=0;i<list.length;++i)length+=list[i].length;var buffer=Buffer.allocUnsafe(length),pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf))throw new TypeError('"list" argument must be an Array of Buffers');buf.copy(buffer,pos),pos+=buf.length}return buffer},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var len=this.length;if(len%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<len;i+=2)swap(this,i,i+1);return this},Buffer.prototype.swap32=function(){var len=this.length;if(len%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<len;i+=4)swap(this,i,i+3),swap(this,i+1,i+2);return this},Buffer.prototype.swap64=function(){var len=this.length;if(len%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<len;i+=8)swap(this,i,i+7),swap(this,i+1,i+6),swap(this,i+2,i+5),swap(this,i+3,i+4);return this},Buffer.prototype.toString=function(){var length=this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):function(encoding,start,end){var loweredCase=!1;if((void 0===start||start<0)&&(start=0),start>this.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if((end>>>=0)<=(start>>>=0))return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return 0<this.length&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),"<Buffer "+str+">"},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisEnd<=thisStart&&end<=start)return 0;if(thisEnd<=thisStart)return-1;if(end<=start)return 1;if(this===target)return 0;for(var x=(thisEnd>>>=0)-(thisStart>>>=0),y=(end>>>=0)-(start>>>=0),len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;i<len;++i)if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i],y=targetCopy[i];break}return x<y?-1:y<x?1:0},Buffer.prototype.includes=function(val,byteOffset,encoding){return-1!==this.indexOf(val,byteOffset,encoding)},Buffer.prototype.indexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)},Buffer.prototype.lastIndexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else{if(!isFinite(offset))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");offset>>>=0,isFinite(length)?(length>>>=0,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0)}var remaining=this.length-offset;if((void 0===length||remaining<length)&&(length=remaining),0<string.length&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(127&buf[i]);return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(buf[i]);return ret}function hexSlice(buf,start,end){var len=buf.length;(!start||start<0)&&(start=0),(!end||end<0||len<end)&&(end=len);for(var out="",i=start;i<end;++i)out+=toHex(buf[i]);return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length;i+=2)res+=String.fromCharCode(bytes[i]+256*bytes[i+1]);return res}function checkOffset(offset,ext,length){if(offset%1!=0||offset<0)throw new RangeError("offset is not uint");if(length<offset+ext)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(max<value||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,4),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return value=+value,offset>>>=0,noAssert||checkIEEE754(buf,0,offset,8),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}Buffer.prototype.slice=function(start,end){var len=this.length;(start=~~start)<0?(start+=len)<0&&(start=0):len<start&&(start=len),(end=void 0===end?len:~~end)<0?(end+=len)<0&&(end=0):len<end&&(end=len),end<start&&(end=start);var newBuf=this.subarray(start,end);return newBuf.__proto__=Buffer.prototype,newBuf},Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return val},Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset+--byteLength],mul=1;0<byteLength&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return(mul*=128)<=val&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset>>>=0,byteLength>>>=0,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];0<i&&(mul*=256);)val+=this[offset+--i]*mul;return(mul*=128)<=val&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){offset>>>=0,noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return offset>>>=0,noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0);var mul=1,i=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){(value=+value,offset>>>=0,byteLength>>>=0,noAssert)||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength)-1,0);var i=byteLength-1,mul=1;for(this[offset+i]=255&value;0<=--i&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,255,0),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,65535,0),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value,offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,4294967295,0),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset>>>=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i-1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset>>>=0,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;0<=--i&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,1,127,-128),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=255&value,this[offset+1]=value>>>8,offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,2,32767,-32768),this[offset]=value>>>8,this[offset+1]=255&value,offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24,offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset>>>=0,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value,offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),0<end&&end<start&&(end=start),end===start)return 0;if(0===target.length||0===this.length)return 0;if(targetStart<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart<end-start&&(end=target.length-targetStart+start);var i,len=end-start;if(this===target&&start<targetStart&&targetStart<end)for(i=len-1;0<=i;--i)target[i+targetStart]=this[i+start];else if(len<1e3)for(i=0;i<len;++i)target[i+targetStart]=this[i+start];else Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart);return len},Buffer.prototype.fill=function(val,start,end,encoding){if("string"==typeof val){if("string"==typeof start?(encoding=start,start=0,end=this.length):"string"==typeof end&&(encoding=end,end=this.length),1===val.length){var code=val.charCodeAt(0);code<256&&(val=code)}if(void 0!==encoding&&"string"!=typeof encoding)throw new TypeError("encoding must be a string");if("string"==typeof encoding&&!Buffer.isEncoding(encoding))throw new TypeError("Unknown encoding: "+encoding)}else"number"==typeof val&&(val&=255);if(start<0||this.length<start||this.length<end)throw new RangeError("Out of range index");if(end<=start)return this;var i;if(start>>>=0,end=void 0===end?this.length:end>>>0,val||(val=0),"number"==typeof val)for(i=start;i<end;++i)this[i]=val;else{var bytes=Buffer.isBuffer(val)?val:new Buffer(val,encoding),len=bytes.length;for(i=0;i<end-start;++i)this[i+start]=bytes[i%len]}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){var codePoint;units=units||1/0;for(var length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;++i){if(55295<(codePoint=string.charCodeAt(i))&&codePoint<57344){if(!leadSurrogate){if(56319<codePoint){-1<(units-=3)&&bytes.push(239,191,189);continue}if(i+1===length){-1<(units-=3)&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){-1<(units-=3)&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&-1<(units-=3)&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function base64ToBytes(str){return base64.toByteArray(function(str){if((str=str.trim().replace(INVALID_BASE64_RE,"")).length<2)return"";for(;str.length%4!=0;)str+="=";return str}(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length&&!(i+offset>=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}function isArrayBuffer(obj){return obj instanceof ArrayBuffer||null!=obj&&null!=obj.constructor&&"ArrayBuffer"===obj.constructor.name&&"number"==typeof obj.byteLength}function isArrayBufferView(obj){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(obj)}function numberIsNaN(obj){return obj!=obj}},{"base64-js":2,ieee754:21}],10:[function(require,module,exports){"use strict";var validate=require("./validation").validate,CHARSET_INVERSE_INDEX={q:0,p:1,z:2,r:3,y:4,9:5,x:6,8:7,g:8,f:9,2:10,t:11,v:12,d:13,w:14,0:15,s:16,3:17,j:18,n:19,5:20,4:21,k:22,h:23,c:24,e:25,6:26,m:27,u:28,a:29,7:30,l:31};module.exports={encode:function(data){validate(data instanceof Uint8Array,"Invalid data: "+data+".");for(var base32="",i=0;i<data.length;++i){var value=data[i];validate(0<=value&&value<32,"Invalid value: "+value+"."),base32+="qpzry9x8gf2tvdw0s3jn54khce6mua7l"[value]}return base32},decode:function(string){validate("string"==typeof string,"Invalid base32-encoded string: "+string+".");for(var data=new Uint8Array(string.length),i=0;i<string.length;++i){var value=string[i];validate(value in CHARSET_INVERSE_INDEX,"Invalid value: "+value+"."),data[i]=CHARSET_INVERSE_INDEX[value]}return data}}},{"./validation":13}],11:[function(require,module,exports){"use strict";var base32=require("./base32"),bigInt=require("big-integer"),convertBits=require("./convertBits"),validation=require("./validation"),validate=validation.validate;var ValidationError=validation.ValidationError,VALID_PREFIXES=["bitcoincash","bchtest","bchreg"];function prefixToUint5Array(prefix){for(var result=new Uint8Array(prefix.length),i=0;i<prefix.length;++i)result[i]=31&prefix[i].charCodeAt(0);return result}function concat(a,b){var ab=new Uint8Array(a.length+b.length);return ab.set(a),ab.set(b,a.length),ab}function polymod(data){for(var GENERATOR=[656907472481,522768456162,0xf33e5fb3c4,748107326120,130178868336],checksum=bigInt(1),i=0;i<data.length;++i){var value=data[i],topBits=checksum.shiftRight(35);checksum=checksum.and(34359738367).shiftLeft(5).xor(value);for(var j=0;j<GENERATOR.length;++j)topBits.shiftRight(j).and(1).equals(1)&&(checksum=checksum.xor(GENERATOR[j]))}return checksum.xor(1)}function hasSingleCase(string){return string===string.toLowerCase()||string===string.toUpperCase()}module.exports={encode:function(prefix,type,hash){validate("string"==typeof prefix&&function(prefix){return hasSingleCase(prefix)&&-1!==VALID_PREFIXES.indexOf(prefix.toLowerCase())}(prefix),"Invalid prefix: "+prefix+"."),validate("string"==typeof type,"Invalid type: "+type+"."),validate(hash instanceof Uint8Array,"Invalid hash: "+hash+".");var data,prefixData=concat(prefixToUint5Array(prefix),new Uint8Array(1)),versionByte=function(type){switch(type){case"P2PKH":return 0;case"P2SH":return 8;default:throw new ValidationError("Invalid type: "+type+".")}}(type)+function(hash){switch(8*hash.length){case 160:return 0;case 192:return 1;case 224:return 2;case 256:return 3;case 320:return 4;case 384:return 5;case 448:return 6;case 512:return 7;default:throw new ValidationError("Invalid hash size: "+hash.length+".")}}(hash),payloadData=(data=concat(new Uint8Array([versionByte]),hash),convertBits(data,8,5)),payload=concat(payloadData,function(checksum){for(var result=new Uint8Array(8),i=0;i<8;++i)result[7-i]=checksum.and(31).toJSNumber(),checksum=checksum.shiftRight(5);return result}(polymod(concat(concat(prefixData,payloadData),new Uint8Array(8)))));return prefix+":"+base32.encode(payload)},decode:function(address){validate("string"==typeof address&&hasSingleCase(address),"Invalid address: "+address+".");var pieces=address.toLowerCase().split(":");validate(2===pieces.length,"Missing prefix: "+address+".");var prefix=pieces[0],payload=base32.decode(pieces[1]);validate(function(prefix,payload){return polymod(concat(concat(prefixToUint5Array(prefix),new Uint8Array(1)),payload)).equals(0)}(prefix,payload),"Invalid checksum: "+address+".");var data,payloadData=(data=payload.subarray(0,-8),convertBits(data,5,8,!0)),versionByte=payloadData[0],hash=payloadData.subarray(1);return validate(function(versionByte){switch(7&versionByte){case 0:return 160;case 1:return 192;case 2:return 224;case 3:return 256;case 4:return 320;case 5:return 384;case 6:return 448;case 7:return 512}}(versionByte)===8*hash.length,"Invalid hash size: "+address+"."),{prefix:prefix,type:function(versionByte){switch(120&versionByte){case 0:return"P2PKH";case 8:return"P2SH";default:throw new ValidationError("Invalid address type in version byte: "+versionByte+".")}}(versionByte),hash:hash}},ValidationError:ValidationError}},{"./base32":10,"./convertBits":12,"./validation":13,"big-integer":3}],12:[function(require,module,exports){"use strict";var validate=require("./validation").validate;module.exports=function(data,from,to,strictMode){for(var length=strictMode?Math.floor(data.length*from/to):Math.ceil(data.length*from/to),mask=(1<<to)-1,result=new Uint8Array(length),index=0,accumulator=0,bits=0,i=0;i<data.length;++i){var value=data[i];for(validate(0<=value&&value>>from==0,"Invalid value: "+value+"."),accumulator=accumulator<<from|value,bits+=from;to<=bits;)bits-=to,result[index]=accumulator>>bits&mask,++index}return strictMode?validate(bits<from&&0==(accumulator<<to-bits&mask),"Input cannot be converted to "+to+" bits without padding, but strict mode was used."):0<bits&&(result[index]=accumulator<<to-bits&mask,++index),result}},{"./validation":13}],13:[function(require,module,exports){"use strict";function ValidationError(message){var error=new Error;this.name=error.name="ValidationError",this.message=error.message=message,this.stack=error.stack}ValidationError.prototype=Object.create(Error.prototype),module.exports={ValidationError:ValidationError,validate:function(condition,message){if(!condition)throw new ValidationError(message)}}},{}],14:[function(require,module,exports){var Buffer=require("safe-buffer").Buffer,Transform=require("stream").Transform,StringDecoder=require("string_decoder").StringDecoder;function CipherBase(hashMode){Transform.call(this),this.hashMode="string"==typeof hashMode,this.hashMode?this[hashMode]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}require("inherits")(CipherBase,Transform),CipherBase.prototype.update=function(data,inputEnc,outputEnc){"string"==typeof data&&(data=Buffer.from(data,inputEnc));var outData=this._update(data);return this.hashMode?this:(outputEnc&&(outData=this._toString(outData,outputEnc)),outData)},CipherBase.prototype.setAutoPadding=function(){},CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},CipherBase.prototype._transform=function(data,_,next){var err;try{this.hashMode?this._update(data):this.push(this._update(data))}catch(e){err=e}finally{next(err)}},CipherBase.prototype._flush=function(done){var err;try{this.push(this.__final())}catch(e){err=e}done(err)},CipherBase.prototype._finalOrDigest=function(outputEnc){var outData=this.__final()||Buffer.alloc(0);return outputEnc&&(outData=this._toString(outData,outputEnc,!0)),outData},CipherBase.prototype._toString=function(value,enc,fin){if(this._decoder||(this._decoder=new StringDecoder(enc),this._encoding=enc),this._encoding!==enc)throw new Error("can't switch encodings");var out=this._decoder.write(value);return fin&&(out+=this._decoder.end()),out},module.exports=CipherBase},{inherits:22,"safe-buffer":41,stream:50,string_decoder:51}],15:[function(require,module,exports){(function(Buffer){function objectToString(o){return Object.prototype.toString.call(o)}exports.isArray=function(arg){return Array.isArray?Array.isArray(arg):"[object Array]"===objectToString(arg)},exports.isBoolean=function(arg){return"boolean"==typeof arg},exports.isNull=function(arg){return null===arg},exports.isNullOrUndefined=function(arg){return null==arg},exports.isNumber=function(arg){return"number"==typeof arg},exports.isString=function(arg){return"string"==typeof arg},exports.isSymbol=function(arg){return"symbol"==typeof arg},exports.isUndefined=function(arg){return void 0===arg},exports.isRegExp=function(re){return"[object RegExp]"===objectToString(re)},exports.isObject=function(arg){return"object"==typeof arg&&null!==arg},exports.isDate=function(d){return"[object Date]"===objectToString(d)},exports.isError=function(e){return"[object Error]"===objectToString(e)||e instanceof Error},exports.isFunction=function(arg){return"function"==typeof arg},exports.isPrimitive=function(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||void 0===arg},exports.isBuffer=Buffer.isBuffer}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":23}],16:[function(require,module,exports){(function(Buffer){"use strict";var inherits=require("inherits"),md5=require("./md5"),RIPEMD160=require("ripemd160"),sha=require("sha.js"),Base=require("cipher-base");function HashNoConstructor(hash){Base.call(this,"digest"),this._hash=hash,this.buffers=[]}function Hash(hash){Base.call(this,"digest"),this._hash=hash}inherits(HashNoConstructor,Base),HashNoConstructor.prototype._update=function(data){this.buffers.push(data)},HashNoConstructor.prototype._final=function(){var buf=Buffer.concat(this.buffers),r=this._hash(buf);return this.buffers=null,r},inherits(Hash,Base),Hash.prototype._update=function(data){this._hash.update(data)},Hash.prototype._final=function(){return this._hash.digest()},module.exports=function(alg){return"md5"===(alg=alg.toLowerCase())?new HashNoConstructor(md5):new Hash("rmd160"===alg||"ripemd160"===alg?new RIPEMD160:sha(alg))}}).call(this,require("buffer").Buffer)},{"./md5":18,buffer:9,"cipher-base":14,inherits:22,ripemd160:40,"sha.js":43}],17:[function(require,module,exports){(function(Buffer){"use strict";var zeroBuffer=new Buffer(4);zeroBuffer.fill(0);module.exports=function(buf,fn){var arr=fn(function(buf){if(buf.length%4!=0){var len=buf.length+(4-buf.length%4);buf=Buffer.concat([buf,zeroBuffer],len)}for(var arr=new Array(buf.length>>>2),i=0,j=0;i<buf.length;i+=4,j++)arr[j]=buf.readInt32LE(i);return arr}(buf),8*buf.length);buf=new Buffer(16);for(var i=0;i<arr.length;i++)buf.writeInt32LE(arr[i],i<<2,!0);return buf}}).call(this,require("buffer").Buffer)},{buffer:9}],18:[function(require,module,exports){"use strict";var makeHash=require("./make-hash");function core_md5(x,len){x[len>>5]|=128<<len%32,x[14+(len+64>>>9<<4)]=len;for(var a=1732584193,b=-271733879,c=-1732584194,d=271733878,i=0;i<x.length;i+=16){var olda=a,oldb=b,oldc=c,oldd=d;b=md5_ii(b=md5_ii(b=md5_ii(b=md5_ii(b=md5_hh(b=md5_hh(b=md5_hh(b=md5_hh(b=md5_gg(b=md5_gg(b=md5_gg(b=md5_gg(b=md5_ff(b=md5_ff(b=md5_ff(b=md5_ff(b,c=md5_ff(c,d=md5_ff(d,a=md5_ff(a,b,c,d,x[i+0],7,-680876936),b,c,x[i+1],12,-389564586),a,b,x[i+2],17,606105819),d,a,x[i+3],22,-1044525330),c=md5_ff(c,d=md5_ff(d,a=md5_ff(a,b,c,d,x[i+4],7,-176418897),b,c,x[i+5],12,1200080426),a,b,x[i+6],17,-1473231341),d,a,x[i+7],22,-45705983),c=md5_ff(c,d=md5_ff(d,a=md5_ff(a,b,c,d,x[i+8],7,1770035416),b,c,x[i+9],12,-1958414417),a,b,x[i+10],17,-42063),d,a,x[i+11],22,-1990404162),c=md5_ff(c,d=md5_ff(d,a=md5_ff(a,b,c,d,x[i+12],7,1804603682),b,c,x[i+13],12,-40341101),a,b,x[i+14],17,-1502002290),d,a,x[i+15],22,1236535329),c=md5_gg(c,d=md5_gg(d,a=md5_gg(a,b,c,d,x[i+1],5,-165796510),b,c,x[i+6],9,-1069501632),a,b,x[i+11],14,643717713),d,a,x[i+0],20,-373897302),c=md5_gg(c,d=md5_gg(d,a=md5_gg(a,b,c,d,x[i+5],5,-701558691),b,c,x[i+10],9,38016083),a,b,x[i+15],14,-660478335),d,a,x[i+4],20,-405537848),c=md5_gg(c,d=md5_gg(d,a=md5_gg(a,b,c,d,x[i+9],5,568446438),b,c,x[i+14],9,-1019803690),a,b,x[i+3],14,-187363961),d,a,x[i+8],20,1163531501),c=md5_gg(c,d=md5_gg(d,a=md5_gg(a,b,c,d,x[i+13],5,-1444681467),b,c,x[i+2],9,-51403784),a,b,x[i+7],14,1735328473),d,a,x[i+12],20,-1926607734),c=md5_hh(c,d=md5_hh(d,a=md5_hh(a,b,c,d,x[i+5],4,-378558),b,c,x[i+8],11,-2022574463),a,b,x[i+11],16,1839030562),d,a,x[i+14],23,-35309556),c=md5_hh(c,d=md5_hh(d,a=md5_hh(a,b,c,d,x[i+1],4,-1530992060),b,c,x[i+4],11,1272893353),a,b,x[i+7],16,-155497632),d,a,x[i+10],23,-1094730640),c=md5_hh(c,d=md5_hh(d,a=md5_hh(a,b,c,d,x[i+13],4,681279174),b,c,x[i+0],11,-358537222),a,b,x[i+3],16,-722521979),d,a,x[i+6],23,76029189),c=md5_hh(c,d=md5_hh(d,a=md5_hh(a,b,c,d,x[i+9],4,-640364487),b,c,x[i+12],11,-421815835),a,b,x[i+15],16,530742520),d,a,x[i+2],23,-995338651),c=md5_ii(c,d=md5_ii(d,a=md5_ii(a,b,c,d,x[i+0],6,-198630844),b,c,x[i+7],10,1126891415),a,b,x[i+14],15,-1416354905),d,a,x[i+5],21,-57434055),c=md5_ii(c,d=md5_ii(d,a=md5_ii(a,b,c,d,x[i+12],6,1700485571),b,c,x[i+3],10,-1894986606),a,b,x[i+10],15,-1051523),d,a,x[i+1],21,-2054922799),c=md5_ii(c,d=md5_ii(d,a=md5_ii(a,b,c,d,x[i+8],6,1873313359),b,c,x[i+15],10,-30611744),a,b,x[i+6],15,-1560198380),d,a,x[i+13],21,1309151649),c=md5_ii(c,d=md5_ii(d,a=md5_ii(a,b,c,d,x[i+4],6,-145523070),b,c,x[i+11],10,-1120210379),a,b,x[i+2],15,718787259),d,a,x[i+9],21,-343485551),a=safe_add(a,olda),b=safe_add(b,oldb),c=safe_add(c,oldc),d=safe_add(d,oldd)}return[a,b,c,d]}function md5_cmn(q,a,b,x,s,t){return safe_add((num=safe_add(safe_add(a,q),safe_add(x,t)))<<(cnt=s)|num>>>32-cnt,b);var num,cnt}function md5_ff(a,b,c,d,x,s,t){return md5_cmn(b&c|~b&d,a,b,x,s,t)}function md5_gg(a,b,c,d,x,s,t){return md5_cmn(b&d|c&~d,a,b,x,s,t)}function md5_hh(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t)}function md5_ii(a,b,c,d,x,s,t){return md5_cmn(c^(b|~d),a,b,x,s,t)}function safe_add(x,y){var lsw=(65535&x)+(65535&y);return(x>>16)+(y>>16)+(lsw>>16)<<16|65535&lsw}module.exports=function(buf){return makeHash(buf,core_md5)}},{"./make-hash":17}],19:[function(require,module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}((module.exports=EventEmitter).EventEmitter=EventEmitter).prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if("number"!=typeof n||n<0||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if((er=arguments[1])instanceof Error)throw er;var err=new Error('Uncaught, unspecified "error" event. ('+er+")");throw err.context=er,err}if(isUndefined(handler=this._events[type]))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),len=(listeners=handler.slice()).length,i=0;i<len;i++)listeners[i].apply(this,args);return!0},EventEmitter.prototype.on=EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned&&(m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners)&&0<m&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace()),this},EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(length=(list=this._events[type]).length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;0<i--;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(isFunction(listeners=this._events[type]))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){return this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],20:[function(require,module,exports){(function(Buffer){"use strict";var Transform=require("stream").Transform;function HashBase(blockSize){Transform.call(this),this._block=new Buffer(blockSize),this._blockSize=blockSize,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}require("inherits")(HashBase,Transform),HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{"buffer"!==encoding&&(chunk=new Buffer(chunk,encoding)),this.update(chunk)}catch(err){error=err}callback(error)},HashBase.prototype._flush=function(callback){var error=null;try{this.push(this._digest())}catch(err){error=err}callback(error)},HashBase.prototype.update=function(data,encoding){if(!Buffer.isBuffer(data)&&"string"!=typeof data)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");Buffer.isBuffer(data)||(data=new Buffer(data,encoding||"binary"));for(var block=this._block,offset=0;this._blockOffset+data.length-offset>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)block[i++]=data[offset++];this._update(),this._blockOffset=0}for(;offset<data.length;)block[this._blockOffset++]=data[offset++];for(var j=0,carry=8*data.length;0<carry;++j)this._length[j]+=carry,0<(carry=this._length[j]/4294967296|0)&&(this._length[j]-=4294967296*carry);return this},HashBase.prototype._update=function(data){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var digest=this._digest();return void 0!==encoding&&(digest=digest.toString(encoding)),digest},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},module.exports=HashBase}).call(this,require("buffer").Buffer)},{buffer:9,inherits:22,stream:50}],21:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;0<nBits;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;0<nBits;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:1/0*(s?-1:1);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),2<=(value+=1<=e+eBias?rt/c:rt*Math.pow(2,1-eBias))*c&&(e++,c/=2),eMax<=e+eBias?(m=0,e=eMax):1<=e+eBias?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));8<=mLen;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<<mLen|m,eLen+=mLen;0<eLen;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],22:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],23:[function(require,module,exports){function isBuffer(obj){return!!obj.constructor&&"function"==typeof obj.constructor.isBuffer&&obj.constructor.isBuffer(obj)}module.exports=function(obj){return null!=obj&&(isBuffer(obj)||function(obj){return"function"==typeof obj.readFloatLE&&"function"==typeof obj.slice&&isBuffer(obj.slice(0,0))}(obj)||!!obj._isBuffer)}},{}],24:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},{}],25:[function(require,module,exports){(function(process){"use strict";!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?module.exports=function(fn,arg1,arg2,arg3){if("function"!=typeof fn)throw new TypeError('"callback" argument must be a function');var args,i,len=arguments.length;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function(){fn.call(null,arg1)});case 3:return process.nextTick(function(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function(){fn.call(null,arg1,arg2,arg3)});default:for(args=new Array(len-1),i=0;i<args.length;)args[i++]=arguments[i];return process.nextTick(function(){fn.apply(null,args)})}}:module.exports=process.nextTick}).call(this,require("_process"))},{_process:26}],26:[function(require,module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],27:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":28}],28:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args"),objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};module.exports=Duplex;var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");util.inherits(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v<keys.length;v++){var method=keys[v];Duplex.prototype[method]||(Duplex.prototype[method]=Writable.prototype[method])}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options),Writable.call(this,options),options&&!1===options.readable&&(this.readable=!1),options&&!1===options.writable&&(this.writable=!1),this.allowHalfOpen=!0,options&&!1===options.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||processNextTick(onEndNT,this)}function onEndNT(self){self.end()}Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(value){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=value,this._writableState.destroyed=value)}}),Duplex.prototype._destroy=function(err,cb){this.push(null),this.end(),processNextTick(cb,err)}},{"./_stream_readable":30,"./_stream_writable":32,"core-util-is":15,inherits:22,"process-nextick-args":25}],29:[function(require,module,exports){"use strict";module.exports=PassThrough;var Transform=require("./_stream_transform"),util=require("core-util-is");function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}util.inherits=require("inherits"),util.inherits(PassThrough,Transform),PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":31,"core-util-is":15,inherits:22}],30:[function(require,module,exports){(function(process,global){"use strict";var processNextTick=require("process-nextick-args");module.exports=Readable;var Duplex,isArray=require("isarray");Readable.ReadableState=ReadableState;require("events").EventEmitter;var EElistenerCount=function(emitter,type){return emitter.listeners(type).length},Stream=require("./internal/streams/stream"),Buffer=require("safe-buffer").Buffer,OurUint8Array=global.Uint8Array||function(){};var util=require("core-util-is");util.inherits=require("inherits");var debugUtil=require("util"),debug=void 0;debug=debugUtil&&debugUtil.debuglog?debugUtil.debuglog("stream"):function(){};var StringDecoder,BufferList=require("./internal/streams/BufferList"),destroyImpl=require("./internal/streams/destroy");util.inherits(Readable,Stream);var kProxyEvents=["error","close","destroy","pause","resume"];function ReadableState(options,stream){Duplex=Duplex||require("./_stream_duplex"),options=options||{},this.objectMode=!!options.objectMode,stream instanceof Duplex&&(this.objectMode=this.objectMode||!!options.readableObjectMode);var hwm=options.highWaterMark,defaultHwm=this.objectMode?16:16384;this.highWaterMark=hwm||0===hwm?hwm:defaultHwm,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new BufferList,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=options.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,options.encoding&&(StringDecoder||(StringDecoder=require("string_decoder/").StringDecoder),this.decoder=new StringDecoder(options.encoding),this.encoding=options.encoding)}function Readable(options){if(Duplex=Duplex||require("./_stream_duplex"),!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this),this.readable=!0,options&&("function"==typeof options.read&&(this._read=options.read),"function"==typeof options.destroy&&(this._destroy=options.destroy)),Stream.call(this)}function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){var er,state=stream._readableState;null===chunk?(state.reading=!1,function(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,emitReadable(stream)}(stream,state)):(skipChunkCheck||(er=function(state,chunk){var er;obj=chunk,Buffer.isBuffer(obj)||obj instanceof OurUint8Array||"string"==typeof chunk||void 0===chunk||state.objectMode||(er=new TypeError("Invalid non-string/buffer chunk"));var obj;return er}(state,chunk)),er?stream.emit("error",er):state.objectMode||chunk&&0<chunk.length?("string"==typeof chunk||state.objectMode||Object.getPrototypeOf(chunk)===Buffer.prototype||(chunk=function(chunk){return Buffer.from(chunk)}(chunk)),addToFront?state.endEmitted?stream.emit("error",new Error("stream.unshift() after end event")):addChunk(stream,state,chunk,!0):state.ended?stream.emit("error",new Error("stream.push() after EOF")):(state.reading=!1,state.decoder&&!encoding?(chunk=state.decoder.write(chunk),state.objectMode||0!==chunk.length?addChunk(stream,state,chunk,!1):maybeReadMore(stream,state)):addChunk(stream,state,chunk,!1))):addToFront||(state.reading=!1));return function(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||0===state.length)}(state)}function addChunk(stream,state,chunk,addToFront){state.flowing&&0===state.length&&!state.sync?(stream.emit("data",chunk),stream.read(0)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream)),maybeReadMore(stream,state)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(value){this._readableState&&(this._readableState.destroyed=value)}}),Readable.prototype.destroy=destroyImpl.destroy,Readable.prototype._undestroy=destroyImpl.undestroy,Readable.prototype._destroy=function(err,cb){this.push(null),cb(err)},Readable.prototype.push=function(chunk,encoding){var skipChunkCheck,state=this._readableState;return state.objectMode?skipChunkCheck=!0:"string"==typeof chunk&&((encoding=encoding||state.defaultEncoding)!==state.encoding&&(chunk=Buffer.from(chunk,encoding),encoding=""),skipChunkCheck=!0),readableAddChunk(this,chunk,encoding,!1,skipChunkCheck)},Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(enc){return StringDecoder||(StringDecoder=require("string_decoder/").StringDecoder),this._readableState.decoder=new StringDecoder(enc),this._readableState.encoding=enc,this};var MAX_HWM=8388608;function howMuchToRead(n,state){return n<=0||0===state.length&&state.ended?0:state.objectMode?1:n!=n?state.flowing&&state.length?state.buffer.head.data.length:state.length:(n>state.highWaterMark&&(state.highWaterMark=function(n){return MAX_HWM<=n?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}function emitReadable(stream){var state=stream._readableState;state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,state.sync?processNextTick(emitReadable_,stream):emitReadable_(stream))}function emitReadable_(stream){debug("emit readable"),stream.emit("readable"),flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,processNextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(var len=state.length;!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark&&(debug("maybeReadMore read 0"),stream.read(0),len!==state.length);)len=state.length;state.readingMore=!1}function nReadingNextTick(self){debug("readable nexttick read 0"),self.read(0)}function resume_(stream,state){state.reading||(debug("resume read 0"),stream.read(0)),state.resumeScheduled=!1,state.awaitDrain=0,stream.emit("resume"),flow(stream),state.flowing&&!state.reading&&stream.read(0)}function flow(stream){var state=stream._readableState;for(debug("flow",state.flowing);state.flowing&&null!==stream.read(););}function fromList(n,state){return 0===state.length?null:(state.objectMode?ret=state.buffer.shift():!n||n>=state.length?(ret=state.decoder?state.buffer.join(""):1===state.buffer.length?state.buffer.head.data:state.buffer.concat(state.length),state.buffer.clear()):ret=function(n,list,hasStrings){var ret;n<list.head.data.length?(ret=list.head.data.slice(0,n),list.head.data=list.head.data.slice(n)):ret=n===list.head.data.length?list.shift():hasStrings?function(n,list){var p=list.head,c=1,ret=p.data;n-=ret.length;for(;p=p.next;){var str=p.data,nb=n>str.length?str.length:n;if(nb===str.length?ret+=str:ret+=str.slice(0,n),0===(n-=nb)){nb===str.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p).data=str.slice(nb);break}++c}return list.length-=c,ret}(n,list):function(n,list){var ret=Buffer.allocUnsafe(n),p=list.head,c=1;p.data.copy(ret),n-=p.data.length;for(;p=p.next;){var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),0===(n-=nb)){nb===buf.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p).data=buf.slice(nb);break}++c}return list.length-=c,ret}(n,list);return ret}(n,state.buffer,state.decoder),ret);var ret}function endReadable(stream){var state=stream._readableState;if(0<state.length)throw new Error('"endReadable()" called on non-empty stream');state.endEmitted||(state.ended=!0,processNextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){state.endEmitted||0!==state.length||(state.endEmitted=!0,stream.readable=!1,stream.emit("end"))}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++)if(xs[i]===x)return i;return-1}Readable.prototype.read=function(n){debug("read",n),n=parseInt(n,10);var state=this._readableState,nOrig=n;if(0!==n&&(state.emittedReadable=!1),0===n&&state.needReadable&&(state.length>=state.highWaterMark||state.ended))return debug("read: emitReadable",state.length,state.ended),0===state.length&&state.ended?endReadable(this):emitReadable(this),null;if(0===(n=howMuchToRead(n,state))&&state.ended)return 0===state.length&&endReadable(this),null;var ret,doRead=state.needReadable;return debug("need readable",doRead),(0===state.length||state.length-n<state.highWaterMark)&&debug("length less than watermark",doRead=!0),state.ended||state.reading?debug("reading or ended",doRead=!1):doRead&&(debug("do read"),state.reading=!0,state.sync=!0,0===state.length&&(state.needReadable=!0),this._read(state.highWaterMark),state.sync=!1,state.reading||(n=howMuchToRead(nOrig,state))),null===(ret=0<n?fromList(n,state):null)?(state.needReadable=!0,n=0):state.length-=n,0===state.length&&(state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&endReadable(this)),null!==ret&&this.emit("data",ret),ret},Readable.prototype._read=function(n){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(dest,pipeOpts){var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest)}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var endFn=(!pipeOpts||!1!==pipeOpts.end)&&dest!==process.stdout&&dest!==process.stderr?onend:unpipe;function onunpipe(readable,unpipeInfo){debug("onunpipe"),readable===src&&unpipeInfo&&!1===unpipeInfo.hasUnpiped&&(unpipeInfo.hasUnpiped=!0,debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",unpipe),src.removeListener("data",ondata),cleanedUp=!0,!state.awaitDrain||dest._writableState&&!dest._writableState.needDrain||ondrain())}function onend(){debug("onend"),dest.end()}state.endEmitted?processNextTick(endFn):src.once("end",endFn),dest.on("unpipe",onunpipe);var ondrain=function(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain),state.awaitDrain&&state.awaitDrain--,0===state.awaitDrain&&EElistenerCount(src,"data")&&(state.flowing=!0,flow(src))}}(src);dest.on("drain",ondrain);var cleanedUp=!1;var increasedAwaitDrain=!1;function ondata(chunk){debug("ondata"),(increasedAwaitDrain=!1)!==dest.write(chunk)||increasedAwaitDrain||((1===state.pipesCount&&state.pipes===dest||1<state.pipesCount&&-1!==indexOf(state.pipes,dest))&&!cleanedUp&&(debug("false write response, pause",src._readableState.awaitDrain),src._readableState.awaitDrain++,increasedAwaitDrain=!0),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),0===EElistenerCount(dest,"error")&&dest.emit("error",er)}function onclose(){dest.removeListener("finish",onfinish),unpipe()}function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}function unpipe(){debug("unpipe"),src.unpipe(dest)}return src.on("data",ondata),function(emitter,event,fn){if("function"==typeof emitter.prependListener)return emitter.prependListener(event,fn);emitter._events&&emitter._events[event]?isArray(emitter._events[event])?emitter._events[event].unshift(fn):emitter._events[event]=[fn,emitter._events[event]]:emitter.on(event,fn)}(dest,"error",onerror),dest.once("close",onclose),dest.once("finish",onfinish),dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest},Readable.prototype.unpipe=function(dest){var state=this._readableState,unpipeInfo={hasUnpiped:!1};if(0===state.pipesCount)return this;if(1===state.pipesCount)return dest&&dest!==state.pipes||(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this,unpipeInfo)),this;if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var i=0;i<len;i++)dests[i].emit("unpipe",this,unpipeInfo);return this}var index=indexOf(state.pipes,dest);return-1===index||(state.pipes.splice(index,1),state.pipesCount-=1,1===state.pipesCount&&(state.pipes=state.pipes[0]),dest.emit("unpipe",this,unpipeInfo)),this},Readable.prototype.addListener=Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if("data"===ev)!1!==this._readableState.flowing&&this.resume();else if("readable"===ev){var state=this._readableState;state.endEmitted||state.readableListening||(state.readableListening=state.needReadable=!0,state.emittedReadable=!1,state.reading?state.length&&emitReadable(this):processNextTick(nReadingNextTick,this))}return res},Readable.prototype.resume=function(){var state=this._readableState;return state.flowing||(debug("resume"),state.flowing=!0,function(stream,state){state.resumeScheduled||(state.resumeScheduled=!0,processNextTick(resume_,stream,state))}(this,state)),this},Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Readable.prototype.wrap=function(stream){var state=this._readableState,paused=!1,self=this;for(var i in stream.on("end",function(){if(debug("wrapped end"),state.decoder&&!state.ended){var chunk=state.decoder.end();chunk&&chunk.length&&self.push(chunk)}self.push(null)}),stream.on("data",function(chunk){(debug("wrapped data"),state.decoder&&(chunk=state.decoder.write(chunk)),state.objectMode&&null==chunk)||(state.objectMode||chunk&&chunk.length)&&(self.push(chunk)||(paused=!0,stream.pause()))}),stream)void 0===this[i]&&"function"==typeof stream[i]&&(this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i));for(var n=0;n<kProxyEvents.length;n++)stream.on(kProxyEvents[n],self.emit.bind(self,kProxyEvents[n]));return self._read=function(n){debug("wrapped _read",n),paused&&(paused=!1,stream.resume())},self},Readable._fromList=fromList}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":28,"./internal/streams/BufferList":33,"./internal/streams/destroy":34,"./internal/streams/stream":35,_process:26,"core-util-is":15,events:19,inherits:22,isarray:24,"process-nextick-args":25,"safe-buffer":41,"string_decoder/":51,util:4}],31:[function(require,module,exports){"use strict";module.exports=Transform;var Duplex=require("./_stream_duplex"),util=require("core-util-is");function TransformState(stream){this.afterTransform=function(er,data){return function(stream,er,data){var ts=stream._transformState;ts.transforming=!1;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("write callback called multiple times"));ts.writechunk=null,(ts.writecb=null)!=data&&stream.push(data);cb(er);var rs=stream._readableState;rs.reading=!1,(rs.needReadable||rs.length<rs.highWaterMark)&&stream._read(rs.highWaterMark)}(stream,er,data)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options),this._transformState=new TransformState(this);var stream=this;this._readableState.needReadable=!0,this._readableState.sync=!1,options&&("function"==typeof options.transform&&(this._transform=options.transform),"function"==typeof options.flush&&(this._flush=options.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(er,data){done(stream,er,data)}):done(stream)})}function done(stream,er,data){if(er)return stream.emit("error",er);null!=data&&stream.push(data);var ws=stream._writableState,ts=stream._transformState;if(ws.length)throw new Error("Calling transform done when ws.length != 0");if(ts.transforming)throw new Error("Calling transform done when still transforming");return stream.push(null)}util.inherits=require("inherits"),util.inherits(Transform,Duplex),Transform.prototype.push=function(chunk,encoding){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,chunk,encoding)},Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("_transform() is not implemented")},Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;if(ts.writecb=cb,ts.writechunk=chunk,ts.writeencoding=encoding,!ts.transforming){var rs=this._readableState;(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)&&this._read(rs.highWaterMark)}},Transform.prototype._read=function(n){var ts=this._transformState;null!==ts.writechunk&&ts.writecb&&!ts.transforming?(ts.transforming=!0,this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)):ts.needTransform=!0},Transform.prototype._destroy=function(err,cb){var _this=this;Duplex.prototype._destroy.call(this,err,function(err2){cb(err2),_this.emit("close")})}},{"./_stream_duplex":28,"core-util-is":15,inherits:22}],32:[function(require,module,exports){(function(process,global){"use strict";var processNextTick=require("process-nextick-args");function CorkedRequest(state){var _this=this;this.next=null,this.entry=null,this.finish=function(){!function(corkReq,state,err){var entry=corkReq.entry;corkReq.entry=null;for(;entry;){var cb=entry.callback;state.pendingcb--,cb(err),entry=entry.next}state.corkedRequestsFree?state.corkedRequestsFree.next=corkReq:state.corkedRequestsFree=corkReq}(_this,state)}}module.exports=Writable;var Duplex,asyncWrite=!process.browser&&-1<["v0.10","v0.9."].indexOf(process.version.slice(0,5))?setImmediate:processNextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")},Stream=require("./internal/streams/stream"),Buffer=require("safe-buffer").Buffer,OurUint8Array=global.Uint8Array||function(){};var realHasInstance,destroyImpl=require("./internal/streams/destroy");function nop(){}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex"),options=options||{},this.objectMode=!!options.objectMode,stream instanceof Duplex&&(this.objectMode=this.objectMode||!!options.writableObjectMode);var hwm=options.highWaterMark,defaultHwm=this.objectMode?16:16384;this.highWaterMark=hwm||0===hwm?hwm:defaultHwm,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var noDecode=(this.destroyed=!1)===options.decodeStrings;this.decodeStrings=!noDecode,this.defaultEncoding=options.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(er){!function(stream,er){var state=stream._writableState,sync=state.sync,cb=state.writecb;if(function(state){state.writing=!1,state.writecb=null,state.length-=state.writelen,state.writelen=0}(state),er)!function(stream,state,sync,er,cb){--state.pendingcb,sync?(processNextTick(cb,er),processNextTick(finishMaybe,stream,state),stream._writableState.errorEmitted=!0,stream.emit("error",er)):(cb(er),stream._writableState.errorEmitted=!0,stream.emit("error",er),finishMaybe(stream,state))}(stream,state,sync,er,cb);else{var finished=needFinish(state);finished||state.corked||state.bufferProcessing||!state.bufferedRequest||clearBuffer(stream,state),sync?asyncWrite(afterWrite,stream,state,finished,cb):afterWrite(stream,state,finished,cb)}}(stream,er)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(options){if(Duplex=Duplex||require("./_stream_duplex"),!(realHasInstance.call(Writable,this)||this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this),this.writable=!0,options&&("function"==typeof options.write&&(this._write=options.write),"function"==typeof options.writev&&(this._writev=options.writev),"function"==typeof options.destroy&&(this._destroy=options.destroy),"function"==typeof options.final&&(this._final=options.final)),Stream.call(this)}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len,state.writecb=cb,state.writing=!0,state.sync=!0,writev?stream._writev(chunk,state.onwrite):stream._write(chunk,encoding,state.onwrite),state.sync=!1}function afterWrite(stream,state,finished,cb){finished||function(stream,state){0===state.length&&state.needDrain&&(state.needDrain=!1,stream.emit("drain"))}(stream,state),state.pendingcb--,cb(),finishMaybe(stream,state)}function clearBuffer(stream,state){state.bufferProcessing=!0;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount,buffer=new Array(l),holder=state.corkedRequestsFree;holder.entry=entry;for(var count=0,allBuffers=!0;entry;)(buffer[count]=entry).isBuf||(allBuffers=!1),entry=entry.next,count+=1;buffer.allBuffers=allBuffers,doWrite(stream,state,!0,state.length,buffer,"",holder.finish),state.pendingcb++,state.lastBufferedRequest=null,holder.next?(state.corkedRequestsFree=holder.next,holder.next=null):state.corkedRequestsFree=new CorkedRequest(state)}else{for(;entry;){var chunk=entry.chunk,encoding=entry.encoding,cb=entry.callback;if(doWrite(stream,state,!1,state.objectMode?1:chunk.length,chunk,encoding,cb),entry=entry.next,state.writing)break}null===entry&&(state.lastBufferedRequest=null)}state.bufferedRequestCount=0,state.bufferedRequest=entry,state.bufferProcessing=!1}function needFinish(state){return state.ending&&0===state.length&&null===state.bufferedRequest&&!state.finished&&!state.writing}function callFinal(stream,state){stream._final(function(err){state.pendingcb--,err&&stream.emit("error",err),state.prefinished=!0,stream.emit("prefinish"),finishMaybe(stream,state)})}function finishMaybe(stream,state){var need=needFinish(state);return need&&(!function(stream,state){state.prefinished||state.finalCalled||("function"==typeof stream._final?(state.pendingcb++,state.finalCalled=!0,processNextTick(callFinal,stream,state)):(state.prefinished=!0,stream.emit("prefinish")))}(stream,state),0===state.pendingcb&&(state.finished=!0,stream.emit("finish"))),need}util.inherits(Writable,Stream),WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(_){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){return!!realHasInstance.call(this,object)||object&&object._writableState instanceof WritableState}})):realHasInstance=function(object){return object instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(chunk,encoding,cb){var obj,state=this._writableState,ret=!1,isBuf=(obj=chunk,(Buffer.isBuffer(obj)||obj instanceof OurUint8Array)&&!state.objectMode);return isBuf&&!Buffer.isBuffer(chunk)&&(chunk=function(chunk){return Buffer.from(chunk)}(chunk)),"function"==typeof encoding&&(cb=encoding,encoding=null),isBuf?encoding="buffer":encoding||(encoding=state.defaultEncoding),"function"!=typeof cb&&(cb=nop),state.ended?function(stream,cb){var er=new Error("write after end");stream.emit("error",er),processNextTick(cb,er)}(this,cb):(isBuf||function(stream,state,chunk,cb){var valid=!0,er=!1;return null===chunk?er=new TypeError("May not write null values to stream"):"string"==typeof chunk||void 0===chunk||state.objectMode||(er=new TypeError("Invalid non-string/buffer chunk")),er&&(stream.emit("error",er),processNextTick(cb,er),valid=!1),valid}(this,state,chunk,cb))&&(state.pendingcb++,ret=function(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=function(state,chunk,encoding){state.objectMode||!1===state.decodeStrings||"string"!=typeof chunk||(chunk=Buffer.from(chunk,encoding));return chunk}(state,chunk,encoding);chunk!==newChunk&&(isBuf=!0,encoding="buffer",chunk=newChunk)}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;ret||(state.needDrain=!0);if(state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest={chunk:chunk,encoding:encoding,isBuf:isBuf,callback:cb,next:null},last?last.next=state.lastBufferedRequest:state.bufferedRequest=state.lastBufferedRequest,state.bufferedRequestCount+=1}else doWrite(stream,state,!1,len,chunk,encoding,cb);return ret}(this,state,isBuf,chunk,encoding,cb)),ret},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,state.writing||state.corked||state.finished||state.bufferProcessing||!state.bufferedRequest||clearBuffer(this,state))},Writable.prototype.setDefaultEncoding=function(encoding){if("string"==typeof encoding&&(encoding=encoding.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())))throw new TypeError("Unknown encoding: "+encoding);return this._writableState.defaultEncoding=encoding,this},Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;"function"==typeof chunk?(cb=chunk,encoding=chunk=null):"function"==typeof encoding&&(cb=encoding,encoding=null),null!=chunk&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||state.finished||function(stream,state,cb){state.ending=!0,finishMaybe(stream,state),cb&&(state.finished?processNextTick(cb):stream.once("finish",cb));state.ended=!0,stream.writable=!1}(this,state,cb)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(value){this._writableState&&(this._writableState.destroyed=value)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(err,cb){this.end(),cb(err)}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":28,"./internal/streams/destroy":34,"./internal/streams/stream":35,_process:26,"core-util-is":15,inherits:22,"process-nextick-args":25,"safe-buffer":41,"util-deprecate":52}],33:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;module.exports=function(){function BufferList(){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function(v){var entry={data:v,next:null};0<this.length?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length},BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};0===this.length&&(this.tail=entry),this.head=entry,++this.length},BufferList.prototype.shift=function(){if(0!==this.length){var ret=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}},BufferList.prototype.clear=function(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function(s){if(0===this.length)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret},BufferList.prototype.concat=function(n){if(0===this.length)return Buffer.alloc(0);if(1===this.length)return this.head.data;for(var src,target,offset,ret=Buffer.allocUnsafe(n>>>0),p=this.head,i=0;p;)src=p.data,target=ret,offset=i,src.copy(target,offset),i+=p.data.length,p=p.next;return ret},BufferList}()},{"safe-buffer":41}],34:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args");function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:function(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;readableDestroyed||writableDestroyed?cb?cb(err):!err||this._writableState&&this._writableState.errorEmitted||processNextTick(emitErrorNT,this,err):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err){!cb&&err?(processNextTick(emitErrorNT,_this,err),_this._writableState&&(_this._writableState.errorEmitted=!0)):cb&&cb(err)}))},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":25}],35:[function(require,module,exports){module.exports=require("events").EventEmitter},{events:19}],36:[function(require,module,exports){module.exports=require("./readable").PassThrough},{"./readable":37}],37:[function(require,module,exports){(((exports=module.exports=require("./lib/_stream_readable.js")).Stream=exports).Readable=exports).Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":28,"./lib/_stream_passthrough.js":29,"./lib/_stream_readable.js":30,"./lib/_stream_transform.js":31,"./lib/_stream_writable.js":32}],38:[function(require,module,exports){module.exports=require("./readable").Transform},{"./readable":37}],39:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":32}],40:[function(require,module,exports){(function(Buffer){"use strict";var inherits=require("inherits"),HashBase=require("hash-base");function RIPEMD160(){HashBase.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(x,n){return x<<n|x>>>32-n}function fn1(a,b,c,d,e,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+e|0}function fn2(a,b,c,d,e,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+e|0}function fn3(a,b,c,d,e,m,k,s){return rotl(a+((b|~c)^d)+m+k|0,s)+e|0}function fn4(a,b,c,d,e,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+e|0}function fn5(a,b,c,d,e,m,k,s){return rotl(a+(b^(c|~d))+m+k|0,s)+e|0}inherits(RIPEMD160,HashBase),RIPEMD160.prototype._update=function(){for(var m=new Array(16),i=0;i<16;++i)m[i]=this._block.readInt32LE(4*i);var al=this._a,bl=this._b,cl=this._c,dl=this._d,el=this._e;el=fn1(el,al=fn1(al,bl,cl,dl,el,m[0],0,11),bl,cl=rotl(cl,10),dl,m[1],0,14),bl=fn1(bl=rotl(bl,10),cl=fn1(cl,dl=fn1(dl,el,al,bl,cl,m[2],0,15),el,al=rotl(al,10),bl,m[3],0,12),dl,el=rotl(el,10),al,m[4],0,5),dl=fn1(dl=rotl(dl,10),el=fn1(el,al=fn1(al,bl,cl,dl,el,m[5],0,8),bl,cl=rotl(cl,10),dl,m[6],0,7),al,bl=rotl(bl,10),cl,m[7],0,9),al=fn1(al=rotl(al,10),bl=fn1(bl,cl=fn1(cl,dl,el,al,bl,m[8],0,11),dl,el=rotl(el,10),al,m[9],0,13),cl,dl=rotl(dl,10),el,m[10],0,14),cl=fn1(cl=rotl(cl,10),dl=fn1(dl,el=fn1(el,al,bl,cl,dl,m[11],0,15),al,bl=rotl(bl,10),cl,m[12],0,6),el,al=rotl(al,10),bl,m[13],0,7),el=fn2(el=rotl(el,10),al=fn1(al,bl=fn1(bl,cl,dl,el,al,m[14],0,9),cl,dl=rotl(dl,10),el,m[15],0,8),bl,cl=rotl(cl,10),dl,m[7],1518500249,7),bl=fn2(bl=rotl(bl,10),cl=fn2(cl,dl=fn2(dl,el,al,bl,cl,m[4],1518500249,6),el,al=rotl(al,10),bl,m[13],1518500249,8),dl,el=rotl(el,10),al,m[1],1518500249,13),dl=fn2(dl=rotl(dl,10),el=fn2(el,al=fn2(al,bl,cl,dl,el,m[10],1518500249,11),bl,cl=rotl(cl,10),dl,m[6],1518500249,9),al,bl=rotl(bl,10),cl,m[15],1518500249,7),al=fn2(al=rotl(al,10),bl=fn2(bl,cl=fn2(cl,dl,el,al,bl,m[3],1518500249,15),dl,el=rotl(el,10),al,m[12],1518500249,7),cl,dl=rotl(dl,10),el,m[0],1518500249,12),cl=fn2(cl=rotl(cl,10),dl=fn2(dl,el=fn2(el,al,bl,cl,dl,m[9],1518500249,15),al,bl=rotl(bl,10),cl,m[5],1518500249,9),el,al=rotl(al,10),bl,m[2],1518500249,11),el=fn2(el=rotl(el,10),al=fn2(al,bl=fn2(bl,cl,dl,el,al,m[14],1518500249,7),cl,dl=rotl(dl,10),el,m[11],1518500249,13),bl,cl=rotl(cl,10),dl,m[8],1518500249,12),bl=fn3(bl=rotl(bl,10),cl=fn3(cl,dl=fn3(dl,el,al,bl,cl,m[3],1859775393,11),el,al=rotl(al,10),bl,m[10],1859775393,13),dl,el=rotl(el,10),al,m[14],1859775393,6),dl=fn3(dl=rotl(dl,10),el=fn3(el,al=fn3(al,bl,cl,dl,el,m[4],1859775393,7),bl,cl=rotl(cl,10),dl,m[9],1859775393,14),al,bl=rotl(bl,10),cl,m[15],1859775393,9),al=fn3(al=rotl(al,10),bl=fn3(bl,cl=fn3(cl,dl,el,al,bl,m[8],1859775393,13),dl,el=rotl(el,10),al,m[1],1859775393,15),cl,dl=rotl(dl,10),el,m[2],1859775393,14),cl=fn3(cl=rotl(cl,10),dl=fn3(dl,el=fn3(el,al,bl,cl,dl,m[7],1859775393,8),al,bl=rotl(bl,10),cl,m[0],1859775393,13),el,al=rotl(al,10),bl,m[6],1859775393,6),el=fn3(el=rotl(el,10),al=fn3(al,bl=fn3(bl,cl,dl,el,al,m[13],1859775393,5),cl,dl=rotl(dl,10),el,m[11],1859775393,12),bl,cl=rotl(cl,10),dl,m[5],1859775393,7),bl=fn4(bl=rotl(bl,10),cl=fn4(cl,dl=fn3(dl,el,al,bl,cl,m[12],1859775393,5),el,al=rotl(al,10),bl,m[1],2400959708,11),dl,el=rotl(el,10),al,m[9],2400959708,12),dl=fn4(dl=rotl(dl,10),el=fn4(el,al=fn4(al,bl,cl,dl,el,m[11],2400959708,14),bl,cl=rotl(cl,10),dl,m[10],2400959708,15),al,bl=rotl(bl,10),cl,m[0],2400959708,14),al=fn4(al=rotl(al,10),bl=fn4(bl,cl=fn4(cl,dl,el,al,bl,m[8],2400959708,15),dl,el=rotl(el,10),al,m[12],2400959708,9),cl,dl=rotl(dl,10),el,m[4],2400959708,8),cl=fn4(cl=rotl(cl,10),dl=fn4(dl,el=fn4(el,al,bl,cl,dl,m[13],2400959708,9),al,bl=rotl(bl,10),cl,m[3],2400959708,14),el,al=rotl(al,10),bl,m[7],2400959708,5),el=fn4(el=rotl(el,10),al=fn4(al,bl=fn4(bl,cl,dl,el,al,m[15],2400959708,6),cl,dl=rotl(dl,10),el,m[14],2400959708,8),bl,cl=rotl(cl,10),dl,m[5],2400959708,6),bl=fn5(bl=rotl(bl,10),cl=fn4(cl,dl=fn4(dl,el,al,bl,cl,m[6],2400959708,5),el,al=rotl(al,10),bl,m[2],2400959708,12),dl,el=rotl(el,10),al,m[4],2840853838,9),dl=fn5(dl=rotl(dl,10),el=fn5(el,al=fn5(al,bl,cl,dl,el,m[0],2840853838,15),bl,cl=rotl(cl,10),dl,m[5],2840853838,5),al,bl=rotl(bl,10),cl,m[9],2840853838,11),al=fn5(al=rotl(al,10),bl=fn5(bl,cl=fn5(cl,dl,el,al,bl,m[7],2840853838,6),dl,el=rotl(el,10),al,m[12],2840853838,8),cl,dl=rotl(dl,10),el,m[2],2840853838,13),cl=fn5(cl=rotl(cl,10),dl=fn5(dl,el=fn5(el,al,bl,cl,dl,m[10],2840853838,12),al,bl=rotl(bl,10),cl,m[14],2840853838,5),el,al=rotl(al,10),bl,m[1],2840853838,12),el=fn5(el=rotl(el,10),al=fn5(al,bl=fn5(bl,cl,dl,el,al,m[3],2840853838,13),cl,dl=rotl(dl,10),el,m[8],2840853838,14),bl,cl=rotl(cl,10),dl,m[11],2840853838,11),bl=fn5(bl=rotl(bl,10),cl=fn5(cl,dl=fn5(dl,el,al,bl,cl,m[6],2840853838,8),el,al=rotl(al,10),bl,m[15],2840853838,5),dl,el=rotl(el,10),al,m[13],2840853838,6),dl=rotl(dl,10);var ar=this._a,br=this._b,cr=this._c,dr=this._d,er=this._e;er=fn5(er,ar=fn5(ar,br,cr,dr,er,m[5],1352829926,8),br,cr=rotl(cr,10),dr,m[14],1352829926,9),br=fn5(br=rotl(br,10),cr=fn5(cr,dr=fn5(dr,er,ar,br,cr,m[7],1352829926,9),er,ar=rotl(ar,10),br,m[0],1352829926,11),dr,er=rotl(er,10),ar,m[9],1352829926,13),dr=fn5(dr=rotl(dr,10),er=fn5(er,ar=fn5(ar,br,cr,dr,er,m[2],1352829926,15),br,cr=rotl(cr,10),dr,m[11],1352829926,15),ar,br=rotl(br,10),cr,m[4],1352829926,5),ar=fn5(ar=rotl(ar,10),br=fn5(br,cr=fn5(cr,dr,er,ar,br,m[13],1352829926,7),dr,er=rotl(er,10),ar,m[6],1352829926,7),cr,dr=rotl(dr,10),er,m[15],1352829926,8),cr=fn5(cr=rotl(cr,10),dr=fn5(dr,er=fn5(er,ar,br,cr,dr,m[8],1352829926,11),ar,br=rotl(br,10),cr,m[1],1352829926,14),er,ar=rotl(ar,10),br,m[10],1352829926,14),er=fn4(er=rotl(er,10),ar=fn5(ar,br=fn5(br,cr,dr,er,ar,m[3],1352829926,12),cr,dr=rotl(dr,10),er,m[12],1352829926,6),br,cr=rotl(cr,10),dr,m[6],1548603684,9),br=fn4(br=rotl(br,10),cr=fn4(cr,dr=fn4(dr,er,ar,br,cr,m[11],1548603684,13),er,ar=rotl(ar,10),br,m[3],1548603684,15),dr,er=rotl(er,10),ar,m[7],1548603684,7),dr=fn4(dr=rotl(dr,10),er=fn4(er,ar=fn4(ar,br,cr,dr,er,m[0],1548603684,12),br,cr=rotl(cr,10),dr,m[13],1548603684,8),ar,br=rotl(br,10),cr,m[5],1548603684,9),ar=fn4(ar=rotl(ar,10),br=fn4(br,cr=fn4(cr,dr,er,ar,br,m[10],1548603684,11),dr,er=rotl(er,10),ar,m[14],1548603684,7),cr,dr=rotl(dr,10),er,m[15],1548603684,7),cr=fn4(cr=rotl(cr,10),dr=fn4(dr,er=fn4(er,ar,br,cr,dr,m[8],1548603684,12),ar,br=rotl(br,10),cr,m[12],1548603684,7),er,ar=rotl(ar,10),br,m[4],1548603684,6),er=fn4(er=rotl(er,10),ar=fn4(ar,br=fn4(br,cr,dr,er,ar,m[9],1548603684,15),cr,dr=rotl(dr,10),er,m[1],1548603684,13),br,cr=rotl(cr,10),dr,m[2],1548603684,11),br=fn3(br=rotl(br,10),cr=fn3(cr,dr=fn3(dr,er,ar,br,cr,m[15],1836072691,9),er,ar=rotl(ar,10),br,m[5],1836072691,7),dr,er=rotl(er,10),ar,m[1],1836072691,15),dr=fn3(dr=rotl(dr,10),er=fn3(er,ar=fn3(ar,br,cr,dr,er,m[3],1836072691,11),br,cr=rotl(cr,10),dr,m[7],1836072691,8),ar,br=rotl(br,10),cr,m[14],1836072691,6),ar=fn3(ar=rotl(ar,10),br=fn3(br,cr=fn3(cr,dr,er,ar,br,m[6],1836072691,6),dr,er=rotl(er,10),ar,m[9],1836072691,14),cr,dr=rotl(dr,10),er,m[11],1836072691,12),cr=fn3(cr=rotl(cr,10),dr=fn3(dr,er=fn3(er,ar,br,cr,dr,m[8],1836072691,13),ar,br=rotl(br,10),cr,m[12],1836072691,5),er,ar=rotl(ar,10),br,m[2],1836072691,14),er=fn3(er=rotl(er,10),ar=fn3(ar,br=fn3(br,cr,dr,er,ar,m[10],1836072691,13),cr,dr=rotl(dr,10),er,m[0],1836072691,13),br,cr=rotl(cr,10),dr,m[4],1836072691,7),br=fn2(br=rotl(br,10),cr=fn2(cr,dr=fn3(dr,er,ar,br,cr,m[13],1836072691,5),er,ar=rotl(ar,10),br,m[8],2053994217,15),dr,er=rotl(er,10),ar,m[6],2053994217,5),dr=fn2(dr=rotl(dr,10),er=fn2(er,ar=fn2(ar,br,cr,dr,er,m[4],2053994217,8),br,cr=rotl(cr,10),dr,m[1],2053994217,11),ar,br=rotl(br,10),cr,m[3],2053994217,14),ar=fn2(ar=rotl(ar,10),br=fn2(br,cr=fn2(cr,dr,er,ar,br,m[11],2053994217,14),dr,er=rotl(er,10),ar,m[15],2053994217,6),cr,dr=rotl(dr,10),er,m[0],2053994217,14),cr=fn2(cr=rotl(cr,10),dr=fn2(dr,er=fn2(er,ar,br,cr,dr,m[5],2053994217,6),ar,br=rotl(br,10),cr,m[12],2053994217,9),er,ar=rotl(ar,10),br,m[2],2053994217,12),er=fn2(er=rotl(er,10),ar=fn2(ar,br=fn2(br,cr,dr,er,ar,m[13],2053994217,9),cr,dr=rotl(dr,10),er,m[9],2053994217,12),br,cr=rotl(cr,10),dr,m[7],2053994217,5),br=fn1(br=rotl(br,10),cr=fn2(cr,dr=fn2(dr,er,ar,br,cr,m[10],2053994217,15),er,ar=rotl(ar,10),br,m[14],2053994217,8),dr,er=rotl(er,10),ar,m[12],0,8),dr=fn1(dr=rotl(dr,10),er=fn1(er,ar=fn1(ar,br,cr,dr,er,m[15],0,5),br,cr=rotl(cr,10),dr,m[10],0,12),ar,br=rotl(br,10),cr,m[4],0,9),ar=fn1(ar=rotl(ar,10),br=fn1(br,cr=fn1(cr,dr,er,ar,br,m[1],0,12),dr,er=rotl(er,10),ar,m[5],0,5),cr,dr=rotl(dr,10),er,m[8],0,14),cr=fn1(cr=rotl(cr,10),dr=fn1(dr,er=fn1(er,ar,br,cr,dr,m[7],0,6),ar,br=rotl(br,10),cr,m[6],0,8),er,ar=rotl(ar,10),br,m[2],0,13),er=fn1(er=rotl(er,10),ar=fn1(ar,br=fn1(br,cr,dr,er,ar,m[13],0,6),cr,dr=rotl(dr,10),er,m[14],0,5),br,cr=rotl(cr,10),dr,m[0],0,15),br=fn1(br=rotl(br,10),cr=fn1(cr,dr=fn1(dr,er,ar,br,cr,m[3],0,13),er,ar=rotl(ar,10),br,m[9],0,11),dr,er=rotl(er,10),ar,m[11],0,11),dr=rotl(dr,10);var t=this._b+cl+dr|0;this._b=this._c+dl+er|0,this._c=this._d+el+ar|0,this._d=this._e+al+br|0,this._e=this._a+bl+cr|0,this._a=t},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,56<this._blockOffset&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var buffer=new Buffer(20);return buffer.writeInt32LE(this._a,0),buffer.writeInt32LE(this._b,4),buffer.writeInt32LE(this._c,8),buffer.writeInt32LE(this._d,12),buffer.writeInt32LE(this._e,16),buffer},module.exports=RIPEMD160}).call(this,require("buffer").Buffer)},{buffer:9,"hash-base":20,inherits:22}],41:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{buffer:9,dup:8}],42:[function(require,module,exports){var Buffer=require("safe-buffer").Buffer;function Hash(blockSize,finalSize){this._block=Buffer.alloc(blockSize),this._finalSize=finalSize,this._blockSize=blockSize,this._len=0}Hash.prototype.update=function(data,enc){"string"==typeof data&&(enc=enc||"utf8",data=Buffer.from(data,enc));for(var block=this._block,blockSize=this._blockSize,length=data.length,accum=this._len,offset=0;offset<length;){for(var assigned=accum%blockSize,remainder=Math.min(length-offset,blockSize-assigned),i=0;i<remainder;i++)block[assigned+i]=data[offset+i];offset+=remainder,(accum+=remainder)%blockSize==0&&this._update(block)}return this._len+=length,this},Hash.prototype.digest=function(enc){var rem=this._len%this._blockSize;this._block[rem]=128,this._block.fill(0,rem+1),rem>=this._finalSize&&(this._update(this._block),this._block.fill(0));var bits=8*this._len;if(bits<=4294967295)this._block.writeUInt32BE(bits,this._blockSize-4);else{var lowBits=4294967295&bits,highBits=(bits-lowBits)/4294967296;this._block.writeUInt32BE(highBits,this._blockSize-8),this._block.writeUInt32BE(lowBits,this._blockSize-4)}this._update(this._block);var hash=this._hash();return enc?hash.toString(enc):hash},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},module.exports=Hash},{"safe-buffer":41}],43:[function(require,module,exports){(exports=module.exports=function(algorithm){algorithm=algorithm.toLowerCase();var Algorithm=exports[algorithm];if(!Algorithm)throw new Error(algorithm+" is not supported (we accept pull requests)");return new Algorithm}).sha=require("./sha"),exports.sha1=require("./sha1"),exports.sha224=require("./sha224"),exports.sha256=require("./sha256"),exports.sha384=require("./sha384"),exports.sha512=require("./sha512")},{"./sha":44,"./sha1":45,"./sha224":46,"./sha256":47,"./sha384":48,"./sha512":49}],44:[function(require,module,exports){var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){return 0===s?b&c|~b&d:2===s?b&c|b&d|c&d:b^c^d}inherits(Sha,Hash),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(M){for(var num,W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<80;++i)W[i]=W[i-3]^W[i-8]^W[i-14]^W[i-16];for(var j=0;j<80;++j){var s=~~(j/20),t=0|((num=a)<<5|num>>>27)+ft(s,b,c,d)+e+W[j]+K[s];e=d,d=c,c=rotl30(b),b=a,a=t}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0},Sha.prototype._hash=function(){var H=Buffer.allocUnsafe(20);return H.writeInt32BE(0|this._a,0),H.writeInt32BE(0|this._b,4),H.writeInt32BE(0|this._c,8),H.writeInt32BE(0|this._d,12),H.writeInt32BE(0|this._e,16),H},module.exports=Sha},{"./hash":42,inherits:22,"safe-buffer":41}],45:[function(require,module,exports){var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha1(){this.init(),this._w=W,Hash.call(this,64,56)}function rotl5(num){return num<<5|num>>>27}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){return 0===s?b&c|~b&d:2===s?b&c|b&d|c&d:b^c^d}inherits(Sha1,Hash),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(M){for(var num,W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<80;++i)W[i]=(num=W[i-3]^W[i-8]^W[i-14]^W[i-16])<<1|num>>>31;for(var j=0;j<80;++j){var s=~~(j/20),t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d,d=c,c=rotl30(b),b=a,a=t}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0},Sha1.prototype._hash=function(){var H=Buffer.allocUnsafe(20);return H.writeInt32BE(0|this._a,0),H.writeInt32BE(0|this._b,4),H.writeInt32BE(0|this._c,8),H.writeInt32BE(0|this._d,12),H.writeInt32BE(0|this._e,16),H},module.exports=Sha1},{"./hash":42,inherits:22,"safe-buffer":41}],46:[function(require,module,exports){var inherits=require("inherits"),Sha256=require("./sha256"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(64);function Sha224(){this.init(),this._w=W,Hash.call(this,64,56)}inherits(Sha224,Sha256),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var H=Buffer.allocUnsafe(28);return H.writeInt32BE(this._a,0),H.writeInt32BE(this._b,4),H.writeInt32BE(this._c,8),H.writeInt32BE(this._d,12),H.writeInt32BE(this._e,16),H.writeInt32BE(this._f,20),H.writeInt32BE(this._g,24),H},module.exports=Sha224},{"./hash":42,"./sha256":47,inherits:22,"safe-buffer":41}],47:[function(require,module,exports){var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],W=new Array(64);function Sha256(){this.init(),this._w=W,Hash.call(this,64,56)}function ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x){return(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10)}function sigma1(x){return(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7)}function gamma0(x){return(x>>>7|x<<25)^(x>>>18|x<<14)^x>>>3}inherits(Sha256,Hash),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(M){for(var x,W=this._w,a=0|this._a,b=0|this._b,c=0|this._c,d=0|this._d,e=0|this._e,f=0|this._f,g=0|this._g,h=0|this._h,i=0;i<16;++i)W[i]=M.readInt32BE(4*i);for(;i<64;++i)W[i]=0|(((x=W[i-2])>>>17|x<<15)^(x>>>19|x<<13)^x>>>10)+W[i-7]+gamma0(W[i-15])+W[i-16];for(var j=0;j<64;++j){var T1=h+sigma1(e)+ch(e,f,g)+K[j]+W[j]|0,T2=sigma0(a)+maj(a,b,c)|0;h=g,g=f,f=e,e=d+T1|0,d=c,c=b,b=a,a=T1+T2|0}this._a=a+this._a|0,this._b=b+this._b|0,this._c=c+this._c|0,this._d=d+this._d|0,this._e=e+this._e|0,this._f=f+this._f|0,this._g=g+this._g|0,this._h=h+this._h|0},Sha256.prototype._hash=function(){var H=Buffer.allocUnsafe(32);return H.writeInt32BE(this._a,0),H.writeInt32BE(this._b,4),H.writeInt32BE(this._c,8),H.writeInt32BE(this._d,12),H.writeInt32BE(this._e,16),H.writeInt32BE(this._f,20),H.writeInt32BE(this._g,24),H.writeInt32BE(this._h,28),H},module.exports=Sha256},{"./hash":42,inherits:22,"safe-buffer":41}],48:[function(require,module,exports){var inherits=require("inherits"),SHA512=require("./sha512"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash.call(this,128,112)}inherits(Sha384,SHA512),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){var H=Buffer.allocUnsafe(48);function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset),H.writeInt32BE(l,offset+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),H},module.exports=Sha384},{"./hash":42,"./sha512":49,inherits:22,"safe-buffer":41}],49:[function(require,module,exports){var inherits=require("inherits"),Hash=require("./hash"),Buffer=require("safe-buffer").Buffer,K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],W=new Array(160);function Sha512(){this.init(),this._w=W,Hash.call(this,128,112)}function Ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x,xl){return(x>>>28|xl<<4)^(xl>>>2|x<<30)^(xl>>>7|x<<25)}function sigma1(x,xl){return(x>>>14|xl<<18)^(x>>>18|xl<<14)^(xl>>>9|x<<23)}function Gamma0(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^x>>>7}function Gamma0l(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^(x>>>7|xl<<25)}function Gamma1(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^x>>>6}function Gamma1l(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^(x>>>6|xl<<26)}function getCarry(a,b){return a>>>0<b>>>0?1:0}inherits(Sha512,Hash),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(M){for(var W=this._w,ah=0|this._ah,bh=0|this._bh,ch=0|this._ch,dh=0|this._dh,eh=0|this._eh,fh=0|this._fh,gh=0|this._gh,hh=0|this._hh,al=0|this._al,bl=0|this._bl,cl=0|this._cl,dl=0|this._dl,el=0|this._el,fl=0|this._fl,gl=0|this._gl,hl=0|this._hl,i=0;i<32;i+=2)W[i]=M.readInt32BE(4*i),W[i+1]=M.readInt32BE(4*i+4);for(;i<160;i+=2){var xh=W[i-30],xl=W[i-30+1],gamma0=Gamma0(xh,xl),gamma0l=Gamma0l(xl,xh),gamma1=Gamma1(xh=W[i-4],xl=W[i-4+1]),gamma1l=Gamma1l(xl,xh),Wi7h=W[i-14],Wi7l=W[i-14+1],Wi16h=W[i-32],Wi16l=W[i-32+1],Wil=gamma0l+Wi7l|0,Wih=gamma0+Wi7h+getCarry(Wil,gamma0l)|0;Wih=(Wih=Wih+gamma1+getCarry(Wil=Wil+gamma1l|0,gamma1l)|0)+Wi16h+getCarry(Wil=Wil+Wi16l|0,Wi16l)|0,W[i]=Wih,W[i+1]=Wil}for(var j=0;j<160;j+=2){Wih=W[j],Wil=W[j+1];var majh=maj(ah,bh,ch),majl=maj(al,bl,cl),sigma0h=sigma0(ah,al),sigma0l=sigma0(al,ah),sigma1h=sigma1(eh,el),sigma1l=sigma1(el,eh),Kih=K[j],Kil=K[j+1],chh=Ch(eh,fh,gh),chl=Ch(el,fl,gl),t1l=hl+sigma1l|0,t1h=hh+sigma1h+getCarry(t1l,hl)|0;t1h=(t1h=(t1h=t1h+chh+getCarry(t1l=t1l+chl|0,chl)|0)+Kih+getCarry(t1l=t1l+Kil|0,Kil)|0)+Wih+getCarry(t1l=t1l+Wil|0,Wil)|0;var t2l=sigma0l+majl|0,t2h=sigma0h+majh+getCarry(t2l,sigma0l)|0;hh=gh,hl=gl,gh=fh,gl=fl,fh=eh,fl=el,eh=dh+t1h+getCarry(el=dl+t1l|0,dl)|0,dh=ch,dl=cl,ch=bh,cl=bl,bh=ah,bl=al,ah=t1h+t2h+getCarry(al=t1l+t2l|0,t1l)|0}this._al=this._al+al|0,this._bl=this._bl+bl|0,this._cl=this._cl+cl|0,this._dl=this._dl+dl|0,this._el=this._el+el|0,this._fl=this._fl+fl|0,this._gl=this._gl+gl|0,this._hl=this._hl+hl|0,this._ah=this._ah+ah+getCarry(this._al,al)|0,this._bh=this._bh+bh+getCarry(this._bl,bl)|0,this._ch=this._ch+ch+getCarry(this._cl,cl)|0,this._dh=this._dh+dh+getCarry(this._dl,dl)|0,this._eh=this._eh+eh+getCarry(this._el,el)|0,this._fh=this._fh+fh+getCarry(this._fl,fl)|0,this._gh=this._gh+gh+getCarry(this._gl,gl)|0,this._hh=this._hh+hh+getCarry(this._hl,hl)|0},Sha512.prototype._hash=function(){var H=Buffer.allocUnsafe(64);function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset),H.writeInt32BE(l,offset+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),H},module.exports=Sha512},{"./hash":42,inherits:22,"safe-buffer":41}],50:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;function Stream(){EE.call(this)}require("inherits")(Stream,EE),Stream.Readable=require("readable-stream/readable.js"),Stream.Writable=require("readable-stream/writable.js"),Stream.Duplex=require("readable-stream/duplex.js"),Stream.Transform=require("readable-stream/transform.js"),Stream.PassThrough=require("readable-stream/passthrough.js"),(Stream.Stream=Stream).prototype.pipe=function(dest,options){var source=this;function ondata(chunk){dest.writable&&!1===dest.write(chunk)&&source.pause&&source.pause()}function ondrain(){source.readable&&source.resume&&source.resume()}source.on("data",ondata),dest.on("drain",ondrain),dest._isStdio||options&&!1===options.end||(source.on("end",onend),source.on("close",onclose));var didOnEnd=!1;function onend(){didOnEnd||(didOnEnd=!0,dest.end())}function onclose(){didOnEnd||(didOnEnd=!0,"function"==typeof dest.destroy&&dest.destroy())}function onerror(er){if(cleanup(),0===EE.listenerCount(this,"error"))throw er}function cleanup(){source.removeListener("data",ondata),dest.removeListener("drain",ondrain),source.removeListener("end",onend),source.removeListener("close",onclose),source.removeListener("error",onerror),dest.removeListener("error",onerror),source.removeListener("end",cleanup),source.removeListener("close",cleanup),dest.removeListener("close",cleanup)}return source.on("error",onerror),dest.on("error",onerror),source.on("end",cleanup),source.on("close",cleanup),dest.on("close",cleanup),dest.emit("pipe",source),dest}},{events:19,inherits:22,"readable-stream/duplex.js":27,"readable-stream/passthrough.js":36,"readable-stream/readable.js":37,"readable-stream/transform.js":38,"readable-stream/writable.js":39}],51:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(encoding){switch((encoding=""+encoding)&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(encoding){var nb;switch(this.encoding=function(enc){var nenc=function(enc){if(!enc)return"utf8";for(var retried;;)switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase(),retried=!0}}(enc);if("string"!=typeof nenc&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}(encoding),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,nb=4;break;case"utf8":this.fillLast=utf8FillLast,nb=4;break;case"base64":this.text=base64Text,this.end=base64End,nb=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(nb)}function utf8CheckByte(byte){return byte<=127?0:byte>>5==6?2:byte>>4==14?3:byte>>3==30?4:-1}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=function(self,buf,p){if(128!=(192&buf[0]))return self.lastNeed=0,"�".repeat(p);if(1<self.lastNeed&&1<buf.length){if(128!=(192&buf[1]))return self.lastNeed=1,"�".repeat(p+1);if(2<self.lastNeed&&2<buf.length&&128!=(192&buf[2]))return self.lastNeed=2,"�".repeat(p+2)}}(this,buf,p);return void 0!==r?r:this.lastNeed<=buf.length?(buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(buf.copy(this.lastChar,p,0,buf.length),void(this.lastNeed-=buf.length))}function utf16Text(buf,i){if((buf.length-i)%2==0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(55296<=c&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;return 0===n?buf.toString("base64",i):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=buf[buf.length-1]:(this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1]),buf.toString("base64",i,buf.length-n))}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}(exports.StringDecoder=StringDecoder).prototype.write=function(buf){if(0===buf.length)return"";var r,i;if(this.lastNeed){if(void 0===(r=this.fillLast(buf)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<buf.length?r?r+this.text(buf,i):this.text(buf,i):r||""},StringDecoder.prototype.end=function(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+"�".repeat(this.lastTotal-this.lastNeed):r},StringDecoder.prototype.text=function(buf,i){var total=function(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(0<=nb)return 0<nb&&(self.lastNeed=nb-1),nb;if(--j<i)return 0;if(0<=(nb=utf8CheckByte(buf[j])))return 0<nb&&(self.lastNeed=nb-2),nb;if(--j<i)return 0;if(0<=(nb=utf8CheckByte(buf[j])))return 0<nb&&(2===nb?nb=0:self.lastNeed=nb-3),nb;return 0}(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,end),buf.toString("utf8",i,end)},StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length),this.lastNeed-=buf.length}},{"safe-buffer":41}],52:[function(require,module,exports){(function(global){function config(name){try{if(!global.localStorage)return!1}catch(_){return!1}var val=global.localStorage[name];return null!=val&&"true"===String(val).toLowerCase()}module.exports=function(fn,msg){if(config("noDeprecation"))return fn;var warned=!1;return function(){if(!warned){if(config("throwDeprecation"))throw new Error(msg);config("traceDeprecation")?console.trace(msg):console.warn(msg),warned=!0}return fn.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],53:[function(require,module,exports){(function(Buffer){var bs58check=require("bs58check"),cashaddr=require("cashaddrjs"),Format={Legacy:"legacy",Bitpay:"bitpay",Cashaddr:"cashaddr"},Network={Mainnet:"mainnet",Testnet:"testnet"},Type={};function detectAddressFormat(address){return decodeAddress(address).format}function detectAddressNetwork(address){return decodeAddress(address).network}function detectAddressType(address){return decodeAddress(address).type}Type.P2PKH="p2pkh",Type.P2SH="p2sh";var VERSION_BYTE={};function decodeAddress(address){try{return function(address){try{var payload=bs58check.decode(address);if(payload.length!==BASE_58_CHECK_PAYLOAD_LENGTH)throw new InvalidAddressError;var versionByte=payload[0],hash=Array.prototype.slice.call(payload,1);switch(versionByte){case VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2PKH]:return{hash:hash,format:Format.Legacy,network:Network.Mainnet,type:Type.P2PKH};case VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2SH]:return{hash:hash,format:Format.Legacy,network:Network.Mainnet,type:Type.P2SH};case VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2PKH]:return{hash:hash,format:Format.Legacy,network:Network.Testnet,type:Type.P2PKH};case VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2SH]:return{hash:hash,format:Format.Legacy,network:Network.Testnet,type:Type.P2SH};case VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2PKH]:return{hash:hash,format:Format.Bitpay,network:Network.Mainnet,type:Type.P2PKH};case VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2SH]:return{hash:hash,format:Format.Bitpay,network:Network.Mainnet,type:Type.P2SH}}}catch(error){}throw new InvalidAddressError}(address)}catch(error){}try{return function(address){if(-1!==address.indexOf(":"))try{return decodeCashAddressWithPrefix(address)}catch(error){}else for(var prefixes=["bitcoincash","bchtest","bchreg"],i=0;i<prefixes.length;++i)try{var prefix=prefixes[i];return decodeCashAddressWithPrefix(prefix+":"+address)}catch(error){}throw new InvalidAddressError}(address)}catch(error){}throw new InvalidAddressError}VERSION_BYTE[Format.Legacy]={},VERSION_BYTE[Format.Legacy][Network.Mainnet]={},VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2PKH]=0,VERSION_BYTE[Format.Legacy][Network.Mainnet][Type.P2SH]=5,VERSION_BYTE[Format.Legacy][Network.Testnet]={},VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2PKH]=111,VERSION_BYTE[Format.Legacy][Network.Testnet][Type.P2SH]=196,VERSION_BYTE[Format.Bitpay]={},VERSION_BYTE[Format.Bitpay][Network.Mainnet]={},VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2PKH]=28,VERSION_BYTE[Format.Bitpay][Network.Mainnet][Type.P2SH]=40,VERSION_BYTE[Format.Bitpay][Network.Testnet]={},VERSION_BYTE[Format.Bitpay][Network.Testnet][Type.P2PKH]=111,VERSION_BYTE[Format.Bitpay][Network.Testnet][Type.P2SH]=196;var BASE_58_CHECK_PAYLOAD_LENGTH=21;function decodeCashAddressWithPrefix(address){try{var decoded=cashaddr.decode(address),hash=Array.prototype.slice.call(decoded.hash,0),type="P2PKH"===decoded.type?Type.P2PKH:Type.P2SH;switch(decoded.prefix){case"bitcoincash":return{hash:hash,format:Format.Cashaddr,network:Network.Mainnet,type:type};case"bchtest":case"bchreg":return{hash:hash,format:Format.Cashaddr,network:Network.Testnet,type:type}}}catch(error){}throw new InvalidAddressError}function InvalidAddressError(){var error=new Error;this.name=error.name="InvalidAddressError",this.message=error.message="Received an invalid Bitcoin Cash address as input.",this.stack=error.stack}InvalidAddressError.prototype=Object.create(Error.prototype),module.exports={Format:Format,Network:Network,Type:Type,detectAddressFormat:detectAddressFormat,detectAddressNetwork:detectAddressNetwork,detectAddressType:detectAddressType,toLegacyAddress:function(address){var decoded=decodeAddress(address);return decoded.format===Format.Legacy?address:function(decoded){var versionByte=VERSION_BYTE[Format.Legacy][decoded.network][decoded.type],buffer=Buffer.alloc(1+decoded.hash.length);return buffer[0]=versionByte,buffer.set(decoded.hash,1),bs58check.encode(buffer)}(decoded)},toBitpayAddress:function(address){var decoded=decodeAddress(address);return decoded.format===Format.Bitpay?address:function(decoded){var versionByte=VERSION_BYTE[Format.Bitpay][decoded.network][decoded.type],buffer=Buffer.alloc(1+decoded.hash.length);return buffer[0]=versionByte,buffer.set(decoded.hash,1),bs58check.encode(buffer)}(decoded)},toCashAddress:function(address){return function(decoded){var prefix=decoded.network===Network.Mainnet?"bitcoincash":"bchtest",type=decoded.type===Type.P2PKH?"P2PKH":"P2SH",hash=new Uint8Array(decoded.hash);return cashaddr.encode(prefix,type,hash)}(decodeAddress(address))},isLegacyAddress:function(address){return detectAddressFormat(address)===Format.Legacy},isBitpayAddress:function(address){return detectAddressFormat(address)===Format.Bitpay},isCashAddress:function(address){return detectAddressFormat(address)===Format.Cashaddr},isMainnetAddress:function(address){return detectAddressNetwork(address)===Network.Mainnet},isTestnetAddress:function(address){return detectAddressNetwork(address)===Network.Testnet},isP2PKHAddress:function(address){return detectAddressType(address)===Type.P2PKH},isP2SHAddress:function(address){return detectAddressType(address)===Type.P2SH},InvalidAddressError:InvalidAddressError}}).call(this,require("buffer").Buffer)},{bs58check:7,buffer:9,cashaddrjs:11}]},{},[53])(53)});