Code Duplication    Length = 1-1 lines in 2 locations

build/blocktrail-sdk.min.js 2 locations

@@ 8-8 (lines=1) @@
5
codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message},this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message},this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message},this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message},this.message=a}}};"undefined"!=typeof b&&b.exports&&(b.exports=m),"function"==typeof define&&define([],function(){return m}),m.cipher.aes=function(a){this.o[0][0][0]||this.t();var b,c,e,f,g=this.o[0][4],h=this.o[1];b=a.length;var i=1;for(4!==b&&6!==b&&8!==b&&d(new m.exception.invalid("invalid aes key size")),this.b=[e=a.slice(0),f=[]],a=b;a<4*b+28;a++)c=e[a-1],(0===a%b||8===b&&4===a%b)&&(c=g[c>>>24]<<24^g[c>>16&255]<<16^g[c>>8&255]<<8^g[255&c],0===a%b&&(c=c<<8^c>>>24^i<<24,i=i<<1^283*(i>>7))),e[a]=e[a-b]^c;for(b=0;a;b++,a--)c=e[3&b?a:a-4],f[b]=4>=a||4>b?c:h[0][g[c>>>24]]^h[1][g[c>>16&255]]^h[2][g[c>>8&255]]^h[3][g[255&c]]},m.cipher.aes.prototype={encrypt:function(a){return e(this,a,0)},decrypt:function(a){return e(this,a,1)},o:[[[],[],[],[],[]],[[],[],[],[],[]]],t:function(){var a,b,c,d,e,f,g,h=this.o[0],i=this.o[1],j=h[4],k=i[4],l=[],m=[];for(a=0;256>a;a++)m[(l[a]=a<<1^283*(a>>7))^a]=a;for(b=c=0;!j[b];b^=d||1,c=m[c]||1)for(f=c^c<<1^c<<2^c<<3^c<<4,f=f>>8^255&f^99,j[b]=f,k[f]=b,e=l[a=l[d=l[b]]],g=16843009*e^65537*a^257*d^16843008*b,e=257*l[f]^16843008*f,a=0;4>a;a++)h[a][b]=e=e<<24^e>>>8,i[a][f]=g=g<<24^g>>>8;for(a=0;5>a;a++)h[a]=h[a].slice(0),i[a]=i[a].slice(0)}},m.bitArray={bitSlice:function(a,b,c){return a=m.bitArray.R(a.slice(b/32),32-(31&b)).slice(1),c===k?a:m.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=m.bitArray.getPartial(c);return 32===d?a.concat(b):m.bitArray.R(b,d,0|c,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===b?0:32*(b-1)+m.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;return b&=31,0<c&&b&&(a[c-1]=m.bitArray.partial(b,a[c-1]&2147483648>>b-1,1)),a},partial:function(a,b,c){return 32===a?b:(c?0|b:b<<32-a)+1099511627776*a},getPartial:function(a){return Math.round(a/1099511627776)||32},equal:function(a,b){if(m.bitArray.bitLength(a)!==m.bitArray.bitLength(b))return l;var c,d=0;for(c=0;c<a.length;c++)d|=a[c]^b[c];return 0===d},R:function(a,b,c,d){var e;for(e=0,d===k&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;return e=a.length?a[a.length-1]:0,a=m.bitArray.getPartial(e),d.push(m.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1)),d},j:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&65280|(65280&c)<<8|c<<24;return a}},m.codec.utf8String={fromBits:function(a){var b,c,d="",e=m.bitArray.bitLength(a);for(b=0;b<e/8;b++)0===(3&b)&&(c=a[b/4]),d+=String.fromCharCode(c>>>24),c<<=8;return decodeURIComponent(escape(d))},toBits:function(a){a=unescape(encodeURIComponent(a));var b,c=[],d=0;for(b=0;b<a.length;b++)d=d<<8|a.charCodeAt(b),3===(3&b)&&(c.push(d),d=0);return 3&b&&c.push(m.bitArray.partial(8*(3&b),d)),c}},m.codec.hex={fromBits:function(a){var b,c="";for(b=0;b<a.length;b++)c+=((0|a[b])+0xf00000000000).toString(16).substr(4);return c.substr(0,m.bitArray.bitLength(a)/4)},toBits:function(a){var b,c,d=[];for(a=a.replace(/\s|0x/g,""),c=a.length,a+="00000000",b=0;b<a.length;b+=8)d.push(0^parseInt(a.substr(b,8),16));return m.bitArray.clamp(d,4*c)}},m.codec.base64={M:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=m.codec.base64.M,g=0,h=m.bitArray.bitLength(a);for(c&&(f=f.substr(0,62)+"-_"),c=0;6*d.length<h;)d+=f.charAt((g^a[c]>>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;3&d.length&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c,e,f=[],g=0,h=m.codec.base64.M,i=0;for(b&&(h=h.substr(0,62)+"-_"),c=0;c<a.length;c++)e=h.indexOf(a.charAt(c)),0>e&&d(new m.exception.invalid("this isn't base64!")),26<g?(g-=26,f.push(i^e>>>g),i=e<<32-g):(g+=6,i^=e<<32-g);return 56&g&&f.push(m.bitArray.partial(56&g,i,1)),f}},m.codec.base64url={fromBits:function(a){return m.codec.base64.fromBits(a,1,1)},toBits:function(a){return m.codec.base64.toBits(a,1)}},m.hash.sha256=function(a){this.b[0]||this.t(),a?(this.e=a.e.slice(0),this.d=a.d.slice(0),this.c=a.c):this.reset()},m.hash.sha256.hash=function(a){return(new m.hash.sha256).update(a).finalize()},m.hash.sha256.prototype={blockSize:512,reset:function(){return this.e=this.l.slice(0),this.d=[],this.c=0,this},update:function(a){"string"==typeof a&&(a=m.codec.utf8String.toBits(a));var b,c=this.d=m.bitArray.concat(this.d,a);for(b=this.c,a=this.c=b+m.bitArray.bitLength(a),b=512+b&-512;b<=a;b+=512)this.r(c.splice(0,16));return this},finalize:function(){var a,b=this.d,c=this.e,b=m.bitArray.concat(b,[m.bitArray.partial(1,1)]);for(a=b.length+2;15&a;a++)b.push(0);for(b.push(Math.floor(this.c/4294967296)),b.push(0|this.c);b.length;)this.r(b.splice(0,16));return this.reset(),c},l:[],b:[],t:function(){function a(a){return 4294967296*(a-Math.floor(a))|0}var b,c=0,d=2;a:for(;64>c;d++){for(b=2;b*b<=d;b++)if(0===d%b)continue a;8>c&&(this.l[c]=a(Math.pow(d,.5))),this.b[c]=a(Math.pow(d,1/3)),c++}},r:function(a){var b,c,d=a.slice(0),e=this.e,f=this.b,g=e[0],h=e[1],i=e[2],j=e[3],k=e[4],l=e[5],m=e[6],n=e[7];for(a=0;64>a;a++)16>a?b=d[a]:(b=d[a+1&15],c=d[a+14&15],b=d[15&a]=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(c>>>17^c>>>19^c>>>10^c<<15^c<<13)+d[15&a]+d[a+9&15]|0),b=b+n+(k>>>6^k>>>11^k>>>25^k<<26^k<<21^k<<7)+(m^k&(l^m))+f[a],n=m,m=l,l=k,k=j+b|0,j=i,i=h,h=g,g=b+(h&i^j&(h^i))+(h>>>2^h>>>13^h>>>22^h<<30^h<<19^h<<10)|0;e[0]=e[0]+g|0,e[1]=e[1]+h|0,e[2]=e[2]+i|0,e[3]=e[3]+j|0,e[4]=e[4]+k|0,e[5]=e[5]+l|0,e[6]=e[6]+m|0,e[7]=e[7]+n|0}},m.hash.sha512=function(a){this.b[0]||this.t(),a?(this.e=a.e.slice(0),this.d=a.d.slice(0),this.c=a.c):this.reset()},m.hash.sha512.hash=function(a){return(new m.hash.sha512).update(a).finalize()},m.hash.sha512.prototype={blockSize:1024,reset:function(){return this.e=this.l.slice(0),this.d=[],this.c=0,this},update:function(a){"string"==typeof a&&(a=m.codec.utf8String.toBits(a));var b,c=this.d=m.bitArray.concat(this.d,a);for(b=this.c,a=this.c=b+m.bitArray.bitLength(a),b=1024+b&-1024;b<=a;b+=1024)this.r(c.splice(0,32));return this},finalize:function(){var a,b=this.d,c=this.e,b=m.bitArray.concat(b,[m.bitArray.partial(1,1)]);for(a=b.length+4;31&a;a++)b.push(0);for(b.push(0),b.push(0),b.push(Math.floor(this.c/4294967296)),b.push(0|this.c);b.length;)this.r(b.splice(0,32));return this.reset(),c},l:[],ca:[12372232,13281083,9762859,1914609,15106769,4090911,4308331,8266105],b:[],ea:[2666018,15689165,5061423,9034684,4764984,380953,1658779,7176472,197186,7368638,14987916,16757986,8096111,1480369,13046325,6891156,15813330,5187043,9229749,11312229,2818677,10937475,4324308,1135541,6741931,11809296,16458047,15666916,11046850,698149,229999,945776,13774844,2541862,12856045,9810911,11494366,7844520,15576806,8533307,15795044,4337665,16291729,5553712,15684120,6662416,7413802,12308920,13816008,4303699,9366425,10176680,13195875,4295371,6546291,11712675,15708924,1519456,15772530,6568428,6495784,8568297,13007125,7492395,2515356,12632583,14740254,7262584,1535930,13146278,16321966,1853211,294276,13051027,13221564,1051980,4080310,6651434,14088940,4675607],t:function(){function a(a){return 4294967296*(a-Math.floor(a))|0}function b(a){return 1099511627776*(a-Math.floor(a))&255}var c,d=0,e=2;a:for(;80>d;e++){for(c=2;c*c<=e;c++)if(0===e%c)continue a;8>d&&(this.l[2*d]=a(Math.pow(e,.5)),this.l[2*d+1]=b(Math.pow(e,.5))<<24|this.ca[d]),this.b[2*d]=a(Math.pow(e,1/3)),this.b[2*d+1]=b(Math.pow(e,1/3))<<24|this.ea[d],d++}},r:function(a){var b,c,d=a.slice(0),e=this.e,f=this.b,g=e[0],h=e[1],i=e[2],j=e[3],k=e[4],l=e[5],m=e[6],n=e[7],o=e[8],p=e[9],q=e[10],r=e[11],s=e[12],t=e[13],u=e[14],v=e[15],w=g,x=h,y=i,z=j,A=k,B=l,C=m,D=n,E=o,F=p,G=q,H=r,I=s,J=t,K=u,L=v;for(a=0;80>a;a++){if(16>a)b=d[2*a],c=d[2*a+1];else{c=d[2*(a-15)];var M=d[2*(a-15)+1];b=(M<<31|c>>>1)^(M<<24|c>>>8)^c>>>7;var N=(c<<31|M>>>1)^(c<<24|M>>>8)^(c<<25|M>>>7);c=d[2*(a-2)];var O=d[2*(a-2)+1],M=(O<<13|c>>>19)^(c<<3|O>>>29)^c>>>6,O=(c<<13|O>>>19)^(O<<3|c>>>29)^(c<<26|O>>>6),P=d[2*(a-7)],Q=d[2*(a-16)],R=d[2*(a-16)+1];c=N+d[2*(a-7)+1],b=b+P+(c>>>0<N>>>0?1:0),c+=O,b+=M+(c>>>0<O>>>0?1:0),c+=R,b+=Q+(c>>>0<R>>>0?1:0)}d[2*a]=b|=0,d[2*a+1]=c|=0;var P=E&G^~E&I,S=F&H^~F&J,O=w&y^w&A^y&A,T=x&z^x&B^z&B,Q=(x<<4|w>>>28)^(w<<30|x>>>2)^(w<<25|x>>>7),R=(w<<4|x>>>28)^(x<<30|w>>>2)^(x<<25|w>>>7),U=f[2*a],V=f[2*a+1],M=L+((E<<18|F>>>14)^(E<<14|F>>>18)^(F<<23|E>>>9)),N=K+((F<<18|E>>>14)^(F<<14|E>>>18)^(E<<23|F>>>9))+(M>>>0<L>>>0?1:0),M=M+S,N=N+(P+(M>>>0<S>>>0?1:0)),M=M+V,N=N+(U+(M>>>0<V>>>0?1:0)),M=M+c|0,N=N+(b+(M>>>0<c>>>0?1:0));c=R+T,b=Q+O+(c>>>0<R>>>0?1:0),K=I,L=J,I=G,J=H,G=E,H=F,F=D+M|0,E=C+N+(F>>>0<D>>>0?1:0)|0,C=A,D=B,A=y,B=z,y=w,z=x,x=M+c|0,w=N+b+(x>>>0<M>>>0?1:0)|0}h=e[1]=h+x|0,e[0]=g+w+(h>>>0<x>>>0?1:0)|0,j=e[3]=j+z|0,e[2]=i+y+(j>>>0<z>>>0?1:0)|0,l=e[5]=l+B|0,e[4]=k+A+(l>>>0<B>>>0?1:0)|0,n=e[7]=n+D|0,e[6]=m+C+(n>>>0<D>>>0?1:0)|0,p=e[9]=p+F|0,e[8]=o+E+(p>>>0<F>>>0?1:0)|0,r=e[11]=r+H|0,e[10]=q+G+(r>>>0<H>>>0?1:0)|0,t=e[13]=t+J|0,e[12]=s+I+(t>>>0<J>>>0?1:0)|0,v=e[15]=v+L|0,e[14]=u+K+(v>>>0<L>>>0?1:0)|0}},m.mode.ccm={name:"ccm",w:[],listenProgress:function(a){m.mode.ccm.w.push(a)},unListenProgress:function(a){a=m.mode.ccm.w.indexOf(a),-1<a&&m.mode.ccm.w.splice(a,1)},X:function(a){var b,c=m.mode.ccm.w.slice();for(b=0;b<c.length;b+=1)c[b](a)},encrypt:function(a,b,c,e,f){var g,h=b.slice(0),i=m.bitArray,j=i.bitLength(c)/8,k=i.bitLength(h)/8;for(f=f||64,e=e||[],7>j&&d(new m.exception.invalid("ccm: iv must be at least 7 bytes")),g=2;4>g&&k>>>8*g;g++);return g<15-j&&(g=15-j),c=i.clamp(c,8*(15-g)),b=m.mode.ccm.O(a,b,c,e,f,g),h=m.mode.ccm.s(a,h,c,b,f,g),i.concat(h.data,h.tag)},decrypt:function(a,b,c,e,f){f=f||64,e=e||[];var g=m.bitArray,h=g.bitLength(c)/8,i=g.bitLength(b),j=g.clamp(b,i-f),k=g.bitSlice(b,i-f),i=(i-f)/8;for(7>h&&d(new m.exception.invalid("ccm: iv must be at least 7 bytes")),b=2;4>b&&i>>>8*b;b++);return b<15-h&&(b=15-h),c=g.clamp(c,8*(15-b)),j=m.mode.ccm.s(a,j,c,k,f,b),a=m.mode.ccm.O(a,j.data,c,e,f,b),g.equal(j.tag,a)||d(new m.exception.corrupt("ccm: tag doesn't match")),j.data},ga:function(a,b,c,d,e,f){var g=[],h=m.bitArray,i=h.j;if(d=[h.partial(8,(b.length?64:0)|d-2<<2|f-1)],d=h.concat(d,c),d[3]|=e,d=a.encrypt(d),b.length)for(c=h.bitLength(b)/8,65279>=c?g=[h.partial(16,c)]:4294967295>=c&&(g=h.concat([h.partial(16,65534)],[c])),g=h.concat(g,b),b=0;b<g.length;b+=4)d=a.encrypt(i(d,g.slice(b,b+4).concat([0,0,0])));return d},O:function(a,b,c,e,f,g){var h=m.bitArray,i=h.j;for(f/=8,(f%2||4>f||16<f)&&d(new m.exception.invalid("ccm: invalid tag length")),(4294967295<e.length||4294967295<b.length)&&d(new m.exception.bug("ccm: can't deal with 4GiB or more data")),c=m.mode.ccm.ga(a,e,c,f,h.bitLength(b)/8,g),e=0;e<b.length;e+=4)c=a.encrypt(i(c,b.slice(e,e+4).concat([0,0,0])));return h.clamp(c,8*f)},s:function(a,b,c,d,e,f){var g,h=m.bitArray;g=h.j;var i=b.length,j=h.bitLength(b),k=i/50,l=k;if(c=h.concat([h.partial(8,f-1)],c).concat([0,0,0]).slice(0,4),d=h.bitSlice(g(d,a.encrypt(c)),0,e),!i)return{tag:d,data:[]};for(g=0;g<i;g+=4)g>k&&(m.mode.ccm.X(g/i),k+=l),c[3]++,e=a.encrypt(c),b[g]^=e[0],b[g+1]^=e[1],b[g+2]^=e[2],b[g+3]^=e[3];return{tag:d,data:h.clamp(b,j)}}},m.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,e,f,g){128!==m.bitArray.bitLength(c)&&d(new m.exception.invalid("ocb iv must be 128 bits"));var h,i=m.mode.ocb2.K,j=m.bitArray,k=j.j,l=[0,0,0,0];c=i(a.encrypt(c));var n,o=[];for(e=e||[],f=f||64,h=0;h+4<b.length;h+=4)n=b.slice(h,h+4),l=k(l,n),o=o.concat(k(c,a.encrypt(k(c,n)))),c=i(c);return n=b.slice(h),b=j.bitLength(n),h=a.encrypt(k(c,[0,0,0,b])),n=j.clamp(k(n.concat([0,0,0]),h),b),l=k(l,k(n.concat([0,0,0]),h)),l=a.encrypt(k(l,k(c,i(c)))),e.length&&(l=k(l,g?e:m.mode.ocb2.pmac(a,e))),o.concat(j.concat(n,j.clamp(l,f)))},decrypt:function(a,b,c,e,f,g){128!==m.bitArray.bitLength(c)&&d(new m.exception.invalid("ocb iv must be 128 bits")),f=f||64;var h,i,j=m.mode.ocb2.K,k=m.bitArray,l=k.j,n=[0,0,0,0],o=j(a.encrypt(c)),p=m.bitArray.bitLength(b)-f,q=[];for(e=e||[],c=0;c+4<p/32;c+=4)h=l(o,a.decrypt(l(o,b.slice(c,c+4)))),n=l(n,h),q=q.concat(h),o=j(o);return i=p-32*c,h=a.encrypt(l(o,[0,0,0,i])),h=l(h,k.clamp(b.slice(c),i).concat([0,0,0])),n=l(n,h),n=a.encrypt(l(n,l(o,j(o)))),e.length&&(n=l(n,g?e:m.mode.ocb2.pmac(a,e))),k.equal(k.clamp(n,f),k.bitSlice(b,p))||d(new m.exception.corrupt("ocb: tag doesn't match")),q.concat(k.clamp(h,i))},pmac:function(a,b){var c,d=m.mode.ocb2.K,e=m.bitArray,f=e.j,g=[0,0,0,0],h=a.encrypt([0,0,0,0]),h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4)h=d(h),g=f(g,a.encrypt(f(h,b.slice(c,c+4))));return c=b.slice(c),128>e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0])),g=f(g,c),a.encrypt(f(d(f(h,d(h))),g))},K:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}},m.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);return b=m.bitArray,d=d||[],a=m.mode.gcm.s(!0,a,f,d,c,e||128),b.concat(a.data,a.tag)},decrypt:function(a,b,c,e,f){var g=b.slice(0),h=m.bitArray,i=h.bitLength(g);return f=f||128,e=e||[],f<=i?(b=h.bitSlice(g,i-f),g=h.bitSlice(g,0,i-f)):(b=g,g=[]),a=m.mode.gcm.s(l,a,g,e,c,f),h.equal(a.tag,b)||d(new m.exception.corrupt("gcm: tag doesn't match")),a.data},ba:function(a,b){var c,d,e,f,g,h=m.bitArray.j;for(e=[0,0,0,0],f=b.slice(0),c=0;128>c;c++){for((d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f)),g=0!==(1&f[3]),d=3;0<d;d--)f[d]=f[d]>>>1|(1&f[d-1])<<31;f[0]>>>=1,g&&(f[0]^=-520093696)}return e},k:function(a,b,c){var d,e=c.length;for(b=b.slice(0),d=0;d<e;d+=4)b[0]^=4294967295&c[d],b[1]^=4294967295&c[d+1],b[2]^=4294967295&c[d+2],b[3]^=4294967295&c[d+3],b=m.mode.gcm.ba(b,a);return b},s:function(a,b,c,d,e,f){var g,h,i,j,k,l,n,o,p=m.bitArray;for(l=c.length,n=p.bitLength(c),o=p.bitLength(d),h=p.bitLength(e),g=b.encrypt([0,0,0,0]),96===h?(e=e.slice(0),e=p.concat(e,[1])):(e=m.mode.gcm.k(g,[0,0,0,0],e),e=m.mode.gcm.k(g,e,[0,0,Math.floor(h/4294967296),4294967295&h])),h=m.mode.gcm.k(g,[0,0,0,0],d),k=e.slice(0),d=h.slice(0),a||(d=m.mode.gcm.k(g,h,c)),j=0;j<l;j+=4)k[3]++,i=b.encrypt(k),c[j]^=i[0],c[j+1]^=i[1],c[j+2]^=i[2],c[j+3]^=i[3];return c=p.clamp(c,n),a&&(d=m.mode.gcm.k(g,h,c)),a=[Math.floor(o/4294967296),4294967295&o,Math.floor(n/4294967296),4294967295&n],d=m.mode.gcm.k(g,d,a),i=b.encrypt(e),d[0]^=i[0],d[1]^=i[1],d[2]^=i[2],d[3]^=i[3],{tag:p.bitSlice(d,0,f),data:c}}},m.misc.hmac=function(a,b){this.P=b=b||m.hash.sha256;var c,d=[[],[]],e=b.prototype.blockSize/32;for(this.q=[new b,new b],a.length>e&&(a=b.hash(a)),c=0;c<e;c++)d[0][c]=909522486^a[c],d[1][c]=1549556828^a[c];this.q[0].update(d[0]),this.q[1].update(d[1]),this.J=new b(this.q[0])},m.misc.hmac.prototype.encrypt=m.misc.hmac.prototype.mac=function(a){return this.S&&d(new m.exception.invalid("encrypt on already updated hmac called!")),this.update(a),this.digest(a)},m.misc.hmac.prototype.reset=function(){this.J=new this.P(this.q[0]),this.S=l},m.misc.hmac.prototype.update=function(a){this.S=!0,this.J.update(a)},m.misc.hmac.prototype.digest=function(){var a=this.J.finalize(),a=new this.P(this.q[1]).update(a).finalize();return this.reset(),a},m.misc.pbkdf2=function(a,b,c,e,f){c=c||1e3,(0>e||0>c)&&d(m.exception.invalid("invalid params to pbkdf2")),"string"==typeof a&&(a=m.codec.utf8String.toBits(a)),"string"==typeof b&&(b=m.codec.utf8String.toBits(b)),f=f||m.misc.hmac,a=new f(a);var g,h,i,j,k=[],l=m.bitArray;for(j=1;32*k.length<(e||1);j++){for(f=g=a.encrypt(l.concat(b,[j])),h=1;h<c;h++)for(g=a.encrypt(g),i=0;i<g.length;i++)f[i]^=g[i];k=k.concat(f)}return e&&(k=l.clamp(k,e)),k},m.prng=function(a){this.f=[new m.hash.sha256],this.m=[0],this.I=0,this.A={},this.H=0,this.N={},this.Q=this.g=this.n=this.Z=0,this.b=[0,0,0,0,0,0,0,0],this.i=[0,0,0,0],this.F=k,this.G=a,this.u=l,this.D={progress:{},seeded:{}},this.p=this.Y=0,this.B=1,this.C=2,this.U=65536,this.L=[0,48,64,96,128,192,256,384,512,768,1024],this.V=3e4,this.T=80},m.prng.prototype={randomWords:function(a,b){var c,e=[];c=this.isReady(b);var f;if(c===this.p&&d(new m.exception.notReady("generator isn't seeded")),c&this.C){c=!(c&this.B),f=[];var g,j=0;for(this.Q=f[0]=(new Date).valueOf()+this.V,g=0;16>g;g++)f.push(4294967296*Math.random()|0);for(g=0;g<this.f.length&&(f=f.concat(this.f[g].finalize()),j+=this.m[g],this.m[g]=0,!(!c&&this.I&1<<g));g++);for(this.I>=1<<this.f.length&&(this.f.push(new m.hash.sha256),this.m.push(0)),this.g-=j,j>this.n&&(this.n=j),this.I++,this.b=m.hash.sha256.hash(this.b.concat(f)),this.F=new m.cipher.aes(this.b),c=0;4>c&&(this.i[c]=this.i[c]+1|0,!this.i[c]);c++);}for(c=0;c<a;c+=4)0===(c+1)%this.U&&h(this),f=i(this),e.push(f[0],f[1],f[2],f[3]);return h(this),e.slice(0,a)},setDefaultParanoia:function(a,b){0===a&&"Setting paranoia=0 will ruin your security; use it only for testing"!==b&&d("Setting paranoia=0 will ruin your security; use it only for testing"),this.G=a},addEntropy:function(a,b,c){c=c||"user";var e,g,h=(new Date).valueOf(),i=this.A[c],j=this.isReady(),l=0;switch(e=this.N[c],e===k&&(e=this.N[c]=this.Z++),i===k&&(i=this.A[c]=0),this.A[c]=(this.A[c]+1)%this.f.length,typeof a){case"number":b===k&&(b=1),this.f[i].update([e,this.H++,1,b,h,1,0|a]);break;case"object":if(c=Object.prototype.toString.call(a),"[object Uint32Array]"===c){for(g=[],c=0;c<a.length;c++)g.push(a[c]);a=g}else for("[object Array]"!==c&&(l=1),c=0;c<a.length&&!l;c++)"number"!=typeof a[c]&&(l=1);if(!l){if(b===k)for(c=b=0;c<a.length;c++)for(g=a[c];0<g;)b++,g>>>=1;this.f[i].update([e,this.H++,2,b,h,a.length].concat(a))}break;case"string":b===k&&(b=a.length),this.f[i].update([e,this.H++,3,b,h,a.length]),this.f[i].update(a);break;default:l=1}l&&d(new m.exception.bug("random: addEntropy only supports number, array of numbers or string")),this.m[i]+=b,this.g+=b,j===this.p&&(this.isReady()!==this.p&&f("seeded",Math.max(this.n,this.g)),f("progress",this.getProgress()))},isReady:function(a){return a=this.L[a!==k?a:this.G],this.n&&this.n>=a?this.m[0]>this.T&&(new Date).valueOf()>this.Q?this.C|this.B:this.B:this.g>=a?this.C|this.p:this.p},getProgress:function(a){return a=this.L[a?a:this.G],this.n>=a?1:this.g>a?1:this.g/a},startCollectors:function(){this.u||(this.a={loadTimeCollector:j(this,this.fa),mouseCollector:j(this,this.ha),keyboardCollector:j(this,this.da),accelerometerCollector:j(this,this.W),touchCollector:j(this,this.ja)},window.addEventListener?(window.addEventListener("load",this.a.loadTimeCollector,l),window.addEventListener("mousemove",this.a.mouseCollector,l),window.addEventListener("keypress",this.a.keyboardCollector,l),window.addEventListener("devicemotion",this.a.accelerometerCollector,l),window.addEventListener("touchmove",this.a.touchCollector,l)):document.attachEvent?(document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector)):d(new m.exception.bug("can't attach event")),this.u=!0)},stopCollectors:function(){this.u&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,l),window.removeEventListener("mousemove",this.a.mouseCollector,l),window.removeEventListener("keypress",this.a.keyboardCollector,l),window.removeEventListener("devicemotion",this.a.accelerometerCollector,l),window.removeEventListener("touchmove",this.a.touchCollector,l)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.u=l)},addEventListener:function(a,b){this.D[a][this.Y++]=b},removeEventListener:function(a,b){var c,d,e=this.D[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},da:function(){g(1)},ha:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(a){c=b=0}0!=b&&0!=c&&m.random.addEntropy([b,c],2,"mouse"),g(0)},ja:function(a){a=a.touches[0]||a.changedTouches[0],m.random.addEntropy([a.pageX||a.clientX,a.pageY||a.clientY],1,"touch"),g(0)},fa:function(){g(2)},W:function(a){if(a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z,window.orientation){var b=window.orientation;"number"==typeof b&&m.random.addEntropy(b,1,"accelerometer")}a&&m.random.addEntropy(a,2,"accelerometer"),g(0)}},m.random=new m.prng(6);a:try{var n,o,p,q;if(q="undefined"!=typeof b){var r;if(r=b.exports){var s;try{s=a("crypto")}catch(a){s=null}r=(o=s)&&o.randomBytes}q=r}if(q)n=o.randomBytes(128),n=new Uint32Array(new Uint8Array(n).buffer),m.random.addEntropy(n,1024,"crypto['randomBytes']");else if("undefined"!=typeof window&&"undefined"!=typeof Uint32Array){if(p=new Uint32Array(32),window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(p);else{if(!window.msCrypto||!window.msCrypto.getRandomValues)break a;window.msCrypto.getRandomValues(p)}m.random.addEntropy(p,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!=typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(a))}m.json={defaults:{v:1,iter:1e3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},aa:function(a,b,c,e){c=c||{},e=e||{};var f,g=m.json,h=g.h({iv:m.random.randomWords(4,0)},g.defaults);return g.h(h,c),c=h.adata,"string"==typeof h.salt&&(h.salt=m.codec.base64.toBits(h.salt)),"string"==typeof h.iv&&(h.iv=m.codec.base64.toBits(h.iv)),(!m.mode[h.mode]||!m.cipher[h.cipher]||"string"==typeof a&&100>=h.iter||64!==h.ts&&96!==h.ts&&128!==h.ts||128!==h.ks&&192!==h.ks&&256!==h.ks||2>h.iv.length||4<h.iv.length)&&d(new m.exception.invalid("json encrypt: invalid parameters")),"string"==typeof a?(f=m.misc.cachedPbkdf2(a,h),a=f.key.slice(0,h.ks/32),h.salt=f.salt):m.ecc&&a instanceof m.ecc.elGamal.publicKey&&(f=a.kem(),h.kemtag=f.tag,a=f.key.slice(0,h.ks/32)),"string"==typeof b&&(b=m.codec.utf8String.toBits(b)),"string"==typeof c&&(h.adata=c=m.codec.utf8String.toBits(c)),f=new m.cipher[h.cipher](a),g.h(e,h),e.key=a,h.ct="ccm"===h.mode&&m.arrayBuffer&&m.arrayBuffer.ccm&&b instanceof ArrayBuffer?m.arrayBuffer.ccm.encrypt(f,b,h.iv,c,h.ts):m.mode[h.mode].encrypt(f,b,h.iv,c,h.ts),h},encrypt:function(a,b,c,d){var e=m.json,f=e.aa.apply(e,arguments);return e.encode(f)},$:function(a,b,c,e){c=c||{},e=e||{};var f=m.json;b=f.h(f.h(f.h({},f.defaults),b),c,!0);var g,h;return g=b.adata,"string"==typeof b.salt&&(b.salt=m.codec.base64.toBits(b.salt)),"string"==typeof b.iv&&(b.iv=m.codec.base64.toBits(b.iv)),(!m.mode[b.mode]||!m.cipher[b.cipher]||"string"==typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&256!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)&&d(new m.exception.invalid("json decrypt: invalid parameters")),"string"==typeof a?(h=m.misc.cachedPbkdf2(a,b),a=h.key.slice(0,b.ks/32),b.salt=h.salt):m.ecc&&a instanceof m.ecc.elGamal.secretKey&&(a=a.unkem(m.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32)),"string"==typeof g&&(g=m.codec.utf8String.toBits(g)),h=new m.cipher[b.cipher](a),g="ccm"===b.mode&&m.arrayBuffer&&m.arrayBuffer.ccm&&b.ct instanceof ArrayBuffer?m.arrayBuffer.ccm.decrypt(h,b.ct,b.iv,b.tag,g,b.ts):m.mode[b.mode].decrypt(h,b.ct,b.iv,g,b.ts),f.h(e,b),e.key=a,1===c.raw?g:m.codec.utf8String.fromBits(g)},decrypt:function(a,b,c,d){var e=m.json;return e.$(a,e.decode(b),c,d)},encode:function(a){var b,c="{",e="";for(b in a)if(a.hasOwnProperty(b))switch(b.match(/^[a-z0-9]+$/i)||d(new m.exception.invalid("json encode: invalid property name")),c+=e+'"'+b+'":',e=",",typeof a[b]){case"number":case"boolean":c+=a[b];break;case"string":c+='"'+escape(a[b])+'"';break;case"object":c+='"'+m.codec.base64.fromBits(a[b],0)+'"';break;default:d(new m.exception.bug("json encode: unsupported type"))}return c+"}"},decode:function(a){a=a.replace(/\s/g,""),a.match(/^\{.*\}$/)||d(new m.exception.invalid("json decode: this isn't json!")),a=a.replace(/^\{|\}$/g,"").split(/,/);var b,c,e={};for(b=0;b<a.length;b++)(c=a[b].match(/^\s*(?:(["']?)([a-z][a-z0-9]*)\1)\s*:\s*(?:(-?\d+)|"([a-z0-9+\/%*_.@=\-]*)"|(true|false))$/i))||d(new m.exception.invalid("json decode: this isn't json!")),null!=c[3]?e[c[2]]=parseInt(c[3],10):null!=c[4]?e[c[2]]=c[2].match(/^(ct|adata|salt|iv)$/)?m.codec.base64.toBits(c[4]):unescape(c[4]):null!=c[5]&&(e[c[2]]="true"===c[5]);return e},h:function(a,b,c){if(a===k&&(a={}),b===k)return a;for(var e in b)b.hasOwnProperty(e)&&(c&&a[e]!==k&&a[e]!==b[e]&&d(new m.exception.invalid("required parameter overridden")),a[e]=b[e]);return a},la:function(a,b){var c,d={};for(c in a)a.hasOwnProperty(c)&&a[c]!==b[c]&&(d[c]=a[c]);return d},ka:function(a,b){var c,d={};for(c=0;c<b.length;c++)a[b[c]]!==k&&(d[b[c]]=a[b[c]]);return d}},m.encrypt=m.json.encrypt,m.decrypt=m.json.decrypt,m.misc.ia={},m.misc.cachedPbkdf2=function(a,b){var c,d=m.misc.ia;return b=b||{},c=b.iter||1e3,d=d[a]=d[a]||{},c=d[c]=d[c]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):m.random.randomWords(2,0)},d=b.salt===k?c.firstSalt:b.salt,c[d]=c[d]||m.misc.pbkdf2(a,d,b.iter),{key:c[d].slice(0),salt:d.slice(0)}}},{crypto:115}],30:[function(a,b,c){b.exports=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];
6
},{}],31:[function(a,b,c){function d(a){if(a.length<8)return!1;if(a.length>72)return!1;if(48!==a[0])return!1;if(a[1]!==a.length-2)return!1;if(2!==a[2])return!1;var b=a[3];if(0===b)return!1;if(5+b>=a.length)return!1;if(2!==a[4+b])return!1;var c=a[5+b];return 0!==c&&(6+b+c===a.length&&(!(128&a[4])&&(!(b>1&&0===a[4]&&!(128&a[5]))&&(!(128&a[b+6])&&!(c>1&&0===a[b+6]&&!(128&a[b+7]))))))}function e(a){if(a.length<8)throw new Error("DER sequence length is too short");if(a.length>72)throw new Error("DER sequence length is too long");if(48!==a[0])throw new Error("Expected DER sequence");if(a[1]!==a.length-2)throw new Error("DER sequence length is invalid");if(2!==a[2])throw new Error("Expected DER integer");var b=a[3];if(0===b)throw new Error("R length is zero");if(5+b>=a.length)throw new Error("R length is too long");if(2!==a[4+b])throw new Error("Expected DER integer (2)");var c=a[5+b];if(0===c)throw new Error("S length is zero");if(6+b+c!==a.length)throw new Error("S length is invalid");if(128&a[4])throw new Error("R value is negative");if(b>1&&0===a[4]&&!(128&a[5]))throw new Error("R value excessively padded");if(128&a[b+6])throw new Error("S value is negative");if(c>1&&0===a[b+6]&&!(128&a[b+7]))throw new Error("S value excessively padded");return{r:a.slice(4,4+b),s:a.slice(6+b)}}function f(a,b){var c=a.length,d=b.length;if(0===c)throw new Error("R length is zero");if(0===d)throw new Error("S length is zero");if(c>33)throw new Error("R length is too long");if(d>33)throw new Error("S length is too long");if(128&a[0])throw new Error("R value is negative");if(128&b[0])throw new Error("S value is negative");if(c>1&&0===a[0]&&!(128&a[1]))throw new Error("R value excessively padded");if(d>1&&0===b[0]&&!(128&b[1]))throw new Error("S value excessively padded");var e=Buffer.allocUnsafe(6+c+d);return e[0]=48,e[1]=e.length-2,e[2]=2,e[3]=a.length,a.copy(e,4),e[4+c]=2,e[5+c]=b.length,b.copy(e,6+c),e}var Buffer=a("safe-buffer").Buffer;b.exports={check:d,decode:e,encode:f}},{"safe-buffer":288}],32:[function(a,b,c){b.exports={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_1:81,OP_TRUE:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}},{}],33:[function(a,b,c){var d=a("./index.json"),e={};for(var f in d){var g=d[f];e[g]=f}b.exports=e},{"./index.json":32}],34:[function(a,b,c){function d(a){var b=k.decode(a);if(b.length<21)throw new TypeError(a+" is too short");if(b.length>21)throw new TypeError(a+" is too long");var c=b.readUInt8(0),d=b.slice(1);return{version:c,hash:d}}function e(a){var b=j.decode(a),c=j.fromWords(b.words.slice(1));return{version:b.words[0],prefix:b.prefix,data:Buffer.from(c)}}function f(a,b){n(o.tuple(o.Hash160bit,o.UInt8),arguments);var c=Buffer.allocUnsafe(21);return c.writeUInt8(b,0),a.copy(c,1),k.encode(c)}function g(a,b,c){var d=j.toWords(a);return d.unshift(b),j.encode(c,d)}function h(a,b){if(b=b||m.bitcoin,l.pubKeyHash.output.check(a))return f(l.compile(a).slice(3,23),b.pubKeyHash);if(l.scriptHash.output.check(a))return f(l.compile(a).slice(2,22),b.scriptHash);if(l.witnessPubKeyHash.output.check(a))return g(l.compile(a).slice(2,22),0,b.bech32);if(l.witnessScriptHash.output.check(a))return g(l.compile(a).slice(2,34),0,b.bech32);throw new Error(l.toASM(a)+" has no matching Address")}function i(a,b){b=b||m.bitcoin;var c;try{c=d(a)}catch(a){}if(c){if(c.version===b.pubKeyHash)return l.pubKeyHash.output.encode(c.hash);if(c.version===b.scriptHash)return l.scriptHash.output.encode(c.hash)}else{try{c=e(a)}catch(a){}if(c){if(c.prefix!==b.bech32)throw new Error(a+" has an invalid prefix");if(0===c.version){if(20===c.data.length)return l.witnessPubKeyHash.output.encode(c.data);if(32===c.data.length)return l.witnessScriptHash.output.encode(c.data)}}}throw new Error(a+" has no matching Script")}var Buffer=a("safe-buffer").Buffer,j=a("bech32"),k=a("bs58check"),l=a("./script"),m=a("./networks"),n=a("typeforce"),o=a("./types");b.exports={fromBase58Check:d,fromBech32:e,fromOutputScript:h,toBase58Check:f,toBech32:g,toOutputScript:i}},{"./networks":43,"./script":44,"./types":70,bech32:22,bs58check:100,"safe-buffer":288,typeforce:312}],35:[function(a,b,c){function d(){this.version=1,this.prevHash=null,this.merkleRoot=null,this.timestamp=0,this.bits=0,this.nonce=0}var Buffer=a("safe-buffer").Buffer,e=a("buffer-reverse"),f=a("./crypto"),g=a("merkle-lib/fastRoot"),h=a("typeforce"),i=a("./types"),j=a("varuint-bitcoin"),k=a("./transaction");d.fromBuffer=function(a){function b(b){return h+=b,a.slice(h-b,h)}function c(){var b=a.readUInt32LE(h);return h+=4,b}function e(){var b=a.readInt32LE(h);return h+=4,b}function f(){var b=j.decode(a,h);return h+=j.decode.bytes,b}function g(){var b=k.fromBuffer(a.slice(h),!0);return h+=b.byteLength(),b}if(a.length<80)throw new Error("Buffer too small (< 80 bytes)");var h=0,i=new d;if(i.version=e(),i.prevHash=b(32),i.merkleRoot=b(32),i.timestamp=c(),i.bits=c(),i.nonce=c(),80===a.length)return i;var l=f();i.transactions=[];for(var m=0;m<l;++m){var n=g();i.transactions.push(n)}return i},d.prototype.byteLength=function(a){return a||!this.transactions?80:80+j.encodingLength(this.transactions.length)+this.transactions.reduce(function(a,b){return a+b.byteLength()},0)},d.fromHex=function(a){return d.fromBuffer(Buffer.from(a,"hex"))},d.prototype.getHash=function(){return f.hash256(this.toBuffer(!0))},d.prototype.getId=function(){return e(this.getHash()).toString("hex")},d.prototype.getUTCDate=function(){var a=new Date(0);return a.setUTCSeconds(this.timestamp),a},d.prototype.toBuffer=function(a){function b(a){a.copy(e,f),f+=a.length}function c(a){e.writeInt32LE(a,f),f+=4}function d(a){e.writeUInt32LE(a,f),f+=4}var e=Buffer.allocUnsafe(this.byteLength(a)),f=0;return c(this.version),b(this.prevHash),b(this.merkleRoot),d(this.timestamp),d(this.bits),d(this.nonce),a||!this.transactions?e:(j.encode(this.transactions.length,e,f),f+=j.encode.bytes,this.transactions.forEach(function(a){var b=a.byteLength();a.toBuffer(e,f),f+=b}),e)},d.prototype.toHex=function(a){return this.toBuffer(a).toString("hex")},d.calculateTarget=function(a){var b=((4278190080&a)>>24)-3,c=8388607&a,d=Buffer.alloc(32,0);return d.writeUInt32BE(c,28-b),d},d.calculateMerkleRoot=function(a){if(h([{getHash:i.Function}],a),0===a.length)throw TypeError("Cannot compute merkle root for zero transactions");var b=a.map(function(a){return a.getHash()});return g(b,f.hash256)},d.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;var a=d.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(a)},d.prototype.checkProofOfWork=function(){var a=e(this.getHash()),b=d.calculateTarget(this.bits);return a.compare(b)<=0},b.exports=d},{"./crypto":37,"./transaction":68,"./types":70,"buffer-reverse":102,"merkle-lib/fastRoot":232,"safe-buffer":288,typeforce:312,"varuint-bitcoin":321}],36:[function(a,b,c){function d(a,b){if("number"!=typeof a)throw new Error("cannot write a non-number as a number");if(a<0)throw new Error("specified a negative value for writing an unsigned value");if(a>b)throw new Error("RangeError: value out of range");if(Math.floor(a)!==a)throw new Error("value has a fractional component")}function e(a,b){var c=a.readUInt32LE(b),e=a.readUInt32LE(b+4);return e*=4294967296,d(e+c,9007199254740991),e+c}function f(a,b,c){return d(b,9007199254740991),a.writeInt32LE(b&-1,c),a.writeUInt32LE(Math.floor(b/4294967296),c+4),c+8}function g(a,b){var c=j.decode(a,b);return{number:c,size:j.decode.bytes}}function h(a,b,c){return j.encode(b,a,c),j.encode.bytes}var i=a("pushdata-bitcoin"),j=a("varuint-bitcoin");b.exports={pushDataSize:i.encodingLength,readPushDataInt:i.decode,readUInt64LE:e,readVarInt:g,varIntBuffer:j.encode,varIntSize:j.encodingLength,writePushDataInt:i.encode,writeUInt64LE:f,writeVarInt:h}},{"pushdata-bitcoin":266,"varuint-bitcoin":321}],37:[function(a,b,c){function d(a){return i("rmd160").update(a).digest()}function e(a){return i("sha1").update(a).digest()}function f(a){return i("sha256").update(a).digest()}function g(a){return d(f(a))}function h(a){return f(f(a))}var i=a("create-hash");b.exports={hash160:g,hash256:h,ripemd160:d,sha1:e,sha256:f}},{"create-hash":110}],38:[function(a,b,c){function d(a,b,c){h(i.tuple(i.Hash256bit,i.Buffer256bit,i.Function),arguments);var d=Buffer.alloc(32,0),e=Buffer.alloc(32,1);d=g("sha256",d).update(e).update(k).update(b).update(a).digest(),e=g("sha256",d).update(e).digest(),d=g("sha256",d).update(e).update(l).update(b).update(a).digest(),e=g("sha256",d).update(e).digest(),e=g("sha256",d).update(e).digest();for(var f=BigInteger.fromBuffer(e);f.signum()<=0||f.compareTo(n.n)>=0||!c(f);)d=g("sha256",d).update(e).update(k).digest(),e=g("sha256",d).update(e).digest(),e=g("sha256",d).update(e).digest(),f=BigInteger.fromBuffer(e);return f}function e(a,b){h(i.tuple(i.Hash256bit,i.BigInt),arguments);var c,e,f=b.toBuffer(32),g=BigInteger.fromBuffer(a),k=n.n,l=n.G;return d(a,f,function(a){var d=l.multiply(a);return!n.isInfinity(d)&&(c=d.affineX.mod(k),0!==c.signum()&&(e=a.modInverse(k).multiply(g.add(b.multiply(c))).mod(k),0!==e.signum()))}),e.compareTo(o)>0&&(e=k.subtract(e)),new j(c,e)}function f(a,b,c){h(i.tuple(i.Hash256bit,i.ECSignature,i.ECPoint),arguments);var d=n.n,e=n.G,f=b.r,g=b.s;if(f.signum()<=0||f.compareTo(d)>=0)return!1;if(g.signum()<=0||g.compareTo(d)>=0)return!1;var j=BigInteger.fromBuffer(a),k=g.modInverse(d),l=j.multiply(k).mod(d),m=f.multiply(k).mod(d),o=e.multiplyTwo(l,c,m);if(n.isInfinity(o))return!1;var p=o.affineX,q=p.mod(d);return q.equals(f)}var Buffer=a("safe-buffer").Buffer,g=a("create-hmac"),h=a("typeforce"),i=a("./types"),BigInteger=a("bigi"),j=a("./ecsignature"),k=Buffer.alloc(1,0),l=Buffer.alloc(1,1),m=a("ecurve"),n=m.getCurveByName("secp256k1"),o=n.n.shiftRight(1);b.exports={deterministicGenerateK:d,sign:e,verify:f,__curve:n}},{"./ecsignature":40,"./types":70,bigi:25,"create-hmac":113,ecurve:189,"safe-buffer":288,typeforce:312}],39:[function(a,b,c){function ECPair(a,b,c){if(c&&h({compressed:i.maybe(i.Boolean),network:i.maybe(i.Network)},c),c=c||{},a){if(a.signum()<=0)throw new Error("Private key must be greater than 0");if(a.compareTo(m.n)>=0)throw new Error("Private key must be less than the curve order");if(b)throw new TypeError("Unexpected publicKey parameter");this.d=a}else h(i.ECPoint,b),this.__Q=b;this.compressed=void 0===c.compressed||c.compressed,this.network=c.network||k.bitcoin}var d=a("./address"),e=a("./crypto"),f=a("./ecdsa"),g=a("randombytes"),h=a("typeforce"),i=a("./types"),j=a("wif"),k=a("./networks"),BigInteger=a("bigi"),l=a("ecurve"),m=f.__curve;Object.defineProperty(ECPair.prototype,"Q",{get:function(){return!this.__Q&&this.d&&(this.__Q=m.G.multiply(this.d)),this.__Q}}),ECPair.fromPublicKeyBuffer=function(a,b){var c=l.Point.decodeFrom(m,a);return new ECPair(null,c,{compressed:c.compressed,network:b})},ECPair.fromWIF=function(a,b){var c=j.decode(a),d=c.version;if(i.Array(b)){if(b=b.filter(function(a){return d===a.wif}).pop(),!b)throw new Error("Unknown network version")}else if(b=b||k.bitcoin,d!==b.wif)throw new Error("Invalid network version");var e=BigInteger.fromBuffer(c.privateKey);return new ECPair(e,null,{compressed:c.compressed,network:b})},ECPair.makeRandom=function(a){a=a||{};var b,c=a.rng||g;do{var d=c(32);h(i.Buffer256bit,d),b=BigInteger.fromBuffer(d)}while(b.signum()<=0||b.compareTo(m.n)>=0);return new ECPair(b,null,a)},ECPair.prototype.getAddress=function(){return d.toBase58Check(e.hash160(this.getPublicKeyBuffer()),this.getNetwork().pubKeyHash)},ECPair.prototype.getNetwork=function(){return this.network},ECPair.prototype.getPublicKeyBuffer=function(){return this.Q.getEncoded(this.compressed)},ECPair.prototype.sign=function(a){if(!this.d)throw new Error("Missing private key");return f.sign(a,this.d)},ECPair.prototype.toWIF=function(){if(!this.d)throw new Error("Missing private key");return j.encode(this.network.wif,this.d.toBuffer(32),this.compressed)},ECPair.prototype.verify=function(a,b){return f.verify(a,b,this.Q)},b.exports=ECPair},{"./address":34,"./crypto":37,"./ecdsa":38,"./networks":43,"./types":70,bigi:25,ecurve:189,randombytes:271,typeforce:312,wif:324}],40:[function(a,b,c){(function(Buffer){function c(a,b){e(f.tuple(f.BigInt,f.BigInt),arguments),this.r=a,this.s=b}var d=a("bip66"),e=a("typeforce"),f=a("./types"),BigInteger=a("bigi");c.parseCompact=function(a){if(65!==a.length)throw new Error("Invalid signature length");var b=a.readUInt8(0)-27;if(b!==(7&b))throw new Error("Invalid signature parameter");var d=!!(4&b),e=3&b,f=BigInteger.fromBuffer(a.slice(1,33)),g=BigInteger.fromBuffer(a.slice(33));return{compressed:d,i:e,signature:new c(f,g)}},c.fromDER=function(a){var b=d.decode(a),e=BigInteger.fromDERInteger(b.r),f=BigInteger.fromDERInteger(b.s);return new c(e,f)},c.parseScriptSignature=function(a){var b=a.readUInt8(a.length-1),d=b&-193;if(d<=0||d>=4)throw new Error("Invalid hashType "+b);return{signature:c.fromDER(a.slice(0,-1)),hashType:b}},c.prototype.toCompact=function(a,b){b&&(a+=4),a+=27;var c=Buffer.alloc(65);return c.writeUInt8(a,0),this.r.toBuffer(32).copy(c,1),this.s.toBuffer(32).copy(c,33),c},c.prototype.toDER=function(){var a=Buffer.from(this.r.toDERInteger()),b=Buffer.from(this.s.toDERInteger());return d.encode(a,b)},c.prototype.toScriptSignature=function(a){var b=a&-193;if(b<=0||b>=4)throw new Error("Invalid hashType "+a);var c=Buffer.alloc(1);return c.writeUInt8(a,0),Buffer.concat([this.toDER(),c])},b.exports=c}).call(this,a("buffer").Buffer)},{"./types":70,bigi:25,bip66:31,buffer:104,typeforce:312}],41:[function(a,b,c){function HDNode(a,b){if(g(h.tuple("ECPair",h.Buffer256bit),arguments),!a.compressed)throw new TypeError("BIP32 only allows compressed keyPairs");this.keyPair=a,this.chainCode=b,this.depth=0,this.index=0,this.parentFingerprint=0}var Buffer=a("safe-buffer").Buffer,d=a("bs58check"),e=a("./crypto"),f=a("create-hmac"),g=a("typeforce"),h=a("./types"),i=a("./networks"),BigInteger=a("bigi"),ECPair=a("./ecpair"),j=a("ecurve"),k=j.getCurveByName("secp256k1");HDNode.HIGHEST_BIT=2147483648,HDNode.LENGTH=78,HDNode.MASTER_SECRET=Buffer.from("Bitcoin seed","utf8"),HDNode.fromSeedBuffer=function(a,b){if(g(h.tuple(h.Buffer,h.maybe(h.Network)),arguments),a.length<16)throw new TypeError("Seed should be at least 128 bits");if(a.length>64)throw new TypeError("Seed should be at most 512 bits");var c=f("sha512",HDNode.MASTER_SECRET).update(a).digest(),d=c.slice(0,32),e=c.slice(32),i=BigInteger.fromBuffer(d),j=new ECPair(i,null,{network:b});return new HDNode(j,e)},HDNode.fromSeedHex=function(a,b){return HDNode.fromSeedBuffer(Buffer.from(a,"hex"),b)},HDNode.fromBase58=function(a,b){var c=d.decode(a);if(78!==c.length)throw new Error("Invalid buffer length");var e,f=c.readUInt32BE(0);if(Array.isArray(b)){if(e=b.filter(function(a){return f===a.bip32.private||f===a.bip32.public}).pop(),!e)throw new Error("Unknown network version")}else e=b||i.bitcoin;if(f!==e.bip32.private&&f!==e.bip32.public)throw new Error("Invalid network version");var g=c[4],h=c.readUInt32BE(5);if(0===g&&0!==h)throw new Error("Invalid parent fingerprint");var l=c.readUInt32BE(9);if(0===g&&0!==l)throw new Error("Invalid index");var m,n=c.slice(13,45);if(f===e.bip32.private){if(0!==c.readUInt8(45))throw new Error("Invalid private key");var o=BigInteger.fromBuffer(c.slice(46,78));m=new ECPair(o,null,{network:e})}else{var p=j.Point.decodeFrom(k,c.slice(45,78));k.validate(p),m=new ECPair(null,p,{network:e})}var q=new HDNode(m,n);return q.depth=g,q.index=l,q.parentFingerprint=h,q},HDNode.prototype.getAddress=function(){return this.keyPair.getAddress()},HDNode.prototype.getIdentifier=function(){return e.hash160(this.keyPair.getPublicKeyBuffer())},HDNode.prototype.getFingerprint=function(){return this.getIdentifier().slice(0,4)},HDNode.prototype.getNetwork=function(){return this.keyPair.getNetwork()},HDNode.prototype.getPublicKeyBuffer=function(){return this.keyPair.getPublicKeyBuffer()},HDNode.prototype.neutered=function(){var a=new ECPair(null,this.keyPair.Q,{network:this.keyPair.network}),b=new HDNode(a,this.chainCode);return b.depth=this.depth,b.index=this.index,b.parentFingerprint=this.parentFingerprint,b},HDNode.prototype.sign=function(a){return this.keyPair.sign(a)},HDNode.prototype.verify=function(a,b){return this.keyPair.verify(a,b)},HDNode.prototype.toBase58=function(a){if(void 0!==a)throw new TypeError("Unsupported argument in 2.0.0");var b=this.keyPair.network,c=this.isNeutered()?b.bip32.public:b.bip32.private,e=Buffer.allocUnsafe(78);return e.writeUInt32BE(c,0),e.writeUInt8(this.depth,4),e.writeUInt32BE(this.parentFingerprint,5),e.writeUInt32BE(this.index,9),this.chainCode.copy(e,13),this.isNeutered()?this.keyPair.getPublicKeyBuffer().copy(e,45):(e.writeUInt8(0,45),this.keyPair.d.toBuffer(32).copy(e,46)),d.encode(e)},HDNode.prototype.derive=function(a){g(h.UInt32,a);var b=a>=HDNode.HIGHEST_BIT,c=Buffer.allocUnsafe(37);if(b){if(this.isNeutered())throw new TypeError("Could not derive hardened child key");c[0]=0,this.keyPair.d.toBuffer(32).copy(c,1),c.writeUInt32BE(a,33)}else this.keyPair.getPublicKeyBuffer().copy(c,0),c.writeUInt32BE(a,33);var d=f("sha512",this.chainCode).update(c).digest(),e=d.slice(0,32),i=d.slice(32),j=BigInteger.fromBuffer(e);if(j.compareTo(k.n)>=0)return this.derive(a+1);var l;if(this.isNeutered()){var m=k.G.multiply(j).add(this.keyPair.Q);if(k.isInfinity(m))return this.derive(a+1);l=new ECPair(null,m,{network:this.keyPair.network})}else{var n=j.add(this.keyPair.d).mod(k.n);if(0===n.signum())return this.derive(a+1);l=new ECPair(n,null,{network:this.keyPair.network})}var o=new HDNode(l,i);return o.depth=this.depth+1,o.index=a,o.parentFingerprint=this.getFingerprint().readUInt32BE(0),o},HDNode.prototype.deriveHardened=function(a){return g(h.UInt31,a),this.derive(a+HDNode.HIGHEST_BIT)},HDNode.prototype.isNeutered=function(){return!this.keyPair.d},HDNode.prototype.derivePath=function(a){g(h.BIP32Path,a);var b=a.split("/");if("m"===b[0]){if(this.parentFingerprint)throw new Error("Not a master node");b=b.slice(1)}return b.reduce(function(a,b){var c;return"'"===b.slice(-1)?(c=parseInt(b.slice(0,-1),10),a.deriveHardened(c)):(c=parseInt(b,10),a.derive(c))},this)},b.exports=HDNode},{"./crypto":37,"./ecpair":39,"./networks":43,"./types":70,bigi:25,bs58check:100,"create-hmac":113,ecurve:189,"safe-buffer":288,typeforce:312}],42:[function(a,b,c){b.exports={Block:a("./block"),ECPair:a("./ecpair"),ECSignature:a("./ecsignature"),HDNode:a("./hdnode"),Transaction:a("./transaction"),TransactionBuilder:a("./transaction_builder"),address:a("./address"),bufferutils:a("./bufferutils"),crypto:a("./crypto"),networks:a("./networks"),opcodes:a("bitcoin-ops"),script:a("./script")}},{"./address":34,"./block":35,"./bufferutils":36,"./crypto":37,"./ecpair":39,"./ecsignature":40,"./hdnode":41,"./networks":43,"./script":44,"./transaction":68,"./transaction_builder":69,"bitcoin-ops":32}],43:[function(a,b,c){b.exports={bitcoincash:{messagePrefix:"Bitcoin Signed Message:\n",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},bitcoincashtestnet:{messagePrefix:"Bitcoin Signed Message:\n",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},litecoin:{messagePrefix:"Litecoin Signed Message:\n",bip32:{public:27108450,private:27106558},pubKeyHash:48,scriptHash:50,wif:176}}},{}],44:[function(a,b,c){function d(a){return s.Number(a)&&(a===u.OP_0||a>=u.OP_1&&a<=u.OP_16||a===u.OP_1NEGATE)}function e(a){return s.Buffer(a)||d(a)}function f(a){return s.Array(a)&&a.every(e)}function g(a){if(0===a.length)return u.OP_0;if(1===a.length)return a[0]>=1&&a[0]<=16?w+a[0]:129===a[0]?u.OP_1NEGATE:void 0}function h(a){if(Buffer.isBuffer(a))return a;r(s.Array,a);var b=a.reduce(function(a,b){return Buffer.isBuffer(b)?1===b.length&&void 0!==g(b)?a+1:a+q.encodingLength(b.length)+b.length:a+1},0),c=Buffer.allocUnsafe(b),d=0;if(a.forEach(function(a){if(Buffer.isBuffer(a)){var b=g(a);if(void 0!==b)return c.writeUInt8(b,d),void(d+=1);d+=q.encode(c,a.length,d),a.copy(c,d),d+=a.length}else c.writeUInt8(a,d),d+=1}),d!==c.length)throw new Error("Could not decode chunks");return c}function i(a){if(s.Array(a))return a;r(s.Buffer,a);for(var b=[],c=0;c<a.length;){var d=a[c];if(d>u.OP_0&&d<=u.OP_PUSHDATA4){var e=q.decode(a,c);if(null===e)return[];if(c+=e.size,c+e.number>a.length)return[];var f=a.slice(c,c+e.number);c+=e.number;var h=g(f);void 0!==h?b.push(h):b.push(f)}else b.push(d),c+=1}return b}function j(a){return Buffer.isBuffer(a)&&(a=i(a)),a.map(function(a){if(Buffer.isBuffer(a)){var b=g(a);if(void 0===b)return a.toString("hex");a=b}return v[a]}).join(" ")}function k(asm){return r(s.String,asm),h(asm.split(" ").map(function(a){return void 0!==u[a]?u[a]:(r(s.Hex,a),Buffer.from(a,"hex"))}))}function l(a){return a=i(a),r(f,a),a.map(function(a){return Buffer.isBuffer(a)?a:a===u.OP_0?Buffer.allocUnsafe(0):t.encode(a-w)})}function m(a){if(!Buffer.isBuffer(a))return!1;if(a.length<33)return!1;switch(a[0]){case 2:case 3:return 33===a.length;case 4:return 65===a.length}return!1}function n(a){var b=a&-193;return b>0&&b<4}function o(a){return!!Buffer.isBuffer(a)&&(!!n(a[a.length-1])&&p.check(a.slice(0,-1)))}var Buffer=a("safe-buffer").Buffer,p=a("bip66"),q=a("pushdata-bitcoin"),r=a("typeforce"),s=a("./types"),t=a("./script_number"),u=a("bitcoin-ops"),v=a("bitcoin-ops/map"),w=u.OP_RESERVED;b.exports={compile:h,decompile:i,fromASM:k,toASM:j,toStack:l,number:a("./script_number"),isCanonicalPubKey:m,isCanonicalSignature:o,isPushOnly:f,isDefinedHashType:n};var x=a("./templates");for(var y in x)b.exports[y]=x[y]},{"./script_number":45,"./templates":46,"./types":70,bip66:31,"bitcoin-ops":32,"bitcoin-ops/map":33,"pushdata-bitcoin":266,"safe-buffer":288,typeforce:312}],45:[function(a,b,c){function d(a,b,c){b=b||4,c=void 0===c||c;var d=a.length;if(0===d)return 0;if(d>b)throw new TypeError("Script number overflow");if(c&&0===(127&a[d-1])&&(d<=1||0===(128&a[d-2])))throw new Error("Non-minimally encoded script number");if(5===d){var e=a.readUInt32LE(0),f=a.readUInt8(4);return 128&f?-(4294967296*(f&-129)+e):4294967296*f+e}for(var g=0,h=0;h<d;++h)g|=a[h]<<8*h;return 128&a[d-1]?-(g&~(128<<8*(d-1))):g}function e(a){return a>2147483647?5:a>8388607?4:a>32767?3:a>127?2:a>0?1:0}function f(a){for(var b=Math.abs(a),c=e(b),d=Buffer.allocUnsafe(c),f=a<0,g=0;g<c;++g)d.writeUInt8(255&b,g),b>>=8;return 128&d[c-1]?d.writeUInt8(f?128:0,c-1):f&&(d[c-1]|=128),d}var Buffer=a("safe-buffer").Buffer;b.exports={decode:d,encode:f}},{"safe-buffer":288}],46:[function(a,b,c){function d(a){if(m.output.check(a))return p.P2WPKH;if(n.output.check(a))return p.P2WSH;if(k.output.check(a))return p.P2PKH;if(l.output.check(a))return p.P2SH;var b=g(a);return h.output.check(b)?p.MULTISIG:j.output.check(b)?p.P2PK:o.output.check(b)?p.WITNESS_COMMITMENT:i.output.check(b)?p.NULLDATA:p.NONSTANDARD}function e(a,b){var c=g(a);return k.input.check(c)?p.P2PKH:h.input.check(c,b)?p.MULTISIG:l.input.check(c,b)?p.P2SH:j.input.check(c)?p.P2PK:p.NONSTANDARD}function f(a,b){var c=g(a);return m.input.check(c)?p.P2WPKH:n.input.check(c,b)?p.P2WSH:p.NONSTANDARD}var g=a("../script").decompile,h=a("./multisig"),i=a("./nulldata"),j=a("./pubkey"),k=a("./pubkeyhash"),l=a("./scripthash"),m=a("./witnesspubkeyhash"),n=a("./witnessscripthash"),o=a("./witnesscommitment"),p={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};b.exports={classifyInput:e,classifyOutput:d,classifyWitness:f,multisig:h,nullData:i,pubKey:j,pubKeyHash:k,scriptHash:l,witnessPubKeyHash:m,witnessScriptHash:n,witnessCommitment:o,types:p}},{"../script":44,"./multisig":47,"./nulldata":50,"./pubkey":51,"./pubkeyhash":54,"./scripthash":57,"./witnesscommitment":60,"./witnesspubkeyhash":62,"./witnessscripthash":65}],47:[function(a,b,c){b.exports={input:a("./input"),output:a("./output")}},{"./input":48,"./output":49}],48:[function(a,b,c){function d(a){return a===l.OP_0||j.isCanonicalSignature(a)}function e(a,b){var c=j.decompile(a);return!(c.length<2)&&(c[0]===l.OP_0&&(b?c.slice(1).every(d):c.slice(1).every(j.isCanonicalSignature)))}function f(a,b){if(k([d],a),b){var c=j.multisig.output.decode(b);if(a.length<c.m)throw new TypeError("Not enough signatures provided");if(a.length>c.pubKeys.length)throw new TypeError("Too many signatures provided")}return[].concat(m,a.map(function(a){return a===l.OP_0?m:a}))}function g(a,b){return j.compile(f(a,b))}function h(a,b){return k(e,a,b),a.slice(1)}function i(a,b){var c=j.decompile(a);return h(c,b)}var Buffer=a("safe-buffer").Buffer,j=a("../../script"),k=a("typeforce"),l=a("bitcoin-ops");e.toJSON=function(){return"multisig input"};var m=Buffer.allocUnsafe(0);b.exports={check:e,decode:i,decodeStack:h,encode:g,encodeStack:f}},{"../../script":44,"bitcoin-ops":32,"safe-buffer":288,typeforce:312}],49:[function(a,b,c){function d(a,b){var c=g.decompile(a);if(c.length<4)return!1;if(c[c.length-1]!==j.OP_CHECKMULTISIG)return!1;if(!h.Number(c[0]))return!1;if(!h.Number(c[c.length-2]))return!1;var d=c[0]-k,e=c[c.length-2]-k;if(d<=0)return!1;if(e>16)return!1;if(d>e)return!1;if(e!==c.length-3)return!1;if(b)return!0;var f=c.slice(1,-2);return f.every(g.isCanonicalPubKey)}function e(a,b){i({m:h.Number,pubKeys:[g.isCanonicalPubKey]},{m:a,pubKeys:b});var c=b.length;if(c<a)throw new TypeError("Not enough pubKeys provided");return g.compile([].concat(k+a,b,k+c,j.OP_CHECKMULTISIG))}function f(a,b){var c=g.decompile(a);return i(d,c,b),{m:c[0]-k,pubKeys:c.slice(1,-2)}}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops"),k=j.OP_RESERVED;d.toJSON=function(){return"multi-sig output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],50:[function(a,b,c){function d(a){var b=g.compile(a);return b.length>1&&b[0]===j.OP_RETURN}function e(a){return i(h.Buffer,a),g.compile([j.OP_RETURN,a])}function f(a){return i(d,a),a.slice(2)}var g=a("../script"),h=a("../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"null data output"},b.exports={output:{check:d,decode:f,encode:e}}},{"../script":44,"../types":70,"bitcoin-ops":32,typeforce:312}],51:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":52,"./output":53,dup:47}],52:[function(a,b,c){function d(a){var b=i.decompile(a);return 1===b.length&&i.isCanonicalSignature(b[0])}function e(a){return j(i.isCanonicalSignature,a),[a]}function f(a){return i.compile(e(a))}function g(a){return j(d,a),a[0]}function h(a){var b=i.decompile(a);return g(b)}var i=a("../../script"),j=a("typeforce");d.toJSON=function(){return"pubKey input"},b.exports={check:d,decode:h,decodeStack:g,encode:f,encodeStack:e}},{"../../script":44,typeforce:312}],53:[function(a,b,c){function d(a){var b=g.decompile(a);return 2===b.length&&g.isCanonicalPubKey(b[0])&&b[1]===i.OP_CHECKSIG}function e(a){return h(g.isCanonicalPubKey,a),g.compile([a,i.OP_CHECKSIG])}function f(a){var b=g.decompile(a);return h(d,b),b[0]}var g=a("../../script"),h=a("typeforce"),i=a("bitcoin-ops");d.toJSON=function(){return"pubKey output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"bitcoin-ops":32,typeforce:312}],54:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":55,"./output":56,dup:47}],55:[function(a,b,c){function d(a){var b=i.decompile(a);return 2===b.length&&i.isCanonicalSignature(b[0])&&i.isCanonicalPubKey(b[1])}function e(a,b){return j({signature:i.isCanonicalSignature,pubKey:i.isCanonicalPubKey},{signature:a,pubKey:b}),[a,b]}function f(a,b){return i.compile(e(a,b))}function g(a){return j(d,a),{signature:a[0],pubKey:a[1]}}function h(a){var b=i.decompile(a);return g(b)}var i=a("../../script"),j=a("typeforce");d.toJSON=function(){return"pubKeyHash input"},b.exports={check:d,decode:h,decodeStack:g,encode:f,encodeStack:e}},{"../../script":44,typeforce:312}],56:[function(a,b,c){function d(a){var b=g.compile(a);return 25===b.length&&b[0]===j.OP_DUP&&b[1]===j.OP_HASH160&&20===b[2]&&b[23]===j.OP_EQUALVERIFY&&b[24]===j.OP_CHECKSIG}function e(a){return i(h.Hash160bit,a),g.compile([j.OP_DUP,j.OP_HASH160,a,j.OP_EQUALVERIFY,j.OP_CHECKSIG])}function f(a){return i(d,a),a.slice(3,23)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"pubKeyHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],57:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":58,"./output":59,dup:47}],58:[function(a,b,c){function d(a,b){var c=i.decompile(a);if(c.length<1)return!1;var d=c[c.length-1];if(!Buffer.isBuffer(d))return!1;var e=i.decompile(i.compile(c.slice(0,-1))),f=i.decompile(d);if(0===f.length)return!1;if(!i.isPushOnly(e))return!1;var g=i.classifyInput(e,b),h=i.classifyOutput(f);return 1===c.length?h===i.types.P2WSH||h===i.types.P2WPKH:g===h}function e(a,b){var c=i.compile(b);return[].concat(a,c)}function f(a,b){var c=i.decompile(a);return i.compile(e(c,b))}function g(a){return j(d,a),{redeemScriptStack:a.slice(0,-1),redeemScript:a[a.length-1]}}function h(a){var b=i.decompile(a),c=g(b);return c.redeemScriptSig=i.compile(c.redeemScriptStack),delete c.redeemScriptStack,c}var Buffer=a("safe-buffer").Buffer,i=a("../../script"),j=a("typeforce");d.toJSON=function(){return"scriptHash input"},b.exports={check:d,decode:h,decodeStack:g,encode:f,encodeStack:e}},{"../../script":44,"safe-buffer":288,typeforce:312}],59:[function(a,b,c){function d(a){var b=g.compile(a);return 23===b.length&&b[0]===j.OP_HASH160&&20===b[1]&&b[22]===j.OP_EQUAL}function e(a){return i(h.Hash160bit,a),g.compile([j.OP_HASH160,a,j.OP_EQUAL])}function f(a){return i(d,a),a.slice(2,22)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"scriptHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],60:[function(a,b,c){b.exports={output:a("./output")}},{"./output":61}],61:[function(a,b,c){function d(a){var b=g.compile(a);return b.length>37&&b[0]===j.OP_RETURN&&36===b[1]&&b.slice(2,6).equals(k)}function e(a){i(h.Hash256bit,a);var b=Buffer.allocUnsafe(36);return k.copy(b,0),a.copy(b,4),g.compile([j.OP_RETURN,b])}function f(a){return i(d,a),g.decompile(a)[1].slice(4,36)}var Buffer=a("safe-buffer").Buffer,g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops"),k=Buffer.from("aa21a9ed","hex");
7
d.toJSON=function(){return"Witness commitment output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,"safe-buffer":288,typeforce:312}],62:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":63,"./output":64,dup:47}],63:[function(a,b,c){function d(a){return h.isCanonicalPubKey(a)&&33===a.length}function e(a){var b=h.decompile(a);return 2===b.length&&h.isCanonicalSignature(b[0])&&d(b[1])}function f(a,b){return i({signature:h.isCanonicalSignature,pubKey:d},{signature:a,pubKey:b}),[a,b]}function g(a){return i(e,a),{signature:a[0],pubKey:a[1]}}var h=a("../../script"),i=a("typeforce");e.toJSON=function(){return"witnessPubKeyHash input"},b.exports={check:e,decodeStack:g,encodeStack:f}},{"../../script":44,typeforce:312}],64:[function(a,b,c){function d(a){var b=g.compile(a);return 22===b.length&&b[0]===j.OP_0&&20===b[1]}function e(a){return i(h.Hash160bit,a),g.compile([j.OP_0,a])}function f(a){return i(d,a),a.slice(2)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"Witness pubKeyHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],65:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":66,"./output":67,dup:47}],66:[function(a,b,c){var d=a("../scripthash/input");b.exports={check:d.check,decodeStack:d.decodeStack,encodeStack:d.encodeStack}},{"../scripthash/input":58}],67:[function(a,b,c){function d(a){var b=g.compile(a);return 34===b.length&&b[0]===j.OP_0&&32===b[1]}function e(a){return i(h.Hash256bit,a),g.compile([j.OP_0,a])}function f(a){return i(d,a),a.slice(2)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"Witness scriptHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],68:[function(a,b,c){function d(a){var b=a.length;return n.encodingLength(b)+b}function e(a){var b=a.length;return n.encodingLength(b)+a.reduce(function(a,b){return a+d(b)},0)}function f(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}var Buffer=a("safe-buffer").Buffer,g=a("buffer-reverse"),h=a("./crypto"),i=a("./script"),j=a("./bufferutils"),k=a("bitcoin-ops"),l=a("typeforce"),m=a("./types"),n=a("varuint-bitcoin");f.DEFAULT_SEQUENCE=4294967295,f.SIGHASH_ALL=1,f.SIGHASH_NONE=2,f.SIGHASH_SINGLE=3,f.SIGHASH_ANYONECANPAY=128,f.SIGHASH_BITCOINCASHBIP143=64,f.ADVANCED_TRANSACTION_MARKER=0,f.ADVANCED_TRANSACTION_FLAG=1;var o=Buffer.allocUnsafe(0),p=[],q=Buffer.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),r=Buffer.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),s=Buffer.from("ffffffffffffffff","hex"),t={script:o,valueBuffer:s};f.fromBuffer=function(a,b){function c(b){return l+=b,a.slice(l-b,l)}function d(){var b=a.readUInt32LE(l);return l+=4,b}function e(){var b=a.readInt32LE(l);return l+=4,b}function g(){var b=j.readUInt64LE(a,l);return l+=8,b}function h(){var b=n.decode(a,l);return l+=n.decode.bytes,b}function i(){return c(h())}function k(){for(var a=h(),b=[],c=0;c<a;c++)b.push(i());return b}var l=0,m=new f;m.version=e();var o=a.readUInt8(l),q=a.readUInt8(l+1),r=!1;o===f.ADVANCED_TRANSACTION_MARKER&&q===f.ADVANCED_TRANSACTION_FLAG&&(l+=2,r=!0);for(var s=h(),t=0;t<s;++t)m.ins.push({hash:c(32),index:d(),script:i(),sequence:d(),witness:p});var u=h();for(t=0;t<u;++t)m.outs.push({value:g(),script:i()});if(r){for(t=0;t<s;++t)m.ins[t].witness=k();if(!m.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(m.locktime=d(),b)return m;if(l!==a.length)throw new Error("Transaction has unexpected data");return m},f.fromHex=function(a){return f.fromBuffer(Buffer.from(a,"hex"))},f.isCoinbaseHash=function(a){l(m.Hash256bit,a);for(var b=0;b<32;++b)if(0!==a[b])return!1;return!0},f.prototype.isCoinbase=function(){return 1===this.ins.length&&f.isCoinbaseHash(this.ins[0].hash)},f.prototype.addInput=function(a,b,c,d){return l(m.tuple(m.Hash256bit,m.UInt32,m.maybe(m.UInt32),m.maybe(m.Buffer)),arguments),m.Null(c)&&(c=f.DEFAULT_SEQUENCE),this.ins.push({hash:a,index:b,script:d||o,sequence:c,witness:p})-1},f.prototype.addOutput=function(a,b){return l(m.tuple(m.Buffer,m.Satoshi),arguments),this.outs.push({script:a,value:b})-1},f.prototype.hasWitnesses=function(){return this.ins.some(function(a){return 0!==a.witness.length})},f.prototype.weight=function(){var a=this.__byteLength(!1),b=this.__byteLength(!0);return 3*a+b},f.prototype.virtualSize=function(){return Math.ceil(this.weight()/4)},f.prototype.byteLength=function(){return this.__byteLength(!0)},f.prototype.__byteLength=function(a){var b=a&&this.hasWitnesses();return(b?10:8)+n.encodingLength(this.ins.length)+n.encodingLength(this.outs.length)+this.ins.reduce(function(a,b){return a+40+d(b.script)},0)+this.outs.reduce(function(a,b){return a+8+d(b.script)},0)+(b?this.ins.reduce(function(a,b){return a+e(b.witness)},0):0)},f.prototype.clone=function(){var a=new f;return a.version=this.version,a.locktime=this.locktime,a.ins=this.ins.map(function(a){return{hash:a.hash,index:a.index,script:a.script,sequence:a.sequence,witness:a.witness}}),a.outs=this.outs.map(function(a){return{script:a.script,value:a.value}}),a},f.prototype.hashForSignature=function(a,b,c){if(l(m.tuple(m.UInt32,m.Buffer,m.Number),arguments),a>=this.ins.length)return r;var d=i.compile(i.decompile(b).filter(function(a){return a!==k.OP_CODESEPARATOR})),e=this.clone();if((31&c)===f.SIGHASH_NONE)e.outs=[],e.ins.forEach(function(b,c){c!==a&&(b.sequence=0)});else if((31&c)===f.SIGHASH_SINGLE){if(a>=this.outs.length)return r;e.outs.length=a+1;for(var g=0;g<a;g++)e.outs[g]=t;e.ins.forEach(function(b,c){c!==a&&(b.sequence=0)})}c&f.SIGHASH_ANYONECANPAY?(e.ins=[e.ins[a]],e.ins[0].script=d):(e.ins.forEach(function(a){a.script=o}),e.ins[a].script=d);var j=Buffer.allocUnsafe(e.__byteLength(!1)+4);return j.writeInt32LE(c,j.length-4),e.__toBuffer(j,0,!1),h.hash256(j)},f.prototype.hashForWitnessV0=function(a,b,c,e){function g(a){s+=a.copy(r,s)}function i(a){s=r.writeUInt32LE(a,s)}function k(a){s=j.writeUInt64LE(r,a,s)}function o(a){n.encode(a,r,s),s+=n.encode.bytes}function p(a){o(a.length),g(a)}l(m.tuple(m.UInt32,m.Buffer,m.Satoshi,m.UInt32),arguments);var r,s,t=q,u=q,v=q;if(e&f.SIGHASH_ANYONECANPAY||(r=Buffer.allocUnsafe(36*this.ins.length),s=0,this.ins.forEach(function(a){g(a.hash),i(a.index)}),u=h.hash256(r)),e&f.SIGHASH_ANYONECANPAY||(31&e)===f.SIGHASH_SINGLE||(31&e)===f.SIGHASH_NONE||(r=Buffer.allocUnsafe(4*this.ins.length),s=0,this.ins.forEach(function(a){i(a.sequence)}),v=h.hash256(r)),(31&e)!==f.SIGHASH_SINGLE&&(31&e)!==f.SIGHASH_NONE){var w=this.outs.reduce(function(a,b){return a+8+d(b.script)},0);r=Buffer.allocUnsafe(w),s=0,this.outs.forEach(function(a){k(a.value),p(a.script)}),t=h.hash256(r)}else if((31&e)===f.SIGHASH_SINGLE&&a<this.outs.length){var x=this.outs[a];r=Buffer.allocUnsafe(8+d(x.script)),s=0,k(x.value),p(x.script),t=h.hash256(r)}r=Buffer.allocUnsafe(156+d(b)),s=0;var y=this.ins[a];return i(this.version),g(u),g(v),g(y.hash),i(y.index),p(b),k(c),i(y.sequence),g(t),i(this.locktime),i(e),h.hash256(r)},f.prototype.hashForCashSignature=function(a,b,c,d){if(l(m.tuple(m.UInt32,m.Buffer,m.Number,m.maybe(m.UInt53)),arguments),d&f.SIGHASH_BITCOINCASHBIP143){if(m.Null(c))throw new Error("Bitcoin Cash sighash requires value of input to be signed.");return this.hashForWitnessV0(a,b,c,d)}return this.hashForSignature(a,b,d)},f.prototype.getHash=function(){return h.hash256(this.__toBuffer(void 0,void 0,!1))},f.prototype.getId=function(){return g(this.getHash()).toString("hex")},f.prototype.toBuffer=function(a,b){return this.__toBuffer(a,b,!0)},f.prototype.__toBuffer=function(a,b,c){function d(b){o+=b.copy(a,o)}function e(b){o=a.writeUInt8(b,o)}function g(b){o=a.writeUInt32LE(b,o)}function h(b){o=a.writeInt32LE(b,o)}function i(b){o=j.writeUInt64LE(a,b,o)}function k(b){n.encode(b,a,o),o+=n.encode.bytes}function l(a){k(a.length),d(a)}function m(a){k(a.length),a.forEach(l)}a||(a=Buffer.allocUnsafe(this.__byteLength(c)));var o=b||0;h(this.version);var p=c&&this.hasWitnesses();return p&&(e(f.ADVANCED_TRANSACTION_MARKER),e(f.ADVANCED_TRANSACTION_FLAG)),k(this.ins.length),this.ins.forEach(function(a){d(a.hash),g(a.index),l(a.script),g(a.sequence)}),k(this.outs.length),this.outs.forEach(function(a){a.valueBuffer?d(a.valueBuffer):i(a.value),l(a.script)}),p&&this.ins.forEach(function(a){m(a.witness)}),g(this.locktime),void 0!==b?a.slice(b,o):a},f.prototype.toHex=function(){return this.toBuffer().toString("hex")},f.prototype.setInputScript=function(a,b){l(m.tuple(m.Number,m.Buffer),arguments),this.ins[a].script=b},f.prototype.setWitness=function(a,b){l(m.tuple(m.Number,[m.Buffer]),arguments),this.ins[a].witness=b},b.exports=f},{"./bufferutils":36,"./crypto":37,"./script":44,"./types":70,"bitcoin-ops":32,"buffer-reverse":102,"safe-buffer":288,typeforce:312,"varuint-bitcoin":321}],69:[function(a,b,c){function d(a){return A.indexOf(a)!==-1}function e(a){return B.indexOf(a)!==-1}function f(a,b,c){var d=[],e=[];switch(a){case z.P2PKH:d=b.slice(1),e=b.slice(0,1);break;case z.P2PK:d[0]=c?u.pubKey.output.decode(c):void 0,e=b.slice(0,1);break;case z.MULTISIG:if(c){var f=u.multisig.output.decode(c);d=f.pubKeys}e=b.slice(1).map(function(a){return 0===a.length?void 0:a})}return{pubKeys:d,signatures:e}}function g(a,b){if(0===a.length&&0===b.length)return{};var c,g,h,i,j,k,l,m,n,o,p=!1,q=!1,r=!1,s=u.decompile(a),v=u.classifyInput(s,!0);v===z.P2SH&&(r=!0,j=s[s.length-1],m=u.classifyOutput(j),c=u.scriptHash.output.encode(t.hash160(j)),g=z.P2SH,i=j);var w=u.classifyWitness(b,!0);if(w===z.P2WSH){if(k=b[b.length-1],l=u.classifyOutput(k),q=!0,p=!0,0===a.length){if(c=u.witnessScriptHash.output.encode(t.sha256(k)),g=z.P2WSH,void 0!==j)throw new Error("Redeem script given when unnecessary")}else{if(!j)throw new Error("No redeemScript provided for P2WSH, but scriptSig non-empty");if(n=u.witnessScriptHash.output.encode(t.sha256(k)),!j.equals(n))throw new Error("Redeem script didn't match witnessScript")}if(!d(u.classifyOutput(k)))throw new Error("unsupported witness script");i=k,h=l,o=b.slice(0,-1)}else if(w===z.P2WPKH){p=!0;var x=b[b.length-1],y=t.hash160(x);if(0===a.length){if(c=u.witnessPubKeyHash.output.encode(y),g=z.P2WPKH,"undefined"!=typeof j)throw new Error("Redeem script given when unnecessary")}else{if(!j)throw new Error("No redeemScript provided for P2WPKH, but scriptSig wasn't empty");if(n=u.witnessPubKeyHash.output.encode(y),!j.equals(n))throw new Error("Redeem script did not have the right witness program")}h=z.P2PKH,o=b}else if(j){if(!e(m))throw new Error("Bad redeemscript!");i=j,h=m,o=s.slice(0,-1)}else g=h=u.classifyInput(a),o=s;var A=f(h,o,i),B={pubKeys:A.pubKeys,signatures:A.signatures,prevOutScript:c,prevOutType:g,signType:h,signScript:i,witness:Boolean(p)};return r&&(B.redeemScript=j,B.redeemScriptType=m),q&&(B.witnessScript=k,B.witnessScriptType=l),B}function h(a,b,c,d){if(a.signType===z.MULTISIG&&a.signScript&&a.pubKeys.length!==a.signatures.length){var e=a.signatures.concat();a.signatures=a.pubKeys.map(function(f){var g,h=ECPair.fromPublicKeyBuffer(f);return e.some(function(f,i){if(!f)return!1;var j,k=C.parseScriptSignature(f);return j=d?b.hashForCashSignature(c,a.signScript,a.value,k.hashType):a.witness?b.hashForWitnessV0(c,a.signScript,a.value,k.hashType):b.hashForSignature(c,a.signScript,k.hashType),!!h.verify(j,k.signature)&&(e[i]=void 0,g=f,!0)}),g})}}function i(a,b,c){x(y.Buffer,a);var d=u.decompile(a);b||(b=u.classifyOutput(a));var e=[];switch(b){case z.P2PKH:if(!c)break;var f=d[2],g=t.hash160(c);f.equals(g)&&(e=[c]);break;case z.P2WPKH:if(!c)break;var h=d[1],i=t.hash160(c);h.equals(i)&&(e=[c]);break;case z.P2PK:e=d.slice(0,1);break;case z.MULTISIG:e=d.slice(1,-2);break;default:return{scriptType:b}}return{pubKeys:e,scriptType:b,signatures:e.map(function(){})}}function j(a,b){if(a.prevOutType){if(a.prevOutType!==z.P2SH)throw new Error("PrevOutScript must be P2SH");var c=u.decompile(a.prevOutScript)[1];if(!c.equals(b))throw new Error("Inconsistent hash160(RedeemScript)")}}function k(a,b){if(a.prevOutType){if(a.prevOutType!==z.P2WSH)throw new Error("PrevOutScript must be P2WSH");var c=u.decompile(a.prevOutScript)[1];if(!c.equals(b))throw new Error("Inconsistent sha25(WitnessScript)")}}function l(a,b,c,d,e){var f,g,h,l,m,n,o,p,q,r=!1,s=!1,v=!1;if(c&&e){if(m=t.hash160(c),o=t.sha256(e),j(a,m),!c.equals(u.witnessScriptHash.output.encode(o)))throw new Error("Witness script inconsistent with redeem script");if(f=i(e,void 0,b),!f.pubKeys)throw new Error('WitnessScript not supported "'+u.toASM(c)+'"');g=u.types.P2SH,h=u.scriptHash.output.encode(m),r=s=v=!0,l=u.types.P2WSH,p=n=f.scriptType,q=e}else if(c){if(m=t.hash160(c),j(a,m),f=i(c,void 0,b),!f.pubKeys)throw new Error('RedeemScript not supported "'+u.toASM(c)+'"');g=u.types.P2SH,h=u.scriptHash.output.encode(m),r=!0,p=l=f.scriptType,q=c,s=p===u.types.P2WPKH}else if(e){if(o=t.sha256(e),k(a,o),f=i(e,void 0,b),!f.pubKeys)throw new Error('WitnessScript not supported "'+u.toASM(c)+'"');g=u.types.P2WSH,h=u.witnessScriptHash.output.encode(o),s=v=!0,p=n=f.scriptType,q=e}else if(a.prevOutType){if(a.prevOutType===z.P2SH||a.prevOutType===z.P2WSH)throw new Error("PrevOutScript is "+a.prevOutType+", requires redeemScript");if(g=a.prevOutType,h=a.prevOutScript,f=i(a.prevOutScript,a.prevOutType,b),!f.pubKeys)return;s=a.prevOutType===z.P2WPKH,p=g,q=h}else h=u.pubKeyHash.output.encode(t.hash160(b)),f=i(h,z.P2PKH,b),g=z.P2PKH,s=!1,p=g,q=h;if(void 0!==d||s){if(x(y.Satoshi,d),void 0!==a.value&&a.value!==d)throw new Error("Input didn't match witnessValue");a.value=d}p===z.P2WPKH&&(q=u.pubKeyHash.output.encode(u.witnessPubKeyHash.output.decode(q))),r&&(a.redeemScript=c,a.redeemScriptType=l),v&&(a.witnessScript=e,a.witnessScriptType=n),a.pubKeys=f.pubKeys,a.signatures=f.signatures,a.signScript=q,a.signType=p,a.prevOutScript=h,a.prevOutType=g,a.witness=s}function m(a,b,c,d){if(a===z.P2PKH){if(1===b.length&&Buffer.isBuffer(b[0])&&1===c.length)return u.pubKeyHash.input.encodeStack(b[0],c[0])}else if(a===z.P2PK){if(1===b.length&&Buffer.isBuffer(b[0]))return u.pubKey.input.encodeStack(b[0])}else{if(a!==z.MULTISIG)throw new Error("Not yet supported");if(b.length>0)return b=b.map(function(a){return a||w.OP_0}),d||(b=b.filter(function(a){return a!==w.OP_0})),u.multisig.input.encodeStack(b)}if(!d)throw new Error("Not enough signatures provided");return[]}function n(a,b){var c=a.prevOutType,f=[],g=[];d(c)&&(f=m(c,a.signatures,a.pubKeys,b));var h=!1;if(c===u.types.P2SH){if(!b&&!e(a.redeemScriptType))throw new Error("Impossible to sign this type");d(a.redeemScriptType)&&(f=m(a.redeemScriptType,a.signatures,a.pubKeys,b)),a.redeemScriptType&&(h=!0,c=a.redeemScriptType)}switch(c){case u.types.P2WPKH:g=m(u.types.P2PKH,a.signatures,a.pubKeys,b);break;case u.types.P2WSH:if(!b&&!d(a.witnessScriptType))throw new Error("Impossible to sign this type");d(a.witnessScriptType)&&(g=m(a.witnessScriptType,a.signatures,a.pubKeys,b),g.push(a.witnessScript),c=a.witnessScriptType)}return h&&f.push(a.redeemScript),{type:c,script:u.compile(f),witness:g}}function o(a,b){this.prevTxMap={},this.network=a||v.bitcoin,this.maximumFeeRate=b||1e3,this.inputs=[],this.bitcoinCash=!1,this.tx=new D}function p(a){return void 0!==a.prevOutScript&&void 0!==a.signScript&&void 0!==a.pubKeys&&void 0!==a.signatures&&a.signatures.length===a.pubKeys.length&&a.pubKeys.length>0&&void 0!==a.witness}function q(a){return a.readUInt8(a.length-1)}var Buffer=a("safe-buffer").Buffer,r=a("buffer-reverse"),s=a("./address"),t=a("./crypto"),u=a("./script"),v=a("./networks"),w=a("bitcoin-ops"),x=a("typeforce"),y=a("./types"),z=u.types,A=[u.types.P2PKH,u.types.P2PK,u.types.MULTISIG],B=A.concat([u.types.P2WPKH,u.types.P2WSH]),ECPair=a("./ecpair"),C=a("./ecsignature"),D=a("./transaction");o.prototype.enableBitcoinCash=function(a){"undefined"==typeof a&&(a=!0),this.bitcoinCash=a},o.prototype.setLockTime=function(a){if(x(y.UInt32,a),this.inputs.some(function(a){return!!a.signatures&&a.signatures.some(function(a){return a})}))throw new Error("No, this would invalidate signatures");this.tx.locktime=a},o.prototype.setVersion=function(a){x(y.UInt32,a),this.tx.version=a},o.fromTransaction=function(a,b,c){var d=new o(b);return d.enableBitcoinCash(Boolean(c)),d.setVersion(a.version),d.setLockTime(a.locktime),a.outs.forEach(function(a){d.addOutput(a.script,a.value)}),a.ins.forEach(function(a){d.__addInputUnsafe(a.hash,a.index,{sequence:a.sequence,script:a.script,value:a.value,witness:a.witness})}),d.inputs.forEach(function(b,d){h(b,a,d,c)}),d},o.prototype.addInput=function(a,b,c,d){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");var e;if("string"==typeof a)a=r(Buffer.from(a,"hex"));else if(a instanceof D){var f=a.outs[b];d=f.script,e=f.value,a=a.getHash()}return this.__addInputUnsafe(a,b,{sequence:c,prevOutScript:d,value:e})},o.prototype.__addInputUnsafe=function(a,b,c){if(D.isCoinbaseHash(a))throw new Error("coinbase inputs not supported");var d=a.toString("hex")+":"+b;if(void 0!==this.prevTxMap[d])throw new Error("Duplicate TxOut: "+d);var e={};if(void 0!==c.script&&(e=g(c.script,c.witness||[])),void 0!==c.value&&(e.value=c.value),!e.prevOutScript&&c.prevOutScript){var f;if(!e.pubKeys&&!e.signatures){var h=i(c.prevOutScript);h.pubKeys&&(e.pubKeys=h.pubKeys,e.signatures=h.signatures),f=h.scriptType}e.prevOutScript=c.prevOutScript,e.prevOutType=f||u.classifyOutput(c.prevOutScript)}var j=this.tx.addInput(a,b,c.sequence,c.scriptSig);return this.inputs[j]=e,this.prevTxMap[d]=j,j},o.prototype.addOutput=function(a,b){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof a&&(a=s.toOutputScript(a,this.network)),this.tx.addOutput(a,b)},o.prototype.build=function(){return this.__build(!1)},o.prototype.buildIncomplete=function(){return this.__build(!0)},o.prototype.__build=function(a){if(!a){if(!this.tx.ins.length)throw new Error("Transaction has no inputs");if(!this.tx.outs.length)throw new Error("Transaction has no outputs")}var b=this.tx.clone();if(this.inputs.forEach(function(c,e){var f=c.witnessScriptType||c.redeemScriptType||c.prevOutType;if(!f&&!a)throw new Error("Transaction is not complete");var g=n(c,a);if(!a&&!d(g.type)&&g.type!==u.types.P2WPKH)throw new Error(g.type+" not supported");b.setInputScript(e,g.script),b.setWitness(e,g.witness)}),!a&&this.__overMaximumFees(b.virtualSize()))throw new Error("Transaction has absurd fees");return b},o.prototype.sign=function(a,b,c,d,e,f){if(b.network!==this.network)throw new Error("Inconsistent network");if(!this.inputs[a])throw new Error("No input at index: "+a);d=d||D.SIGHASH_ALL;var g=this.inputs[a];if(void 0!==g.redeemScript&&c&&!g.redeemScript.equals(c))throw new Error("Inconsistent redeemScript");var h=b.getPublicKeyBuffer();if(!p(g)&&(l(g,h,c,e,f),!p(g)))throw Error(g.prevOutType+" not supported");var i;i=this.bitcoinCash?this.tx.hashForCashSignature(a,g.signScript,e,d):g.witness?this.tx.hashForWitnessV0(a,g.signScript,e,d):this.tx.hashForSignature(a,g.signScript,d);var j=g.pubKeys.some(function(a,c){if(!h.equals(a))return!1;if(g.signatures[c])throw new Error("Signature already exists");if(!b.compressed&&g.signType===z.P2WPKH)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");return g.signatures[c]=b.sign(i).toScriptSignature(d),!0});if(!j)throw new Error("Key pair cannot sign for this input")},o.prototype.__canModifyInputs=function(){return this.inputs.every(function(a){return void 0===a.signatures||a.signatures.every(function(a){if(!a)return!0;var b=q(a);return b&D.SIGHASH_ANYONECANPAY})})},o.prototype.__canModifyOutputs=function(){var a=this.tx.ins.length,b=this.tx.outs.length;return this.inputs.every(function(c){return void 0===c.signatures||c.signatures.every(function(c){if(!c)return!0;var d=q(c),e=31&d;return e===D.SIGHASH_NONE||(e===D.SIGHASH_SINGLE?a<=b:void 0)})})},o.prototype.__overMaximumFees=function(a){var b=this.inputs.reduce(function(a,b){return a+(b.value>>>0)},0),c=this.tx.outs.reduce(function(a,b){return a+b.value},0),d=b-c,e=d/a;return e>this.maximumFeeRate},b.exports=o},{"./address":34,"./crypto":37,"./ecpair":39,"./ecsignature":40,"./networks":43,"./script":44,"./transaction":68,"./types":70,"bitcoin-ops":32,"buffer-reverse":102,"safe-buffer":288,typeforce:312}],70:[function(a,b,c){function d(a){return g.UInt32(a)&&a<=h}function e(a){return g.String(a)&&a.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function f(a){return g.UInt53(a)&&a<=i}var g=a("typeforce"),h=Math.pow(2,31)-1;e.toJSON=function(){return"BIP32 derivation path"};var i=21e14,j=g.quacksLike("BigInteger"),k=g.quacksLike("Point"),l=g.compile({r:j,s:j}),m=g.compile({messagePrefix:g.oneOf(g.Buffer,g.String),bip32:{public:g.UInt32,private:g.UInt32},pubKeyHash:g.UInt8,scriptHash:g.UInt8,wif:g.UInt8}),n={BigInt:j,BIP32Path:e,Buffer256bit:g.BufferN(32),ECPoint:k,ECSignature:l,Hash160bit:g.BufferN(20),Hash256bit:g.BufferN(32),Network:m,Satoshi:f,UInt31:d};for(var o in g)n[o]=g[o];b.exports=n},{typeforce:312}],71:[function(a,b,c){(function(Buffer){function c(a){var b=l("sha256").update(a).digest();return l("sha256").update(b).digest()}function d(a){var b=l("sha256").update(a).digest();return l("ripemd160").update(b).digest()}function e(a,b,c){return c&&(b+=4),Buffer.concat([new Buffer([b+27]),a])}function f(a){if(65!==a.length)throw new Error("Invalid signature length");var b=a.readUInt8(0)-27;if(b>7)throw new Error("Invalid signature parameter");return{compressed:!!(4&b),recovery:3&b,signature:a.slice(1)}}function g(a,b){var d=n.encodingLength(a.length),e=new Buffer(b.length+d+a.length);return e.write(b,0),n.encode(a.length,e,b.length),e.write(a,b.length+d),c(e)}function h(a,b,c,d){var f=g(a,b),h=m.sign(f,c);return e(h.signature,h.recovery,d)}function i(a,b,c,e){Buffer.isBuffer(e)||(e=new Buffer(e,"base64"));var h=f(e),i=g(a,b),l=m.recover(i,h.signature,h.recovery,h.compressed),n=d(l),o=j.decode(c).slice(1);return k(n,o)}var j=a("bs58check"),k=a("buffer-equals"),l=a("create-hash"),m=a("secp256k1"),n=a("varuint-bitcoin");b.exports={magicHash:g,sign:h,verify:i}}).call(this,a("buffer").Buffer)},{bs58check:74,buffer:104,"buffer-equals":101,"create-hash":110,secp256k1:289,"varuint-bitcoin":321}],72:[function(a,b,c){b.exports=function(a){function b(b){if(0===b.length)return"";for(var c=[0],d=0;d<b.length;++d){for(var e=0,g=b[d];e<c.length;++e)g+=c[e]<<8,c[e]=g%f,g=g/f|0;for(;g>0;)c.push(g%f),g=g/f|0}for(var h="",i=0;0===b[i]&&i<b.length-1;++i)h+=a[0];for(var j=c.length-1;j>=0;--j)h+=a[c[j]];return h}function c(a){if(0===a.length)return[];for(var b=[0],c=0;c<a.length;c++){var d=e[a[c]];if(void 0===d)return;for(var h=0,i=d;h<b.length;++h)i+=b[h]*f,b[h]=255&i,i>>=8;for(;i>0;)b.push(255&i),i>>=8}for(var j=0;a[j]===g&&j<a.length-1;++j)b.push(0);return b.reverse()}function d(a){var b=c(a);if(b)return b;throw new Error("Non-base"+f+" character")}for(var e={},f=a.length,g=a.charAt(0),h=0;h<a.length;h++)e[a.charAt(h)]=h;return{encode:b,decodeUnsafe:c,decode:d}}},{}],73:[function(a,b,c){var d=a("base-x"),e="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";b.exports=d(e)},{"base-x":72}],74:[function(a,b,c){(function(Buffer){"use strict";function c(a){var b=i("sha256").update(a).digest();return i("sha256").update(b).digest()}function d(a){var b=c(a);return h.encode(Buffer.concat([a,b],a.length+4))}function e(a){var b=a.slice(0,-4),d=a.slice(-4),e=c(b);if(!(d[0]^e[0]|d[1]^e[1]|d[2]^e[2]|d[3]^e[3]))return b}function f(a){var b=h.decodeUnsafe(a);if(b){var c=new Buffer(b);return e(c)}}function g(a){var b=h.decode(a),c=new Buffer(b),d=e(c);if(!d)throw new Error("Invalid checksum");return d}var h=a("bs58"),i=a("create-hash");b.exports={encode:d,decode:g,decodeUnsafe:f,decodeRaw:f}}).call(this,a("buffer").Buffer)},{bs58:73,buffer:104,"create-hash":110}],75:[function(a,b,c){!function(b,c){"use strict";function d(a,b){if(!a)throw new Error(b||"Assertion failed")}function e(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}function f(a,b,c){return f.isBN(a)?a:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==a&&("le"!==b&&"be"!==b||(c=b,b=10),this._init(a||0,b||10,c||"be"))))}function g(a,b,c){for(var d=0,e=Math.min(a.length,c),f=b;f<e;f++){var g=a.charCodeAt(f)-48;d<<=4,d|=g>=49&&g<=54?g-49+10:g>=17&&g<=22?g-17+10:15&g}return d}function h(a,b,c,d){for(var e=0,f=Math.min(a.length,c),g=b;g<f;g++){var h=a.charCodeAt(g)-48;e*=d,e+=h>=49?h-49+10:h>=17?h-17+10:h}return e}function i(a){for(var b=new Array(a.bitLength()),c=0;c<b.length;c++){var d=c/26|0,e=c%26;b[c]=(a.words[d]&1<<e)>>>e}return b}function j(a,b,c){c.negative=b.negative^a.negative;var d=a.length+b.length|0;c.length=d,d=d-1|0;var e=0|a.words[0],f=0|b.words[0],g=e*f,h=67108863&g,i=g/67108864|0;c.words[0]=h;for(var j=1;j<d;j++){for(var k=i>>>26,l=67108863&i,m=Math.min(j,b.length-1),n=Math.max(0,j-a.length+1);n<=m;n++){var o=j-n|0;e=0|a.words[o],f=0|b.words[n],g=e*f+l,k+=g/67108864|0,l=67108863&g}c.words[j]=0|l,i=0|k}return 0!==i?c.words[j]=0|i:c.length--,c.strip()}function k(a,b,c){c.negative=b.negative^a.negative,c.length=a.length+b.length;for(var d=0,e=0,f=0;f<c.length-1;f++){var g=e;e=0;for(var h=67108863&d,i=Math.min(f,b.length-1),j=Math.max(0,f-a.length+1);j<=i;j++){var k=f-j,l=0|a.words[k],m=0|b.words[j],n=l*m,o=67108863&n;g=g+(n/67108864|0)|0,o=o+h|0,h=67108863&o,g=g+(o>>>26)|0,e+=g>>>26,g&=67108863}c.words[f]=h,d=g,g=e}return 0!==d?c.words[f]=d:c.length--,c.strip()}function l(a,b,c){var d=new m;return d.mulp(a,b,c)}function m(a,b){this.x=a,this.y=b}function n(a,b){this.name=a,this.p=new f(b,16),this.n=this.p.bitLength(),this.k=new f(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function o(){n.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){n.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function q(){n.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function r(){n.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function s(a){if("string"==typeof a){var b=f._prime(a);this.m=b.p,this.prime=b}else d(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}function t(a){s.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new f(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof b?b.exports=f:c.BN=f,f.BN=f,f.wordSize=26;var Buffer;try{Buffer=a("buffer").Buffer}catch(a){}f.isBN=function(a){return a instanceof f||null!==a&&"object"==typeof a&&a.constructor.wordSize===f.wordSize&&Array.isArray(a.words)},f.max=function(a,b){return a.cmp(b)>0?a:b},f.min=function(a,b){return a.cmp(b)<0?a:b},f.prototype._init=function(a,b,c){if("number"==typeof a)return this._initNumber(a,b,c);if("object"==typeof a)return this._initArray(a,b,c);"hex"===b&&(b=16),d(b===(0|b)&&b>=2&&b<=36),a=a.toString().replace(/\s+/g,"");var e=0;"-"===a[0]&&e++,16===b?this._parseHex(a,e):this._parseBase(a,b,e),"-"===a[0]&&(this.negative=1),this.strip(),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initNumber=function(a,b,c){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[67108863&a],this.length=1):a<4503599627370496?(this.words=[67108863&a,a/67108864&67108863],this.length=2):(d(a<9007199254740992),this.words=[67108863&a,a/67108864&67108863,1],this.length=3),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initArray=function(a,b,c){if(d("number"==typeof a.length),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;var f,g,h=0;if("be"===c)for(e=a.length-1,f=0;e>=0;e-=3)g=a[e]|a[e-1]<<8|a[e-2]<<16,this.words[f]|=g<<h&67108863,this.words[f+1]=g>>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);else if("le"===c)for(e=0,f=0;e<a.length;e+=3)g=a[e]|a[e+1]<<8|a[e+2]<<16,this.words[f]|=g<<h&67108863,this.words[f+1]=g>>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);return this.strip()},f.prototype._parseHex=function(a,b){this.length=Math.ceil((a.length-b)/6),this.words=new Array(this.length);for(var c=0;c<this.length;c++)this.words[c]=0;var d,e,f=0;for(c=a.length-6,d=0;c>=b;c-=6)e=g(a,c,c+6),this.words[d]|=e<<f&67108863,this.words[d+1]|=e>>>26-f&4194303,f+=24,f>=26&&(f-=26,d++);c+6!==b&&(e=g(a,b,c+6),this.words[d]|=e<<f&67108863,this.words[d+1]|=e>>>26-f&4194303),this.strip()},f.prototype._parseBase=function(a,b,c){this.words=[0],this.length=1;for(var d=0,e=1;e<=67108863;e*=b)d++;d--,e=e/b|0;for(var f=a.length-c,g=f%d,i=Math.min(f,f-g)+c,j=0,k=c;k<i;k+=d)j=h(a,k,k+d,b),this.imuln(e),this.words[0]+j<67108864?this.words[0]+=j:this._iaddn(j);if(0!==g){var l=1;for(j=h(a,k,a.length,b),k=0;k<g;k++)l*=b;this.imuln(l),this.words[0]+j<67108864?this.words[0]+=j:this._iaddn(j)}},f.prototype.copy=function(a){a.words=new Array(this.length);for(var b=0;b<this.length;b++)a.words[b]=this.words[b];a.length=this.length,a.negative=this.negative,a.red=this.red},f.prototype.clone=function(){var a=new f(null);return this.copy(a),a},f.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},f.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},f.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},f.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];f.prototype.toString=function(a,b){a=a||10,b=0|b||1;var c;if(16===a||"hex"===a){c="";for(var e=0,f=0,g=0;g<this.length;g++){var h=this.words[g],i=(16777215&(h<<e|f)).toString(16);f=h>>>24-e&16777215,c=0!==f||g!==this.length-1?u[6-i.length]+i+c:i+c,e+=2,e>=26&&(e-=26,g--)}for(0!==f&&(c=f.toString(16)+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(a===(0|a)&&a>=2&&a<=36){var j=v[a],k=w[a];c="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modn(k).toString(a);l=l.idivn(k),c=l.isZero()?m+c:u[j-m.length]+m+c}for(this.isZero()&&(c="0"+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}d(!1,"Base should be between 2 and 36")},f.prototype.toNumber=function(){var a=this.words[0];return 2===this.length?a+=67108864*this.words[1]:3===this.length&&1===this.words[2]?a+=4503599627370496+67108864*this.words[1]:this.length>2&&d(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-a:a},f.prototype.toJSON=function(){return this.toString(16)},f.prototype.toBuffer=function(a,b){return d("undefined"!=typeof Buffer),this.toArrayLike(Buffer,a,b)},f.prototype.toArray=function(a,b){return this.toArrayLike(Array,a,b)},f.prototype.toArrayLike=function(a,b,c){var e=this.byteLength(),f=c||Math.max(1,e);d(e<=f,"byte array longer than desired length"),d(f>0,"Requested array length <= 0"),this.strip();var g,h,i="le"===b,j=new a(f),k=this.clone();if(i){for(h=0;!k.isZero();h++)g=k.andln(255),
8
k.iushrn(8),j[h]=g;for(;h<f;h++)j[h]=0}else{for(h=0;h<f-e;h++)j[h]=0;for(h=0;!k.isZero();h++)g=k.andln(255),k.iushrn(8),j[f-h-1]=g}return j},Math.clz32?f.prototype._countBits=function(a){return 32-Math.clz32(a)}:f.prototype._countBits=function(a){var b=a,c=0;return b>=4096&&(c+=13,b>>>=13),b>=64&&(c+=7,b>>>=7),b>=8&&(c+=4,b>>>=4),b>=2&&(c+=2,b>>>=2),c+b},f.prototype._zeroBits=function(a){if(0===a)return 26;var b=a,c=0;return 0===(8191&b)&&(c+=13,b>>>=13),0===(127&b)&&(c+=7,b>>>=7),0===(15&b)&&(c+=4,b>>>=4),0===(3&b)&&(c+=2,b>>>=2),0===(1&b)&&c++,c},f.prototype.bitLength=function(){var a=this.words[this.length-1],b=this._countBits(a);return 26*(this.length-1)+b},f.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,b=0;b<this.length;b++){var c=this._zeroBits(this.words[b]);if(a+=c,26!==c)break}return a},f.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},f.prototype.toTwos=function(a){return 0!==this.negative?this.abs().inotn(a).iaddn(1):this.clone()},f.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},f.prototype.isNeg=function(){return 0!==this.negative},f.prototype.neg=function(){return this.clone().ineg()},f.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},f.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var b=0;b<a.length;b++)this.words[b]=this.words[b]|a.words[b];return this.strip()},f.prototype.ior=function(a){return d(0===(this.negative|a.negative)),this.iuor(a)},f.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},f.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},f.prototype.iuand=function(a){var b;b=this.length>a.length?a:this;for(var c=0;c<b.length;c++)this.words[c]=this.words[c]&a.words[c];return this.length=b.length,this.strip()},f.prototype.iand=function(a){return d(0===(this.negative|a.negative)),this.iuand(a)},f.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},f.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},f.prototype.iuxor=function(a){var b,c;this.length>a.length?(b=this,c=a):(b=a,c=this);for(var d=0;d<c.length;d++)this.words[d]=b.words[d]^c.words[d];if(this!==b)for(;d<b.length;d++)this.words[d]=b.words[d];return this.length=b.length,this.strip()},f.prototype.ixor=function(a){return d(0===(this.negative|a.negative)),this.iuxor(a)},f.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},f.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},f.prototype.inotn=function(a){d("number"==typeof a&&a>=0);var b=0|Math.ceil(a/26),c=a%26;this._expand(b),c>0&&b--;for(var e=0;e<b;e++)this.words[e]=67108863&~this.words[e];return c>0&&(this.words[e]=~this.words[e]&67108863>>26-c),this.strip()},f.prototype.notn=function(a){return this.clone().inotn(a)},f.prototype.setn=function(a,b){d("number"==typeof a&&a>=0);var c=a/26|0,e=a%26;return this._expand(c+1),b?this.words[c]=this.words[c]|1<<e:this.words[c]=this.words[c]&~(1<<e),this.strip()},f.prototype.iadd=function(a){var b;if(0!==this.negative&&0===a.negative)return this.negative=0,b=this.isub(a),this.negative^=1,this._normSign();if(0===this.negative&&0!==a.negative)return a.negative=0,b=this.isub(a),a.negative=1,b._normSign();var c,d;this.length>a.length?(c=this,d=a):(c=a,d=this);for(var e=0,f=0;f<d.length;f++)b=(0|c.words[f])+(0|d.words[f])+e,this.words[f]=67108863&b,e=b>>>26;for(;0!==e&&f<c.length;f++)b=(0|c.words[f])+e,this.words[f]=67108863&b,e=b>>>26;if(this.length=c.length,0!==e)this.words[this.length]=e,this.length++;else if(c!==this)for(;f<c.length;f++)this.words[f]=c.words[f];return this},f.prototype.add=function(a){var b;return 0!==a.negative&&0===this.negative?(a.negative=0,b=this.sub(a),a.negative^=1,b):0===a.negative&&0!==this.negative?(this.negative=0,b=a.sub(this),this.negative=1,b):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},f.prototype.isub=function(a){if(0!==a.negative){a.negative=0;var b=this.iadd(a);return a.negative=1,b._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var c=this.cmp(a);if(0===c)return this.negative=0,this.length=1,this.words[0]=0,this;var d,e;c>0?(d=this,e=a):(d=a,e=this);for(var f=0,g=0;g<e.length;g++)b=(0|d.words[g])-(0|e.words[g])+f,f=b>>26,this.words[g]=67108863&b;for(;0!==f&&g<d.length;g++)b=(0|d.words[g])+f,f=b>>26,this.words[g]=67108863&b;if(0===f&&g<d.length&&d!==this)for(;g<d.length;g++)this.words[g]=d.words[g];return this.length=Math.max(this.length,g),d!==this&&(this.negative=1),this.strip()},f.prototype.sub=function(a){return this.clone().isub(a)};var x=function(a,b,c){var d,e,f,g=a.words,h=b.words,i=c.words,j=0,k=0|g[0],l=8191&k,m=k>>>13,n=0|g[1],o=8191&n,p=n>>>13,q=0|g[2],r=8191&q,s=q>>>13,t=0|g[3],u=8191&t,v=t>>>13,w=0|g[4],x=8191&w,y=w>>>13,z=0|g[5],A=8191&z,B=z>>>13,C=0|g[6],D=8191&C,E=C>>>13,F=0|g[7],G=8191&F,H=F>>>13,I=0|g[8],J=8191&I,K=I>>>13,L=0|g[9],M=8191&L,N=L>>>13,O=0|h[0],P=8191&O,Q=O>>>13,R=0|h[1],S=8191&R,T=R>>>13,U=0|h[2],V=8191&U,W=U>>>13,X=0|h[3],Y=8191&X,Z=X>>>13,$=0|h[4],_=8191&$,aa=$>>>13,ba=0|h[5],ca=8191&ba,da=ba>>>13,ea=0|h[6],fa=8191&ea,ga=ea>>>13,ha=0|h[7],ia=8191&ha,ja=ha>>>13,ka=0|h[8],la=8191&ka,ma=ka>>>13,na=0|h[9],oa=8191&na,pa=na>>>13;c.negative=a.negative^b.negative,c.length=19,d=Math.imul(l,P),e=Math.imul(l,Q),e=e+Math.imul(m,P)|0,f=Math.imul(m,Q);var qa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(qa>>>26)|0,qa&=67108863,d=Math.imul(o,P),e=Math.imul(o,Q),e=e+Math.imul(p,P)|0,f=Math.imul(p,Q),d=d+Math.imul(l,S)|0,e=e+Math.imul(l,T)|0,e=e+Math.imul(m,S)|0,f=f+Math.imul(m,T)|0;var ra=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ra>>>26)|0,ra&=67108863,d=Math.imul(r,P),e=Math.imul(r,Q),e=e+Math.imul(s,P)|0,f=Math.imul(s,Q),d=d+Math.imul(o,S)|0,e=e+Math.imul(o,T)|0,e=e+Math.imul(p,S)|0,f=f+Math.imul(p,T)|0,d=d+Math.imul(l,V)|0,e=e+Math.imul(l,W)|0,e=e+Math.imul(m,V)|0,f=f+Math.imul(m,W)|0;var sa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(sa>>>26)|0,sa&=67108863,d=Math.imul(u,P),e=Math.imul(u,Q),e=e+Math.imul(v,P)|0,f=Math.imul(v,Q),d=d+Math.imul(r,S)|0,e=e+Math.imul(r,T)|0,e=e+Math.imul(s,S)|0,f=f+Math.imul(s,T)|0,d=d+Math.imul(o,V)|0,e=e+Math.imul(o,W)|0,e=e+Math.imul(p,V)|0,f=f+Math.imul(p,W)|0,d=d+Math.imul(l,Y)|0,e=e+Math.imul(l,Z)|0,e=e+Math.imul(m,Y)|0,f=f+Math.imul(m,Z)|0;var ta=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ta>>>26)|0,ta&=67108863,d=Math.imul(x,P),e=Math.imul(x,Q),e=e+Math.imul(y,P)|0,f=Math.imul(y,Q),d=d+Math.imul(u,S)|0,e=e+Math.imul(u,T)|0,e=e+Math.imul(v,S)|0,f=f+Math.imul(v,T)|0,d=d+Math.imul(r,V)|0,e=e+Math.imul(r,W)|0,e=e+Math.imul(s,V)|0,f=f+Math.imul(s,W)|0,d=d+Math.imul(o,Y)|0,e=e+Math.imul(o,Z)|0,e=e+Math.imul(p,Y)|0,f=f+Math.imul(p,Z)|0,d=d+Math.imul(l,_)|0,e=e+Math.imul(l,aa)|0,e=e+Math.imul(m,_)|0,f=f+Math.imul(m,aa)|0;var ua=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ua>>>26)|0,ua&=67108863,d=Math.imul(A,P),e=Math.imul(A,Q),e=e+Math.imul(B,P)|0,f=Math.imul(B,Q),d=d+Math.imul(x,S)|0,e=e+Math.imul(x,T)|0,e=e+Math.imul(y,S)|0,f=f+Math.imul(y,T)|0,d=d+Math.imul(u,V)|0,e=e+Math.imul(u,W)|0,e=e+Math.imul(v,V)|0,f=f+Math.imul(v,W)|0,d=d+Math.imul(r,Y)|0,e=e+Math.imul(r,Z)|0,e=e+Math.imul(s,Y)|0,f=f+Math.imul(s,Z)|0,d=d+Math.imul(o,_)|0,e=e+Math.imul(o,aa)|0,e=e+Math.imul(p,_)|0,f=f+Math.imul(p,aa)|0,d=d+Math.imul(l,ca)|0,e=e+Math.imul(l,da)|0,e=e+Math.imul(m,ca)|0,f=f+Math.imul(m,da)|0;var va=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(va>>>26)|0,va&=67108863,d=Math.imul(D,P),e=Math.imul(D,Q),e=e+Math.imul(E,P)|0,f=Math.imul(E,Q),d=d+Math.imul(A,S)|0,e=e+Math.imul(A,T)|0,e=e+Math.imul(B,S)|0,f=f+Math.imul(B,T)|0,d=d+Math.imul(x,V)|0,e=e+Math.imul(x,W)|0,e=e+Math.imul(y,V)|0,f=f+Math.imul(y,W)|0,d=d+Math.imul(u,Y)|0,e=e+Math.imul(u,Z)|0,e=e+Math.imul(v,Y)|0,f=f+Math.imul(v,Z)|0,d=d+Math.imul(r,_)|0,e=e+Math.imul(r,aa)|0,e=e+Math.imul(s,_)|0,f=f+Math.imul(s,aa)|0,d=d+Math.imul(o,ca)|0,e=e+Math.imul(o,da)|0,e=e+Math.imul(p,ca)|0,f=f+Math.imul(p,da)|0,d=d+Math.imul(l,fa)|0,e=e+Math.imul(l,ga)|0,e=e+Math.imul(m,fa)|0,f=f+Math.imul(m,ga)|0;var wa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(wa>>>26)|0,wa&=67108863,d=Math.imul(G,P),e=Math.imul(G,Q),e=e+Math.imul(H,P)|0,f=Math.imul(H,Q),d=d+Math.imul(D,S)|0,e=e+Math.imul(D,T)|0,e=e+Math.imul(E,S)|0,f=f+Math.imul(E,T)|0,d=d+Math.imul(A,V)|0,e=e+Math.imul(A,W)|0,e=e+Math.imul(B,V)|0,f=f+Math.imul(B,W)|0,d=d+Math.imul(x,Y)|0,e=e+Math.imul(x,Z)|0,e=e+Math.imul(y,Y)|0,f=f+Math.imul(y,Z)|0,d=d+Math.imul(u,_)|0,e=e+Math.imul(u,aa)|0,e=e+Math.imul(v,_)|0,f=f+Math.imul(v,aa)|0,d=d+Math.imul(r,ca)|0,e=e+Math.imul(r,da)|0,e=e+Math.imul(s,ca)|0,f=f+Math.imul(s,da)|0,d=d+Math.imul(o,fa)|0,e=e+Math.imul(o,ga)|0,e=e+Math.imul(p,fa)|0,f=f+Math.imul(p,ga)|0,d=d+Math.imul(l,ia)|0,e=e+Math.imul(l,ja)|0,e=e+Math.imul(m,ia)|0,f=f+Math.imul(m,ja)|0;var xa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(xa>>>26)|0,xa&=67108863,d=Math.imul(J,P),e=Math.imul(J,Q),e=e+Math.imul(K,P)|0,f=Math.imul(K,Q),d=d+Math.imul(G,S)|0,e=e+Math.imul(G,T)|0,e=e+Math.imul(H,S)|0,f=f+Math.imul(H,T)|0,d=d+Math.imul(D,V)|0,e=e+Math.imul(D,W)|0,e=e+Math.imul(E,V)|0,f=f+Math.imul(E,W)|0,d=d+Math.imul(A,Y)|0,e=e+Math.imul(A,Z)|0,e=e+Math.imul(B,Y)|0,f=f+Math.imul(B,Z)|0,d=d+Math.imul(x,_)|0,e=e+Math.imul(x,aa)|0,e=e+Math.imul(y,_)|0,f=f+Math.imul(y,aa)|0,d=d+Math.imul(u,ca)|0,e=e+Math.imul(u,da)|0,e=e+Math.imul(v,ca)|0,f=f+Math.imul(v,da)|0,d=d+Math.imul(r,fa)|0,e=e+Math.imul(r,ga)|0,e=e+Math.imul(s,fa)|0,f=f+Math.imul(s,ga)|0,d=d+Math.imul(o,ia)|0,e=e+Math.imul(o,ja)|0,e=e+Math.imul(p,ia)|0,f=f+Math.imul(p,ja)|0,d=d+Math.imul(l,la)|0,e=e+Math.imul(l,ma)|0,e=e+Math.imul(m,la)|0,f=f+Math.imul(m,ma)|0;var ya=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ya>>>26)|0,ya&=67108863,d=Math.imul(M,P),e=Math.imul(M,Q),e=e+Math.imul(N,P)|0,f=Math.imul(N,Q),d=d+Math.imul(J,S)|0,e=e+Math.imul(J,T)|0,e=e+Math.imul(K,S)|0,f=f+Math.imul(K,T)|0,d=d+Math.imul(G,V)|0,e=e+Math.imul(G,W)|0,e=e+Math.imul(H,V)|0,f=f+Math.imul(H,W)|0,d=d+Math.imul(D,Y)|0,e=e+Math.imul(D,Z)|0,e=e+Math.imul(E,Y)|0,f=f+Math.imul(E,Z)|0,d=d+Math.imul(A,_)|0,e=e+Math.imul(A,aa)|0,e=e+Math.imul(B,_)|0,f=f+Math.imul(B,aa)|0,d=d+Math.imul(x,ca)|0,e=e+Math.imul(x,da)|0,e=e+Math.imul(y,ca)|0,f=f+Math.imul(y,da)|0,d=d+Math.imul(u,fa)|0,e=e+Math.imul(u,ga)|0,e=e+Math.imul(v,fa)|0,f=f+Math.imul(v,ga)|0,d=d+Math.imul(r,ia)|0,e=e+Math.imul(r,ja)|0,e=e+Math.imul(s,ia)|0,f=f+Math.imul(s,ja)|0,d=d+Math.imul(o,la)|0,e=e+Math.imul(o,ma)|0,e=e+Math.imul(p,la)|0,f=f+Math.imul(p,ma)|0,d=d+Math.imul(l,oa)|0,e=e+Math.imul(l,pa)|0,e=e+Math.imul(m,oa)|0,f=f+Math.imul(m,pa)|0;var za=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(za>>>26)|0,za&=67108863,d=Math.imul(M,S),e=Math.imul(M,T),e=e+Math.imul(N,S)|0,f=Math.imul(N,T),d=d+Math.imul(J,V)|0,e=e+Math.imul(J,W)|0,e=e+Math.imul(K,V)|0,f=f+Math.imul(K,W)|0,d=d+Math.imul(G,Y)|0,e=e+Math.imul(G,Z)|0,e=e+Math.imul(H,Y)|0,f=f+Math.imul(H,Z)|0,d=d+Math.imul(D,_)|0,e=e+Math.imul(D,aa)|0,e=e+Math.imul(E,_)|0,f=f+Math.imul(E,aa)|0,d=d+Math.imul(A,ca)|0,e=e+Math.imul(A,da)|0,e=e+Math.imul(B,ca)|0,f=f+Math.imul(B,da)|0,d=d+Math.imul(x,fa)|0,e=e+Math.imul(x,ga)|0,e=e+Math.imul(y,fa)|0,f=f+Math.imul(y,ga)|0,d=d+Math.imul(u,ia)|0,e=e+Math.imul(u,ja)|0,e=e+Math.imul(v,ia)|0,f=f+Math.imul(v,ja)|0,d=d+Math.imul(r,la)|0,e=e+Math.imul(r,ma)|0,e=e+Math.imul(s,la)|0,f=f+Math.imul(s,ma)|0,d=d+Math.imul(o,oa)|0,e=e+Math.imul(o,pa)|0,e=e+Math.imul(p,oa)|0,f=f+Math.imul(p,pa)|0;var Aa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Aa>>>26)|0,Aa&=67108863,d=Math.imul(M,V),e=Math.imul(M,W),e=e+Math.imul(N,V)|0,f=Math.imul(N,W),d=d+Math.imul(J,Y)|0,e=e+Math.imul(J,Z)|0,e=e+Math.imul(K,Y)|0,f=f+Math.imul(K,Z)|0,d=d+Math.imul(G,_)|0,e=e+Math.imul(G,aa)|0,e=e+Math.imul(H,_)|0,f=f+Math.imul(H,aa)|0,d=d+Math.imul(D,ca)|0,e=e+Math.imul(D,da)|0,e=e+Math.imul(E,ca)|0,f=f+Math.imul(E,da)|0,d=d+Math.imul(A,fa)|0,e=e+Math.imul(A,ga)|0,e=e+Math.imul(B,fa)|0,f=f+Math.imul(B,ga)|0,d=d+Math.imul(x,ia)|0,e=e+Math.imul(x,ja)|0,e=e+Math.imul(y,ia)|0,f=f+Math.imul(y,ja)|0,d=d+Math.imul(u,la)|0,e=e+Math.imul(u,ma)|0,e=e+Math.imul(v,la)|0,f=f+Math.imul(v,ma)|0,d=d+Math.imul(r,oa)|0,e=e+Math.imul(r,pa)|0,e=e+Math.imul(s,oa)|0,f=f+Math.imul(s,pa)|0;var Ba=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ba>>>26)|0,Ba&=67108863,d=Math.imul(M,Y),e=Math.imul(M,Z),e=e+Math.imul(N,Y)|0,f=Math.imul(N,Z),d=d+Math.imul(J,_)|0,e=e+Math.imul(J,aa)|0,e=e+Math.imul(K,_)|0,f=f+Math.imul(K,aa)|0,d=d+Math.imul(G,ca)|0,e=e+Math.imul(G,da)|0,e=e+Math.imul(H,ca)|0,f=f+Math.imul(H,da)|0,d=d+Math.imul(D,fa)|0,e=e+Math.imul(D,ga)|0,e=e+Math.imul(E,fa)|0,f=f+Math.imul(E,ga)|0,d=d+Math.imul(A,ia)|0,e=e+Math.imul(A,ja)|0,e=e+Math.imul(B,ia)|0,f=f+Math.imul(B,ja)|0,d=d+Math.imul(x,la)|0,e=e+Math.imul(x,ma)|0,e=e+Math.imul(y,la)|0,f=f+Math.imul(y,ma)|0,d=d+Math.imul(u,oa)|0,e=e+Math.imul(u,pa)|0,e=e+Math.imul(v,oa)|0,f=f+Math.imul(v,pa)|0;var Ca=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,d=Math.imul(M,_),e=Math.imul(M,aa),e=e+Math.imul(N,_)|0,f=Math.imul(N,aa),d=d+Math.imul(J,ca)|0,e=e+Math.imul(J,da)|0,e=e+Math.imul(K,ca)|0,f=f+Math.imul(K,da)|0,d=d+Math.imul(G,fa)|0,e=e+Math.imul(G,ga)|0,e=e+Math.imul(H,fa)|0,f=f+Math.imul(H,ga)|0,d=d+Math.imul(D,ia)|0,e=e+Math.imul(D,ja)|0,e=e+Math.imul(E,ia)|0,f=f+Math.imul(E,ja)|0,d=d+Math.imul(A,la)|0,e=e+Math.imul(A,ma)|0,e=e+Math.imul(B,la)|0,f=f+Math.imul(B,ma)|0,d=d+Math.imul(x,oa)|0,e=e+Math.imul(x,pa)|0,e=e+Math.imul(y,oa)|0,f=f+Math.imul(y,pa)|0;var Da=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Da>>>26)|0,Da&=67108863,d=Math.imul(M,ca),e=Math.imul(M,da),e=e+Math.imul(N,ca)|0,f=Math.imul(N,da),d=d+Math.imul(J,fa)|0,e=e+Math.imul(J,ga)|0,e=e+Math.imul(K,fa)|0,f=f+Math.imul(K,ga)|0,d=d+Math.imul(G,ia)|0,e=e+Math.imul(G,ja)|0,e=e+Math.imul(H,ia)|0,f=f+Math.imul(H,ja)|0,d=d+Math.imul(D,la)|0,e=e+Math.imul(D,ma)|0,e=e+Math.imul(E,la)|0,f=f+Math.imul(E,ma)|0,d=d+Math.imul(A,oa)|0,e=e+Math.imul(A,pa)|0,e=e+Math.imul(B,oa)|0,f=f+Math.imul(B,pa)|0;var Ea=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ea>>>26)|0,Ea&=67108863,d=Math.imul(M,fa),e=Math.imul(M,ga),e=e+Math.imul(N,fa)|0,f=Math.imul(N,ga),d=d+Math.imul(J,ia)|0,e=e+Math.imul(J,ja)|0,e=e+Math.imul(K,ia)|0,f=f+Math.imul(K,ja)|0,d=d+Math.imul(G,la)|0,e=e+Math.imul(G,ma)|0,e=e+Math.imul(H,la)|0,f=f+Math.imul(H,ma)|0,d=d+Math.imul(D,oa)|0,e=e+Math.imul(D,pa)|0,e=e+Math.imul(E,oa)|0,f=f+Math.imul(E,pa)|0;var Fa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Fa>>>26)|0,Fa&=67108863,d=Math.imul(M,ia),e=Math.imul(M,ja),e=e+Math.imul(N,ia)|0,f=Math.imul(N,ja),d=d+Math.imul(J,la)|0,e=e+Math.imul(J,ma)|0,e=e+Math.imul(K,la)|0,f=f+Math.imul(K,ma)|0,d=d+Math.imul(G,oa)|0,e=e+Math.imul(G,pa)|0,e=e+Math.imul(H,oa)|0,f=f+Math.imul(H,pa)|0;var Ga=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ga>>>26)|0,Ga&=67108863,d=Math.imul(M,la),e=Math.imul(M,ma),e=e+Math.imul(N,la)|0,f=Math.imul(N,ma),d=d+Math.imul(J,oa)|0,e=e+Math.imul(J,pa)|0,e=e+Math.imul(K,oa)|0,f=f+Math.imul(K,pa)|0;var Ha=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ha>>>26)|0,Ha&=67108863,d=Math.imul(M,oa),e=Math.imul(M,pa),e=e+Math.imul(N,oa)|0,f=Math.imul(N,pa);var Ia=(j+d|0)+((8191&e)<<13)|0;return j=(f+(e>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,i[0]=qa,i[1]=ra,i[2]=sa,i[3]=ta,i[4]=ua,i[5]=va,i[6]=wa,i[7]=xa,i[8]=ya,i[9]=za,i[10]=Aa,i[11]=Ba,i[12]=Ca,i[13]=Da,i[14]=Ea,i[15]=Fa,i[16]=Ga,i[17]=Ha,i[18]=Ia,0!==j&&(i[19]=j,c.length++),c};Math.imul||(x=j),f.prototype.mulTo=function(a,b){var c,d=this.length+a.length;return c=10===this.length&&10===a.length?x(this,a,b):d<63?j(this,a,b):d<1024?k(this,a,b):l(this,a,b)},m.prototype.makeRBT=function(a){for(var b=new Array(a),c=f.prototype._countBits(a)-1,d=0;d<a;d++)b[d]=this.revBin(d,c,a);return b},m.prototype.revBin=function(a,b,c){if(0===a||a===c-1)return a;for(var d=0,e=0;e<b;e++)d|=(1&a)<<b-e-1,a>>=1;return d},m.prototype.permute=function(a,b,c,d,e,f){for(var g=0;g<f;g++)d[g]=b[a[g]],e[g]=c[a[g]]},m.prototype.transform=function(a,b,c,d,e,f){this.permute(f,a,b,c,d,e);for(var g=1;g<e;g<<=1)for(var h=g<<1,i=Math.cos(2*Math.PI/h),j=Math.sin(2*Math.PI/h),k=0;k<e;k+=h)for(var l=i,m=j,n=0;n<g;n++){var o=c[k+n],p=d[k+n],q=c[k+n+g],r=d[k+n+g],s=l*q-m*r;r=l*r+m*q,q=s,c[k+n]=o+q,d[k+n]=p+r,c[k+n+g]=o-q,d[k+n+g]=p-r,n!==h&&(s=i*l-j*m,m=i*m+j*l,l=s)}},m.prototype.guessLen13b=function(a,b){var c=1|Math.max(b,a),d=1&c,e=0;for(c=c/2|0;c;c>>>=1)e++;return 1<<e+1+d},m.prototype.conjugate=function(a,b,c){if(!(c<=1))for(var d=0;d<c/2;d++){var e=a[d];a[d]=a[c-d-1],a[c-d-1]=e,e=b[d],b[d]=-b[c-d-1],b[c-d-1]=-e}},m.prototype.normalize13b=function(a,b){for(var c=0,d=0;d<b/2;d++){var e=8192*Math.round(a[2*d+1]/b)+Math.round(a[2*d]/b)+c;a[d]=67108863&e,c=e<67108864?0:e/67108864|0}return a},m.prototype.convert13b=function(a,b,c,e){for(var f=0,g=0;g<b;g++)f+=0|a[g],c[2*g]=8191&f,f>>>=13,c[2*g+1]=8191&f,f>>>=13;for(g=2*b;g<e;++g)c[g]=0;d(0===f),d(0===(f&-8192))},m.prototype.stub=function(a){for(var b=new Array(a),c=0;c<a;c++)b[c]=0;return b},m.prototype.mulp=function(a,b,c){var d=2*this.guessLen13b(a.length,b.length),e=this.makeRBT(d),f=this.stub(d),g=new Array(d),h=new Array(d),i=new Array(d),j=new Array(d),k=new Array(d),l=new Array(d),m=c.words;m.length=d,this.convert13b(a.words,a.length,g,d),this.convert13b(b.words,b.length,j,d),this.transform(g,f,h,i,d,e),this.transform(j,f,k,l,d,e);for(var n=0;n<d;n++){var o=h[n]*k[n]-i[n]*l[n];i[n]=h[n]*l[n]+i[n]*k[n],h[n]=o}return this.conjugate(h,i,d),this.transform(h,i,m,f,d,e),this.conjugate(m,f,d),this.normalize13b(m,d),c.negative=a.negative^b.negative,c.length=a.length+b.length,c.strip()},f.prototype.mul=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),this.mulTo(a,b)},f.prototype.mulf=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),l(this,a,b)},f.prototype.imul=function(a){return this.clone().mulTo(a,this)},f.prototype.imuln=function(a){d("number"==typeof a),d(a<67108864);for(var b=0,c=0;c<this.length;c++){var e=(0|this.words[c])*a,f=(67108863&e)+(67108863&b);b>>=26,b+=e/67108864|0,b+=f>>>26,this.words[c]=67108863&f}return 0!==b&&(this.words[c]=b,this.length++),this},f.prototype.muln=function(a){return this.clone().imuln(a)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(a){var b=i(a);if(0===b.length)return new f(1);for(var c=this,d=0;d<b.length&&0===b[d];d++,c=c.sqr());if(++d<b.length)for(var e=c.sqr();d<b.length;d++,e=e.sqr())0!==b[d]&&(c=c.mul(e));return c},f.prototype.iushln=function(a){d("number"==typeof a&&a>=0);var b,c=a%26,e=(a-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){var g=0;for(b=0;b<this.length;b++){var h=this.words[b]&f,i=(0|this.words[b])-h<<c;this.words[b]=i|g,g=h>>>26-c}g&&(this.words[b]=g,this.length++)}if(0!==e){for(b=this.length-1;b>=0;b--)this.words[b+e]=this.words[b];for(b=0;b<e;b++)this.words[b]=0;this.length+=e}return this.strip()},f.prototype.ishln=function(a){return d(0===this.negative),this.iushln(a)},f.prototype.iushrn=function(a,b,c){d("number"==typeof a&&a>=0);var e;e=b?(b-b%26)/26:0;var f=a%26,g=Math.min((a-f)/26,this.length),h=67108863^67108863>>>f<<f,i=c;if(e-=g,e=Math.max(0,e),i){for(var j=0;j<g;j++)i.words[j]=this.words[j];i.length=g}if(0===g);else if(this.length>g)for(this.length-=g,j=0;j<this.length;j++)this.words[j]=this.words[j+g];else this.words[0]=0,this.length=1;var k=0;for(j=this.length-1;j>=0&&(0!==k||j>=e);j--){var l=0|this.words[j];this.words[j]=k<<26-f|l>>>f,k=l&h}return i&&0!==k&&(i.words[i.length++]=k),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(a,b,c){return d(0===this.negative),this.iushrn(a,b,c)},f.prototype.shln=function(a){return this.clone().ishln(a)},f.prototype.ushln=function(a){return this.clone().iushln(a)},f.prototype.shrn=function(a){return this.clone().ishrn(a)},f.prototype.ushrn=function(a){return this.clone().iushrn(a)},f.prototype.testn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26,e=1<<b;if(this.length<=c)return!1;var f=this.words[c];return!!(f&e)},f.prototype.imaskn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26;if(d(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==b&&c++,this.length=Math.min(c,this.length),0!==b){var e=67108863^67108863>>>b<<b;this.words[this.length-1]&=e}return this.strip()},f.prototype.maskn=function(a){return this.clone().imaskn(a)},f.prototype.iaddn=function(a){return d("number"==typeof a),d(a<67108864),a<0?this.isubn(-a):0!==this.negative?1===this.length&&(0|this.words[0])<a?(this.words[0]=a-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},f.prototype._iaddn=function(a){this.words[0]+=a;for(var b=0;b<this.length&&this.words[b]>=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},f.prototype.isubn=function(a){if(d("number"==typeof a),d(a<67108864),a<0)return this.iaddn(-a);if(0!==this.negative)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b<this.length&&this.words[b]<0;b++)this.words[b]+=67108864,this.words[b+1]-=1;return this.strip()},f.prototype.addn=function(a){return this.clone().iaddn(a)},f.prototype.subn=function(a){return this.clone().isubn(a)},f.prototype.iabs=function(){return this.negative=0,this},f.prototype.abs=function(){return this.clone().iabs()},f.prototype._ishlnsubmul=function(a,b,c){var e,f=a.length+c;this._expand(f);var g,h=0;for(e=0;e<a.length;e++){g=(0|this.words[e+c])+h;var i=(0|a.words[e])*b;g-=67108863&i,h=(g>>26)-(i/67108864|0),this.words[e+c]=67108863&g}for(;e<this.length-c;e++)g=(0|this.words[e+c])+h,h=g>>26,this.words[e+c]=67108863&g;if(0===h)return this.strip();for(d(h===-1),h=0,e=0;e<this.length;e++)g=-(0|this.words[e])+h,h=g>>26,this.words[e]=67108863&g;return this.negative=1,this.strip()},f.prototype._wordDiv=function(a,b){var c=this.length-a.length,d=this.clone(),e=a,g=0|e.words[e.length-1],h=this._countBits(g);c=26-h,0!==c&&(e=e.ushln(c),d.iushln(c),g=0|e.words[e.length-1]);var i,j=d.length-e.length;if("mod"!==b){i=new f(null),i.length=j+1,i.words=new Array(i.length);for(var k=0;k<i.length;k++)i.words[k]=0}var l=d.clone()._ishlnsubmul(e,1,j);0===l.negative&&(d=l,i&&(i.words[j]=1));for(var m=j-1;m>=0;m--){var n=67108864*(0|d.words[e.length+m])+(0|d.words[e.length+m-1]);for(n=Math.min(n/g|0,67108863),d._ishlnsubmul(e,n,m);0!==d.negative;)n--,d.negative=0,d._ishlnsubmul(e,1,m),d.isZero()||(d.negative^=1);i&&(i.words[m]=n)}return i&&i.strip(),d.strip(),"div"!==b&&0!==c&&d.iushrn(c),{div:i||null,mod:d}},f.prototype.divmod=function(a,b,c){if(d(!a.isZero()),this.isZero())return{div:new f(0),mod:new f(0)};var e,g,h;return 0!==this.negative&&0===a.negative?(h=this.neg().divmod(a,b),"mod"!==b&&(e=h.div.neg()),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.iadd(a)),{div:e,mod:g}):0===this.negative&&0!==a.negative?(h=this.divmod(a.neg(),b),"mod"!==b&&(e=h.div.neg()),{div:e,mod:h.mod}):0!==(this.negative&a.negative)?(h=this.neg().divmod(a.neg(),b),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.isub(a)),{div:h.div,mod:g}):a.length>this.length||this.cmp(a)<0?{div:new f(0),mod:this}:1===a.length?"div"===b?{div:this.divn(a.words[0]),mod:null}:"mod"===b?{div:null,mod:new f(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new f(this.modn(a.words[0]))}:this._wordDiv(a,b)},f.prototype.div=function(a){return this.divmod(a,"div",!1).div},f.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},f.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},f.prototype.divRound=function(a){var b=this.divmod(a);if(b.mod.isZero())return b.div;var c=0!==b.div.negative?b.mod.isub(a):b.mod,d=a.ushrn(1),e=a.andln(1),f=c.cmp(d);return f<0||1===e&&0===f?b.div:0!==b.div.negative?b.div.isubn(1):b.div.iaddn(1)},f.prototype.modn=function(a){d(a<=67108863);for(var b=(1<<26)%a,c=0,e=this.length-1;e>=0;e--)c=(b*c+(0|this.words[e]))%a;return c},f.prototype.idivn=function(a){d(a<=67108863);for(var b=0,c=this.length-1;c>=0;c--){var e=(0|this.words[c])+67108864*b;this.words[c]=e/a|0,b=e%a}return this.strip()},f.prototype.divn=function(a){return this.clone().idivn(a)},f.prototype.egcd=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=new f(0),i=new f(1),j=0;b.isEven()&&c.isEven();)b.iushrn(1),c.iushrn(1),++j;for(var k=c.clone(),l=b.clone();!b.isZero();){for(var m=0,n=1;0===(b.words[0]&n)&&m<26;++m,n<<=1);if(m>0)for(b.iushrn(m);m-- >0;)(e.isOdd()||g.isOdd())&&(e.iadd(k),g.isub(l)),e.iushrn(1),g.iushrn(1);for(var o=0,p=1;0===(c.words[0]&p)&&o<26;++o,p<<=1);if(o>0)for(c.iushrn(o);o-- >0;)(h.isOdd()||i.isOdd())&&(h.iadd(k),i.isub(l)),h.iushrn(1),i.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(h),g.isub(i)):(c.isub(b),h.isub(e),i.isub(g))}return{a:h,b:i,gcd:c.iushln(j)}},f.prototype._invmp=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=c.clone();b.cmpn(1)>0&&c.cmpn(1)>0;){for(var i=0,j=1;0===(b.words[0]&j)&&i<26;++i,j<<=1);if(i>0)for(b.iushrn(i);i-- >0;)e.isOdd()&&e.iadd(h),e.iushrn(1);for(var k=0,l=1;0===(c.words[0]&l)&&k<26;++k,l<<=1);if(k>0)for(c.iushrn(k);k-- >0;)g.isOdd()&&g.iadd(h),g.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(g)):(c.isub(b),g.isub(e))}var m;return m=0===b.cmpn(1)?e:g,m.cmpn(0)<0&&m.iadd(a),m},f.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var b=this.clone(),c=a.clone();b.negative=0,c.negative=0;for(var d=0;b.isEven()&&c.isEven();d++)b.iushrn(1),c.iushrn(1);for(;;){for(;b.isEven();)b.iushrn(1);for(;c.isEven();)c.iushrn(1);var e=b.cmp(c);if(e<0){var f=b;b=c,c=f}else if(0===e||0===c.cmpn(1))break;b.isub(c)}return c.iushln(d)},f.prototype.invm=function(a){return this.egcd(a).a.umod(a)},f.prototype.isEven=function(){return 0===(1&this.words[0])},f.prototype.isOdd=function(){return 1===(1&this.words[0])},f.prototype.andln=function(a){return this.words[0]&a},f.prototype.bincn=function(a){d("number"==typeof a);var b=a%26,c=(a-b)/26,e=1<<b;if(this.length<=c)return this._expand(c+1),this.words[c]|=e,this;for(var f=e,g=c;0!==f&&g<this.length;g++){var h=0|this.words[g];h+=f,f=h>>>26,h&=67108863,this.words[g]=h}return 0!==f&&(this.words[g]=f,this.length++),this},f.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},f.prototype.cmpn=function(a){var b=a<0;if(0!==this.negative&&!b)return-1;if(0===this.negative&&b)return 1;this.strip();var c;if(this.length>1)c=1;else{b&&(a=-a),d(a<=67108863,"Number is too big");var e=0|this.words[0];c=e===a?0:e<a?-1:1}return 0!==this.negative?0|-c:c},f.prototype.cmp=function(a){if(0!==this.negative&&0===a.negative)return-1;if(0===this.negative&&0!==a.negative)return 1;var b=this.ucmp(a);return 0!==this.negative?0|-b:b},f.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var b=0,c=this.length-1;c>=0;c--){var d=0|this.words[c],e=0|a.words[c];if(d!==e){d<e?b=-1:d>e&&(b=1);break}}return b},f.prototype.gtn=function(a){return 1===this.cmpn(a)},f.prototype.gt=function(a){return 1===this.cmp(a)},f.prototype.gten=function(a){return this.cmpn(a)>=0},f.prototype.gte=function(a){return this.cmp(a)>=0},f.prototype.ltn=function(a){return this.cmpn(a)===-1},f.prototype.lt=function(a){return this.cmp(a)===-1},f.prototype.lten=function(a){return this.cmpn(a)<=0},f.prototype.lte=function(a){return this.cmp(a)<=0},f.prototype.eqn=function(a){return 0===this.cmpn(a)},f.prototype.eq=function(a){return 0===this.cmp(a)},f.red=function(a){return new s(a)},f.prototype.toRed=function(a){return d(!this.red,"Already a number in reduction context"),d(0===this.negative,"red works only with positives"),a.convertTo(this)._forceRed(a)},f.prototype.fromRed=function(){return d(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},f.prototype._forceRed=function(a){return this.red=a,this},f.prototype.forceRed=function(a){return d(!this.red,"Already a number in reduction context"),this._forceRed(a)},f.prototype.redAdd=function(a){return d(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},f.prototype.redIAdd=function(a){return d(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},f.prototype.redSub=function(a){return d(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},f.prototype.redISub=function(a){return d(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},f.prototype.redShl=function(a){return d(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},f.prototype.redMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},f.prototype.redIMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},f.prototype.redSqr=function(){return d(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},f.prototype.redISqr=function(){return d(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},f.prototype.redSqrt=function(){return d(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},f.prototype.redInvm=function(){return d(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},f.prototype.redNeg=function(){return d(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},f.prototype.redPow=function(a){return d(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var y={k256:null,p224:null,p192:null,p25519:null};n.prototype._tmp=function(){var a=new f(null);return a.words=new Array(Math.ceil(this.n/13)),a},n.prototype.ireduce=function(a){var b,c=a;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),b=c.bitLength();while(b>this.n);var d=b<this.n?-1:c.ucmp(this.p);return 0===d?(c.words[0]=0,c.length=1):d>0?c.isub(this.p):c.strip(),c},n.prototype.split=function(a,b){a.iushrn(this.n,0,b)},n.prototype.imulK=function(a){return a.imul(this.k)},e(o,n),o.prototype.split=function(a,b){for(var c=4194303,d=Math.min(a.length,9),e=0;e<d;e++)b.words[e]=a.words[e];if(b.length=d,a.length<=9)return a.words[0]=0,void(a.length=1);var f=a.words[9];for(b.words[b.length++]=f&c,e=10;e<a.length;e++){var g=0|a.words[e];a.words[e-10]=(g&c)<<4|f>>>22,f=g}f>>>=22,a.words[e-10]=f,0===f&&a.length>10?a.length-=10:a.length-=9},o.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var b=0,c=0;c<a.length;c++){var d=0|a.words[c];b+=977*d,a.words[c]=67108863&b,b=64*d+(b/67108864|0)}return 0===a.words[a.length-1]&&(a.length--,0===a.words[a.length-1]&&a.length--),a},e(p,n),e(q,n),e(r,n),r.prototype.imulK=function(a){for(var b=0,c=0;c<a.length;c++){var d=19*(0|a.words[c])+b,e=67108863&d;d>>>=26,a.words[c]=e,b=d}return 0!==b&&(a.words[a.length++]=b),a},f._prime=function a(b){if(y[b])return y[b];var a;if("k256"===b)a=new o;else if("p224"===b)a=new p;else if("p192"===b)a=new q;else{if("p25519"!==b)throw new Error("Unknown prime "+b);a=new r}return y[b]=a,a},s.prototype._verify1=function(a){d(0===a.negative,"red works only with positives"),d(a.red,"red works only with red numbers")},s.prototype._verify2=function(a,b){d(0===(a.negative|b.negative),"red works only with positives"),d(a.red&&a.red===b.red,"red works only with red numbers")},s.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},s.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},s.prototype.add=function(a,b){this._verify2(a,b);var c=a.add(b);return c.cmp(this.m)>=0&&c.isub(this.m),
9
c._forceRed(this)},s.prototype.iadd=function(a,b){this._verify2(a,b);var c=a.iadd(b);return c.cmp(this.m)>=0&&c.isub(this.m),c},s.prototype.sub=function(a,b){this._verify2(a,b);var c=a.sub(b);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},s.prototype.isub=function(a,b){this._verify2(a,b);var c=a.isub(b);return c.cmpn(0)<0&&c.iadd(this.m),c},s.prototype.shl=function(a,b){return this._verify1(a),this.imod(a.ushln(b))},s.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},s.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},s.prototype.isqr=function(a){return this.imul(a,a.clone())},s.prototype.sqr=function(a){return this.mul(a,a)},s.prototype.sqrt=function(a){if(a.isZero())return a.clone();var b=this.m.andln(3);if(d(b%2===1),3===b){var c=this.m.add(new f(1)).iushrn(2);return this.pow(a,c)}for(var e=this.m.subn(1),g=0;!e.isZero()&&0===e.andln(1);)g++,e.iushrn(1);d(!e.isZero());var h=new f(1).toRed(this),i=h.redNeg(),j=this.m.subn(1).iushrn(1),k=this.m.bitLength();for(k=new f(2*k*k).toRed(this);0!==this.pow(k,j).cmp(i);)k.redIAdd(i);for(var l=this.pow(k,e),m=this.pow(a,e.addn(1).iushrn(1)),n=this.pow(a,e),o=g;0!==n.cmp(h);){for(var p=n,q=0;0!==p.cmp(h);q++)p=p.redSqr();d(q<o);var r=this.pow(l,new f(1).iushln(o-q-1));m=m.redMul(r),l=r.redSqr(),n=n.redMul(l),o=q}return m},s.prototype.invm=function(a){var b=a._invmp(this.m);return 0!==b.negative?(b.negative=0,this.imod(b).redNeg()):this.imod(b)},s.prototype.pow=function(a,b){if(b.isZero())return new f(1).toRed(this);if(0===b.cmpn(1))return a.clone();var c=4,d=new Array(1<<c);d[0]=new f(1).toRed(this),d[1]=a;for(var e=2;e<d.length;e++)d[e]=this.mul(d[e-1],a);var g=d[0],h=0,i=0,j=b.bitLength()%26;for(0===j&&(j=26),e=b.length-1;e>=0;e--){for(var k=b.words[e],l=j-1;l>=0;l--){var m=k>>l&1;g!==d[0]&&(g=this.sqr(g)),0!==m||0!==h?(h<<=1,h|=m,i++,(i===c||0===e&&0===l)&&(g=this.mul(g,d[h]),i=0,h=0)):i=0}j=26}return g},s.prototype.convertTo=function(a){var b=a.umod(this.m);return b===a?b.clone():b},s.prototype.convertFrom=function(a){var b=a.clone();return b.red=null,b},f.mont=function(a){return new t(a)},e(t,s),t.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},t.prototype.convertFrom=function(a){var b=this.imod(a.mul(this.rinv));return b.red=null,b},t.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var c=a.imul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),f=e;return e.cmp(this.m)>=0?f=e.isub(this.m):e.cmpn(0)<0&&(f=e.iadd(this.m)),f._forceRed(this)},t.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new f(0)._forceRed(this);var c=a.mul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),g=e;return e.cmp(this.m)>=0?g=e.isub(this.m):e.cmpn(0)<0&&(g=e.iadd(this.m)),g._forceRed(this)},t.prototype.invm=function(a){var b=this.imod(a._invmp(this.m).mul(this.r2));return b._forceRed(this)}}("undefined"==typeof b||b,this)},{buffer:77}],76:[function(a,b,c){function d(a){this.rand=a}var e;if(b.exports=function(a){return e||(e=new d(null)),e.generate(a)},b.exports.Rand=d,d.prototype.generate=function(a){return this._rand(a)},d.prototype._rand=function(a){if(this.rand.getBytes)return this.rand.getBytes(a);for(var b=new Uint8Array(a),c=0;c<b.length;c++)b[c]=this.rand.getByte();return b},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?d.prototype._rand=function(a){var b=new Uint8Array(a);return self.crypto.getRandomValues(b),b}:self.msCrypto&&self.msCrypto.getRandomValues?d.prototype._rand=function(a){var b=new Uint8Array(a);return self.msCrypto.getRandomValues(b),b}:"object"==typeof window&&(d.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var f=a("crypto");if("function"!=typeof f.randomBytes)throw new Error("Not supported");d.prototype._rand=function(a){return f.randomBytes(a)}}catch(a){}},{crypto:77}],77:[function(a,b,c){},{}],78:[function(a,b,c){function d(a){Buffer.isBuffer(a)||(a=Buffer.from(a));for(var b=a.length/4|0,c=new Array(b),d=0;d<b;d++)c[d]=a.readUInt32BE(4*d);return c}function e(a){for(var b=0;b<a.length;a++)a[b]=0}function f(a,b,c,d,e){for(var f,g,h,i,j=c[0],k=c[1],l=c[2],m=c[3],n=a[0]^b[0],o=a[1]^b[1],p=a[2]^b[2],q=a[3]^b[3],r=4,s=1;s<e;s++)f=j[n>>>24]^k[o>>>16&255]^l[p>>>8&255]^m[255&q]^b[r++],g=j[o>>>24]^k[p>>>16&255]^l[q>>>8&255]^m[255&n]^b[r++],h=j[p>>>24]^k[q>>>16&255]^l[n>>>8&255]^m[255&o]^b[r++],i=j[q>>>24]^k[n>>>16&255]^l[o>>>8&255]^m[255&p]^b[r++],n=f,o=g,p=h,q=i;return f=(d[n>>>24]<<24|d[o>>>16&255]<<16|d[p>>>8&255]<<8|d[255&q])^b[r++],g=(d[o>>>24]<<24|d[p>>>16&255]<<16|d[q>>>8&255]<<8|d[255&n])^b[r++],h=(d[p>>>24]<<24|d[q>>>16&255]<<16|d[n>>>8&255]<<8|d[255&o])^b[r++],i=(d[q>>>24]<<24|d[n>>>16&255]<<16|d[o>>>8&255]<<8|d[255&p])^b[r++],f>>>=0,g>>>=0,h>>>=0,i>>>=0,[f,g,h,i]}function g(a){this._key=d(a),this._reset()}var Buffer=a("safe-buffer").Buffer,h=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var a=new Array(256),b=0;b<256;b++)b<128?a[b]=b<<1:a[b]=b<<1^283;for(var c=[],d=[],e=[[],[],[],[]],f=[[],[],[],[]],g=0,h=0,i=0;i<256;++i){var j=h^h<<1^h<<2^h<<3^h<<4;j=j>>>8^255&j^99,c[g]=j,d[j]=g;var k=a[g],l=a[k],m=a[l],n=257*a[j]^16843008*j;e[0][g]=n<<24|n>>>8,e[1][g]=n<<16|n>>>16,e[2][g]=n<<8|n>>>24,e[3][g]=n,n=16843009*m^65537*l^257*k^16843008*g,f[0][j]=n<<24|n>>>8,f[1][j]=n<<16|n>>>16,f[2][j]=n<<8|n>>>24,f[3][j]=n,0===g?g=h=1:(g=k^a[a[a[m^k]]],h^=a[a[h]])}return{SBOX:c,INV_SBOX:d,SUB_MIX:e,INV_SUB_MIX:f}}();g.blockSize=16,g.keySize=32,g.prototype.blockSize=g.blockSize,g.prototype.keySize=g.keySize,g.prototype._reset=function(){for(var a=this._key,b=a.length,c=b+6,d=4*(c+1),e=[],f=0;f<b;f++)e[f]=a[f];for(f=b;f<d;f++){var g=e[f-1];f%b===0?(g=g<<8|g>>>24,g=i.SBOX[g>>>24]<<24|i.SBOX[g>>>16&255]<<16|i.SBOX[g>>>8&255]<<8|i.SBOX[255&g],g^=h[f/b|0]<<24):b>6&&f%b===4&&(g=i.SBOX[g>>>24]<<24|i.SBOX[g>>>16&255]<<16|i.SBOX[g>>>8&255]<<8|i.SBOX[255&g]),e[f]=e[f-b]^g}for(var j=[],k=0;k<d;k++){var l=d-k,m=e[l-(k%4?0:4)];k<4||l<=4?j[k]=m:j[k]=i.INV_SUB_MIX[0][i.SBOX[m>>>24]]^i.INV_SUB_MIX[1][i.SBOX[m>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[m>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&m]]}this._nRounds=c,this._keySchedule=e,this._invKeySchedule=j},g.prototype.encryptBlockRaw=function(a){return a=d(a),f(a,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},g.prototype.encryptBlock=function(a){var b=this.encryptBlockRaw(a),c=Buffer.allocUnsafe(16);return c.writeUInt32BE(b[0],0),c.writeUInt32BE(b[1],4),c.writeUInt32BE(b[2],8),c.writeUInt32BE(b[3],12),c},g.prototype.decryptBlock=function(a){a=d(a);var b=a[1];a[1]=a[3],a[3]=b;var c=f(a,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),e=Buffer.allocUnsafe(16);return e.writeUInt32BE(c[0],0),e.writeUInt32BE(c[3],4),e.writeUInt32BE(c[2],8),e.writeUInt32BE(c[1],12),e},g.prototype.scrub=function(){e(this._keySchedule),e(this._invKeySchedule),e(this._key)},b.exports.AES=g},{"safe-buffer":288}],79:[function(a,b,c){function d(a,b){var c=0;a.length!==b.length&&c++;for(var d=Math.min(a.length,b.length),e=0;e<d;++e)c+=a[e]^b[e];return c}function e(a,b,c){if(12===b.length)return a._finID=Buffer.concat([b,Buffer.from([0,0,0,1])]),Buffer.concat([b,Buffer.from([0,0,0,2])]);var d=new j(c),e=b.length,f=e%16;d.update(b),f&&(f=16-f,d.update(Buffer.alloc(f,0))),d.update(Buffer.alloc(8,0));var g=8*e,h=Buffer.alloc(8);h.writeUIntBE(g,0,8),d.update(h),a._finID=d.state;var i=Buffer.from(a._finID);return l(i),i}function f(a,b,c,d){h.call(this);var f=Buffer.alloc(4,0);this._cipher=new g.AES(b);var i=this._cipher.encryptBlock(f);this._ghash=new j(i),c=e(this,c,i),this._prev=Buffer.from(c),this._cache=Buffer.allocUnsafe(0),this._secCache=Buffer.allocUnsafe(0),this._decrypt=d,this._alen=0,this._len=0,this._mode=a,this._authTag=null,this._called=!1}var g=a("./aes"),Buffer=a("safe-buffer").Buffer,h=a("cipher-base"),i=a("inherits"),j=a("./ghash"),k=a("buffer-xor"),l=a("./incr32");i(f,h),f.prototype._update=function(a){if(!this._called&&this._alen){var b=16-this._alen%16;b<16&&(b=Buffer.alloc(b,0),this._ghash.update(b))}this._called=!0;var c=this._mode.encrypt(this,a);return this._decrypt?this._ghash.update(a):this._ghash.update(c),this._len+=a.length,c},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var a=k(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&d(a,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=a,this._cipher.scrub()},f.prototype.getAuthTag=function(){if(this._decrypt||!Buffer.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},f.prototype.setAuthTag=function(a){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=a},f.prototype.setAAD=function(a){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(a),this._alen+=a.length},b.exports=f},{"./aes":78,"./ghash":83,"./incr32":84,"buffer-xor":103,"cipher-base":106,inherits:226,"safe-buffer":288}],80:[function(a,b,c){function d(){return Object.keys(g)}var e=a("./encrypter"),f=a("./decrypter"),g=a("./modes/list.json");c.createCipher=c.Cipher=e.createCipher,c.createCipheriv=c.Cipheriv=e.createCipheriv,c.createDecipher=c.Decipher=f.createDecipher,c.createDecipheriv=c.Decipheriv=f.createDecipheriv,c.listCiphers=c.getCiphers=d},{"./decrypter":81,"./encrypter":82,"./modes/list.json":92}],81:[function(a,b,c){function d(a,b,c){l.call(this),this._cache=new e,this._last=void 0,this._cipher=new m.AES(b),this._prev=Buffer.from(c),this._mode=a,this._autopadding=!0}function e(){this.cache=Buffer.allocUnsafe(0)}function f(a){for(var b=a[15],c=-1;++c<b;)if(a[c+(16-b)]!==b)throw new Error("unable to decrypt data");if(16!==b)return a.slice(0,16-b)}function g(a,b,c){var e=j[a.toLowerCase()];if(!e)throw new TypeError("invalid suite type");if("string"==typeof c&&(c=Buffer.from(c)),"GCM"!==e.mode&&c.length!==e.iv)throw new TypeError("invalid iv length "+c.length);if("string"==typeof b&&(b=Buffer.from(b)),b.length!==e.key/8)throw new TypeError("invalid key length "+b.length);return"stream"===e.type?new k(e.module,b,c,!0):"auth"===e.type?new i(e.module,b,c,!0):new d(e.module,b,c)}function h(a,b){var c=j[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=n(b,!1,c.key,c.iv);return g(a,d.key,d.iv)}var i=a("./authCipher"),Buffer=a("safe-buffer").Buffer,j=a("./modes"),k=a("./streamCipher"),l=a("cipher-base"),m=a("./aes"),n=a("evp_bytestokey"),o=a("inherits");o(d,l),d.prototype._update=function(a){this._cache.add(a);for(var b,c,d=[];b=this._cache.get(this._autopadding);)c=this._mode.decrypt(this,b),d.push(c);return Buffer.concat(d)},d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return f(this._mode.decrypt(this,a));if(a)throw new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=Buffer.concat([this.cache,a])},e.prototype.get=function(a){var b;if(a){if(this.cache.length>16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b}else if(this.cache.length>=16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b;return null},e.prototype.flush=function(){if(this.cache.length)return this.cache},c.createDecipher=h,c.createDecipheriv=g},{"./aes":78,"./authCipher":79,"./modes":91,"./streamCipher":94,"cipher-base":106,evp_bytestokey:209,inherits:226,"safe-buffer":288}],82:[function(a,b,c){function d(a,b,c){k.call(this),this._cache=new e,this._cipher=new l.AES(b),this._prev=Buffer.from(c),this._mode=a,this._autopadding=!0}function e(){this.cache=Buffer.allocUnsafe(0)}function f(a,b,c){var e=h[a.toLowerCase()];if(!e)throw new TypeError("invalid suite type");if("string"==typeof b&&(b=Buffer.from(b)),b.length!==e.key/8)throw new TypeError("invalid key length "+b.length);if("string"==typeof c&&(c=Buffer.from(c)),"GCM"!==e.mode&&c.length!==e.iv)throw new TypeError("invalid iv length "+c.length);return"stream"===e.type?new j(e.module,b,c):"auth"===e.type?new i(e.module,b,c):new d(e.module,b,c)}function g(a,b){var c=h[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=m(b,!1,c.key,c.iv);return f(a,d.key,d.iv)}var h=a("./modes"),i=a("./authCipher"),Buffer=a("safe-buffer").Buffer,j=a("./streamCipher"),k=a("cipher-base"),l=a("./aes"),m=a("evp_bytestokey"),n=a("inherits");n(d,k),d.prototype._update=function(a){this._cache.add(a);for(var b,c,d=[];b=this._cache.get();)c=this._mode.encrypt(this,b),d.push(c);return Buffer.concat(d)};var o=Buffer.alloc(16,16);d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return a=this._mode.encrypt(this,a),this._cipher.scrub(),a;if(!a.equals(o))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=Buffer.concat([this.cache,a])},e.prototype.get=function(){if(this.cache.length>15){var a=this.cache.slice(0,16);return this.cache=this.cache.slice(16),a}return null},e.prototype.flush=function(){for(var a=16-this.cache.length,b=Buffer.allocUnsafe(a),c=-1;++c<a;)b.writeUInt8(a,c);return Buffer.concat([this.cache,b])},c.createCipheriv=f,c.createCipher=g},{"./aes":78,"./authCipher":79,"./modes":91,"./streamCipher":94,"cipher-base":106,evp_bytestokey:209,inherits:226,"safe-buffer":288}],83:[function(a,b,c){function d(a){return[a.readUInt32BE(0),a.readUInt32BE(4),a.readUInt32BE(8),a.readUInt32BE(12)]}function e(a){var b=Buffer.allocUnsafe(16);return b.writeUInt32BE(a[0]>>>0,0),b.writeUInt32BE(a[1]>>>0,4),b.writeUInt32BE(a[2]>>>0,8),b.writeUInt32BE(a[3]>>>0,12),b}function f(a){this.h=a,this.state=Buffer.alloc(16,0),this.cache=Buffer.allocUnsafe(0)}var Buffer=a("safe-buffer").Buffer,g=Buffer.alloc(16,0);f.prototype.ghash=function(a){for(var b=-1;++b<a.length;)this.state[b]^=a[b];this._multiply()},f.prototype._multiply=function(){for(var a,b,c,f=d(this.h),g=[0,0,0,0],h=-1;++h<128;){for(b=0!==(this.state[~~(h/8)]&1<<7-h%8),b&&(g[0]^=f[0],g[1]^=f[1],g[2]^=f[2],g[3]^=f[3]),c=0!==(1&f[3]),a=3;a>0;a--)f[a]=f[a]>>>1|(1&f[a-1])<<31;f[0]=f[0]>>>1,c&&(f[0]=f[0]^225<<24)}this.state=e(g)},f.prototype.update=function(a){this.cache=Buffer.concat([this.cache,a]);for(var b;this.cache.length>=16;)b=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(b)},f.prototype.final=function(a,b){return this.cache.length&&this.ghash(Buffer.concat([this.cache,g],16)),this.ghash(e([0,a,0,b])),this.state},b.exports=f},{"safe-buffer":288}],84:[function(a,b,c){function d(a){for(var b,c=a.length;c--;){if(b=a.readUInt8(c),255!==b){b++,a.writeUInt8(b,c);break}a.writeUInt8(0,c)}}b.exports=d},{}],85:[function(a,b,c){var d=a("buffer-xor");c.encrypt=function(a,b){var c=d(b,a._prev);return a._prev=a._cipher.encryptBlock(c),a._prev},c.decrypt=function(a,b){var c=a._prev;a._prev=b;var e=a._cipher.decryptBlock(b);return d(e,c)}},{"buffer-xor":103}],86:[function(a,b,c){function d(a,b,c){var d=b.length,f=e(b,a._cache);return a._cache=a._cache.slice(d),a._prev=Buffer.concat([a._prev,c?b:f]),f}var Buffer=a("safe-buffer").Buffer,e=a("buffer-xor");c.encrypt=function(a,b,c){for(var e,f=Buffer.allocUnsafe(0);b.length;){if(0===a._cache.length&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=Buffer.allocUnsafe(0)),!(a._cache.length<=b.length)){f=Buffer.concat([f,d(a,b,c)]);break}e=a._cache.length,f=Buffer.concat([f,d(a,b.slice(0,e),c)]),b=b.slice(e)}return f}},{"buffer-xor":103,"safe-buffer":288}],87:[function(a,b,c){function d(a,b,c){for(var d,f,g,h=-1,i=8,j=0;++h<i;)d=a._cipher.encryptBlock(a._prev),f=b&1<<7-h?128:0,g=d[0]^f,j+=(128&g)>>h%8,a._prev=e(a._prev,c?f:g);return j}function e(a,b){var c=a.length,d=-1,e=Buffer.allocUnsafe(a.length);for(a=Buffer.concat([a,Buffer.from([b])]);++d<c;)e[d]=a[d]<<1|a[d+1]>>7;return e}var Buffer=a("safe-buffer").Buffer;c.encrypt=function(a,b,c){for(var e=b.length,f=Buffer.allocUnsafe(e),g=-1;++g<e;)f[g]=d(a,b[g],c);return f}},{"safe-buffer":288}],88:[function(a,b,c){function d(a,b,c){var d=a._cipher.encryptBlock(a._prev),e=d[0]^b;return a._prev=Buffer.concat([a._prev.slice(1),Buffer.from([c?b:e])]),e}var Buffer=a("safe-buffer").Buffer;c.encrypt=function(a,b,c){for(var e=b.length,f=Buffer.allocUnsafe(e),g=-1;++g<e;)f[g]=d(a,b[g],c);return f}},{"safe-buffer":288}],89:[function(a,b,c){function d(a){var b=a._cipher.encryptBlockRaw(a._prev);return f(a._prev),b}var e=a("buffer-xor"),Buffer=a("safe-buffer").Buffer,f=a("../incr32"),g=16;c.encrypt=function(a,b){var c=Math.ceil(b.length/g),f=a._cache.length;a._cache=Buffer.concat([a._cache,Buffer.allocUnsafe(c*g)]);for(var h=0;h<c;h++){var i=d(a),j=f+h*g;a._cache.writeUInt32BE(i[0],j+0),a._cache.writeUInt32BE(i[1],j+4),a._cache.writeUInt32BE(i[2],j+8),a._cache.writeUInt32BE(i[3],j+12)}var k=a._cache.slice(0,b.length);return a._cache=a._cache.slice(b.length),e(b,k)}},{"../incr32":84,"buffer-xor":103,"safe-buffer":288}],90:[function(a,b,c){c.encrypt=function(a,b){return a._cipher.encryptBlock(b)},c.decrypt=function(a,b){return a._cipher.decryptBlock(b)}},{}],91:[function(a,b,c){var d={ECB:a("./ecb"),CBC:a("./cbc"),CFB:a("./cfb"),CFB8:a("./cfb8"),CFB1:a("./cfb1"),OFB:a("./ofb"),CTR:a("./ctr"),GCM:a("./ctr")},e=a("./list.json");for(var f in e)e[f].module=d[e[f].mode];b.exports=e},{"./cbc":85,"./cfb":86,"./cfb1":87,"./cfb8":88,"./ctr":89,"./ecb":90,"./list.json":92,"./ofb":93}],92:[function(a,b,c){b.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},{}],93:[function(a,b,c){(function(Buffer){function b(a){return a._prev=a._cipher.encryptBlock(a._prev),a._prev}var d=a("buffer-xor");c.encrypt=function(a,c){for(;a._cache.length<c.length;)a._cache=Buffer.concat([a._cache,b(a)]);var e=a._cache.slice(0,c.length);return a._cache=a._cache.slice(c.length),d(c,e)}}).call(this,a("buffer").Buffer)},{buffer:104,"buffer-xor":103}],94:[function(a,b,c){function d(a,b,c,d){f.call(this),this._cipher=new e.AES(b),this._prev=Buffer.from(c),this._cache=Buffer.allocUnsafe(0),this._secCache=Buffer.allocUnsafe(0),this._decrypt=d,this._mode=a}var e=a("./aes"),Buffer=a("safe-buffer").Buffer,f=a("cipher-base"),g=a("inherits");g(d,f),d.prototype._update=function(a){return this._mode.encrypt(this,a,this._decrypt)},d.prototype._final=function(){this._cipher.scrub()},b.exports=d},{"./aes":78,"cipher-base":106,inherits:226,"safe-buffer":288}],95:[function(a,b,c){function d(a,b){var c,d;if(a=a.toLowerCase(),m[a])c=m[a].key,d=m[a].iv;else{if(!l[a])throw new TypeError("invalid suite type");c=8*l[a].key,d=l[a].iv}var e=i(b,!1,c,d);return f(a,e.key,e.iv)}function e(a,b){var c,d;if(a=a.toLowerCase(),m[a])c=m[a].key,d=m[a].iv;else{if(!l[a])throw new TypeError("invalid suite type");c=8*l[a].key,d=l[a].iv}var e=i(b,!1,c,d);return g(a,e.key,e.iv)}function f(a,b,c){if(a=a.toLowerCase(),m[a])return j.createCipheriv(a,b,c);if(l[a])return new k({key:b,iv:c,mode:a});throw new TypeError("invalid suite type")}function g(a,b,c){if(a=a.toLowerCase(),m[a])return j.createDecipheriv(a,b,c);if(l[a])return new k({key:b,iv:c,mode:a,decrypt:!0});throw new TypeError("invalid suite type")}function h(){return Object.keys(l).concat(j.getCiphers())}var i=a("evp_bytestokey"),j=a("browserify-aes/browser"),k=a("browserify-des"),l=a("browserify-des/modes"),m=a("browserify-aes/modes");c.createCipher=c.Cipher=d,c.createCipheriv=c.Cipheriv=f,c.createDecipher=c.Decipher=e,c.createDecipheriv=c.Decipheriv=g,c.listCiphers=c.getCiphers=h},{"browserify-aes/browser":80,"browserify-aes/modes":91,"browserify-des":96,"browserify-des/modes":97,evp_bytestokey:209}],96:[function(a,b,c){(function(Buffer){function c(a){d.call(this);var b,c=a.mode.toLowerCase(),e=g[c];b=a.decrypt?"decrypt":"encrypt";var f=a.key;"des-ede"!==c&&"des-ede-cbc"!==c||(f=Buffer.concat([f,f.slice(0,8)]));var h=a.iv;this._des=e.create({key:f,iv:h,type:b})}var d=a("cipher-base"),e=a("des.js"),f=a("inherits"),g={"des-ede3-cbc":e.CBC.instantiate(e.EDE),"des-ede3":e.EDE,"des-ede-cbc":e.CBC.instantiate(e.EDE),"des-ede":e.EDE,"des-cbc":e.CBC.instantiate(e.DES),"des-ecb":e.DES};g.des=g["des-cbc"],g.des3=g["des-ede3-cbc"],b.exports=c,f(c,d),c.prototype._update=function(a){return new Buffer(this._des.update(a))},c.prototype._final=function(){return new Buffer(this._des.final())}}).call(this,a("buffer").Buffer)},{buffer:104,"cipher-base":106,"des.js":177,inherits:226}],97:[function(a,b,c){c["des-ecb"]={key:8,iv:0},c["des-cbc"]=c.des={key:8,iv:8},c["des-ede3-cbc"]=c.des3={key:24,iv:8},c["des-ede3"]={key:24,iv:0},c["des-ede-cbc"]={key:16,iv:8},c["des-ede"]={key:16,iv:0}},{}],98:[function(a,b,c){arguments[4][73][0].apply(c,arguments)},{"base-x":21,dup:73}],99:[function(a,b,c){(function(Buffer){"use strict";var c=a("bs58");b.exports=function(a){function b(b){var d=a(b);return c.encode(Buffer.concat([b,d],b.length+4))}function d(b){var c=b.slice(0,-4),d=b.slice(-4),e=a(c);if(!(d[0]^e[0]|d[1]^e[1]|d[2]^e[2]|d[3]^e[3]))return c}function e(a){var b=c.decodeUnsafe(a);if(b)return d(b)}function f(b){var e=c.decode(b),f=d(e,a);if(!f)throw new Error("Invalid checksum");return f}return{encode:b,decode:f,decodeUnsafe:e}}}).call(this,a("buffer").Buffer)},{bs58:98,buffer:104}],100:[function(a,b,c){"use strict";function d(a){var b=e("sha256").update(a).digest();return e("sha256").update(b).digest()}var e=a("create-hash"),f=a("./base");b.exports=f(d)},{"./base":99,"create-hash":110}],101:[function(a,b,c){(function(Buffer){"use strict";b.exports=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return!0;if("function"==typeof a.equals)return a.equals(b);if(a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}}).call(this,{isBuffer:a("../is-buffer/index.js")})},{"../is-buffer/index.js":227}],102:[function(a,b,c){(function(Buffer){b.exports=function(a){for(var b=new Buffer(a.length),c=0,d=a.length-1;c<=d;++c,--d)b[c]=a[d],b[d]=a[c];return b}}).call(this,a("buffer").Buffer)},{buffer:104}],103:[function(a,b,c){(function(Buffer){b.exports=function(a,b){for(var c=Math.min(a.length,b.length),d=new Buffer(c),e=0;e<c;++e)d[e]=a[e]^b[e];return d}}).call(this,a("buffer").Buffer)},{buffer:104}],104:[function(a,b,c){"use strict";function d(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===a.foo()}catch(a){return!1}}function e(a){if(a>Y)throw new RangeError("Invalid typed array length");var b=new Uint8Array(a);return b.__proto__=Buffer.prototype,b}function Buffer(a,b,c){if("number"==typeof a){if("string"==typeof b)throw new Error("If encoding is specified then the first argument must be a string");return i(a)}return f(a,b,c)}function f(a,b,c){if("number"==typeof a)throw new TypeError('"value" argument must not be a number');return T(a)?l(a,b,c):"string"==typeof a?j(a,b):m(a)}function g(a){if("number"!=typeof a)throw new TypeError('"size" argument must be a number');if(a<0)throw new RangeError('"size" argument must not be negative')}function h(a,b,c){return g(a),a<=0?e(a):void 0!==b?"string"==typeof c?e(a).fill(b,c):e(a).fill(b):e(a)}function i(a){return g(a),e(a<0?0:0|n(a))}function j(a,b){if("string"==typeof b&&""!==b||(b="utf8"),!Buffer.isEncoding(b))throw new TypeError('"encoding" must be a valid string encoding');var c=0|p(a,b),d=e(c),f=d.write(a,b);return f!==c&&(d=d.slice(0,f)),d}function k(a){for(var b=a.length<0?0:0|n(a.length),c=e(b),d=0;d<b;d+=1)c[d]=255&a[d];return c}function l(a,b,c){if(b<0||a.byteLength<b)throw new RangeError("'offset' is out of bounds");if(a.byteLength<b+(c||0))throw new RangeError("'length' is out of bounds");var d;return d=void 0===b&&void 0===c?new Uint8Array(a):void 0===c?new Uint8Array(a,b):new Uint8Array(a,b,c),d.__proto__=Buffer.prototype,d}function m(a){if(Buffer.isBuffer(a)){var b=0|n(a.length),c=e(b);return 0===c.length?c:(a.copy(c,0,0,b),c)}if(a){if(U(a)||"length"in a)return"number"!=typeof a.length||V(a.length)?e(0):k(a);if("Buffer"===a.type&&Array.isArray(a.data))return k(a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function n(a){if(a>=Y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y.toString(16)+" bytes");return 0|a}function o(a){return+a!=a&&(a=0),Buffer.alloc(+a)}function p(a,b){if(Buffer.isBuffer(a))return a.length;if(U(a)||T(a))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return O(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return R(a).length;default:if(d)return O(a).length;b=(""+b).toLowerCase(),d=!0}}function q(a,b,c){var d=!1;if((void 0===b||b<0)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,b>>>=0,c<=b)return"";for(a||(a="utf8");;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"latin1":case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function r(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function s(a,b,c,d,e){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,V(c)&&(c=e?0:a.length-1),c<0&&(c=a.length+c),c>=a.length){if(e)return-1;c=a.length-1}else if(c<0){if(!e)return-1;c=0}if("string"==typeof b&&(b=Buffer.from(b,d)),Buffer.isBuffer(b))return 0===b.length?-1:t(a,b,c,d,e);if("number"==typeof b)return b&=255,"function"==typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):t(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer")}function t(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,i=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;g=2,h/=2,i/=2,c/=2}var j;if(e){var k=-1;for(j=c;j<h;j++)if(f(a,j)===f(b,k===-1?0:j-k)){if(k===-1&&(k=j),j-k+1===i)return k*g}else k!==-1&&(j-=j-k),k=-1}else for(c+i>h&&(c=h-i),j=c;j>=0;j--){for(var l=!0,m=0;m<i;m++)if(f(a,j+m)!==f(b,m)){l=!1;break}if(l)return j}return-1}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new TypeError("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g<d;++g){var h=parseInt(b.substr(2*g,2),16);if(V(h))return g;a[c+g]=h}return g}function v(a,b,c,d){return S(O(b,a.length-c),a,c,d)}function w(a,b,c,d){return S(P(b),a,c,d)}function x(a,b,c,d){return w(a,b,c,d)}function y(a,b,c,d){return S(R(b),a,c,d)}function z(a,b,c,d){return S(Q(b,a.length-c),a,c,d)}function A(a,b,c){return 0===b&&c===a.length?W.fromByteArray(a):W.fromByteArray(a.slice(b,c))}function B(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;e<c;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(l<55296||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&l<1114112&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(b<=Z)return String.fromCharCode.apply(String,a);for(var c="",d=0;d<b;)c+=String.fromCharCode.apply(String,a.slice(d,d+=Z));return c}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;++e)d+=String.fromCharCode(127&a[e]);return d}function E(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;++e)d+=String.fromCharCode(a[e]);return d}function F(a,b,c){var d=a.length;(!b||b<0)&&(b=0),(!c||c<0||c>d)&&(c=d);for(var e="",f=b;f<c;++f)e+=N(a[f]);return e}function G(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function H(a,b,c){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,f){if(!Buffer.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||b<f)throw new RangeError('"value" argument is out of bounds');if(c+d>a.length)throw new RangeError("Index out of range")}function J(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function K(a,b,c,d,e){return b=+b,c>>>=0,e||J(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(a,b,c,d,23,4),c+4}function L(a,b,c,d,e){return b=+b,c>>>=0,e||J(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(a,b,c,d,52,8),c+8}function M(a){if(a=a.trim().replace($,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function N(a){return a<16?"0"+a.toString(16):a.toString(16)}function O(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g<d;++g){if(c=a.charCodeAt(g),c>55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function P(a){for(var b=[],c=0;c<a.length;++c)b.push(255&a.charCodeAt(c));return b}function Q(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);++g)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);
10
return f}function R(a){return W.toByteArray(M(a))}function S(a,b,c,d){for(var e=0;e<d&&!(e+c>=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function T(a){return a instanceof ArrayBuffer||null!=a&&null!=a.constructor&&"ArrayBuffer"===a.constructor.name&&"number"==typeof a.byteLength}function U(a){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(a)}function V(a){return a!==a}var W=a("base64-js"),X=a("ieee754");c.Buffer=Buffer,c.SlowBuffer=o,c.INSPECT_MAX_BYTES=50;var Y=2147483647;c.kMaxLength=Y,Buffer.TYPED_ARRAY_SUPPORT=d(),Buffer.TYPED_ARRAY_SUPPORT||"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(a,b,c){return f(a,b,c)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(a,b,c){return h(a,b,c)},Buffer.allocUnsafe=function(a){return i(a)},Buffer.allocUnsafeSlow=function(a){return i(a)},Buffer.isBuffer=function(a){return null!=a&&a._isBuffer===!0},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 c=a.length,d=b.length,e=0,f=Math.min(c,d);e<f;++e)if(a[e]!==b[e]){c=a[e],d=b[e];break}return c<d?-1:d<c?1:0},Buffer.isEncoding=function(a){switch(String(a).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(a,b){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(0===a.length)return Buffer.alloc(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;++c)b+=a[c].length;var d=Buffer.allocUnsafe(b),e=0;for(c=0;c<a.length;++c){var f=a[c];if(!Buffer.isBuffer(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(d,e),e+=f.length}return d},Buffer.byteLength=p,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var b=0;b<a;b+=2)r(this,b,b+1);return this},Buffer.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var b=0;b<a;b+=4)r(this,b,b+3),r(this,b+1,b+2);return this},Buffer.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var b=0;b<a;b+=8)r(this,b,b+7),r(this,b+1,b+6),r(this,b+2,b+5),r(this,b+3,b+4);return this},Buffer.prototype.toString=function(){var a=this.length;return 0===a?"":0===arguments.length?B(this,0,a):q.apply(this,arguments)},Buffer.prototype.equals=function(a){if(!Buffer.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a||0===Buffer.compare(this,a)},Buffer.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},Buffer.prototype.compare=function(a,b,c,d,e){if(!Buffer.isBuffer(a))throw new TypeError("Argument must be a Buffer");if(void 0===b&&(b=0),void 0===c&&(c=a?a.length:0),void 0===d&&(d=0),void 0===e&&(e=this.length),b<0||c>a.length||d<0||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return-1;if(b>=c)return 1;if(b>>>=0,c>>>=0,d>>>=0,e>>>=0,this===a)return 0;for(var f=e-d,g=c-b,h=Math.min(f,g),i=this.slice(d,e),j=a.slice(b,c),k=0;k<h;++k)if(i[k]!==j[k]){f=i[k],g=j[k];break}return f<g?-1:g<f?1:0},Buffer.prototype.includes=function(a,b,c){return this.indexOf(a,b,c)!==-1},Buffer.prototype.indexOf=function(a,b,c){return s(this,a,b,c,!0)},Buffer.prototype.lastIndexOf=function(a,b,c){return s(this,a,b,c,!1)},Buffer.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else{if(!isFinite(b))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");b>>>=0,isFinite(c)?(c>>>=0,void 0===d&&(d="utf8")):(d=c,c=void 0)}var e=this.length-b;if((void 0===c||c>e)&&(c=e),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(var f=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"latin1":case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(f)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),f=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;Buffer.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c,a<0&&(a=0)):a>c&&(a=c),b<0?(b+=c,b<0&&(b=0)):b>c&&(b=c),b<a&&(b=a);var d=this.subarray(a,b);return d.__proto__=Buffer.prototype,d},Buffer.prototype.readUIntLE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},Buffer.prototype.readUIntBE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},Buffer.prototype.readUInt8=function(a,b){return a>>>=0,b||H(a,1,this.length),this[a]},Buffer.prototype.readUInt16LE=function(a,b){return a>>>=0,b||H(a,2,this.length),this[a]|this[a+1]<<8},Buffer.prototype.readUInt16BE=function(a,b){return a>>>=0,b||H(a,2,this.length),this[a]<<8|this[a+1]},Buffer.prototype.readUInt32LE=function(a,b){return a>>>=0,b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},Buffer.prototype.readUInt32BE=function(a,b){return a>>>=0,b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},Buffer.prototype.readIntLE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},Buffer.prototype.readIntBE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},Buffer.prototype.readInt8=function(a,b){return a>>>=0,b||H(a,1,this.length),128&this[a]?(255-this[a]+1)*-1:this[a]},Buffer.prototype.readInt16LE=function(a,b){a>>>=0,b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},Buffer.prototype.readInt16BE=function(a,b){a>>>=0,b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},Buffer.prototype.readInt32LE=function(a,b){return a>>>=0,b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},Buffer.prototype.readInt32BE=function(a,b){return a>>>=0,b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},Buffer.prototype.readFloatLE=function(a,b){return a>>>=0,b||H(a,4,this.length),X.read(this,a,!0,23,4)},Buffer.prototype.readFloatBE=function(a,b){return a>>>=0,b||H(a,4,this.length),X.read(this,a,!1,23,4)},Buffer.prototype.readDoubleLE=function(a,b){return a>>>=0,b||H(a,8,this.length),X.read(this,a,!0,52,8)},Buffer.prototype.readDoubleBE=function(a,b){return a>>>=0,b||H(a,8,this.length),X.read(this,a,!1,52,8)},Buffer.prototype.writeUIntLE=function(a,b,c,d){if(a=+a,b>>>=0,c>>>=0,!d){var e=Math.pow(2,8*c)-1;I(this,a,b,c,e,0)}var f=1,g=0;for(this[b]=255&a;++g<c&&(f*=256);)this[b+g]=a/f&255;return b+c},Buffer.prototype.writeUIntBE=function(a,b,c,d){if(a=+a,b>>>=0,c>>>=0,!d){var e=Math.pow(2,8*c)-1;I(this,a,b,c,e,0)}var f=c-1,g=1;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=a/g&255;return b+c},Buffer.prototype.writeUInt8=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,1,255,0),this[b]=255&a,b+1},Buffer.prototype.writeUInt16LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,65535,0),this[b]=255&a,this[b+1]=a>>>8,b+2},Buffer.prototype.writeUInt16BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,65535,0),this[b]=a>>>8,this[b+1]=255&a,b+2},Buffer.prototype.writeUInt32LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,4294967295,0),this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a,b+4},Buffer.prototype.writeUInt32BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,4294967295,0),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},Buffer.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=0;for(this[b]=255&a;++f<c&&(g*=256);)a<0&&0===h&&0!==this[b+f-1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},Buffer.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0;for(this[b+f]=255&a;--f>=0&&(g*=256);)a<0&&0===h&&0!==this[b+f+1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},Buffer.prototype.writeInt8=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,1,127,-128),a<0&&(a=255+a+1),this[b]=255&a,b+1},Buffer.prototype.writeInt16LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,32767,-32768),this[b]=255&a,this[b+1]=a>>>8,b+2},Buffer.prototype.writeInt16BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,32767,-32768),this[b]=a>>>8,this[b+1]=255&a,b+2},Buffer.prototype.writeInt32LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,2147483647,-2147483648),this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24,b+4},Buffer.prototype.writeInt32BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},Buffer.prototype.writeFloatLE=function(a,b,c){return K(this,a,b,!0,c)},Buffer.prototype.writeFloatBE=function(a,b,c){return K(this,a,b,!1,c)},Buffer.prototype.writeDoubleLE=function(a,b,c){return L(this,a,b,!0,c)},Buffer.prototype.writeDoubleBE=function(a,b,c){return L(this,a,b,!1,c)},Buffer.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d<c&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var e,f=d-c;if(this===a&&c<b&&b<d)for(e=f-1;e>=0;--e)a[e+b]=this[e+c];else if(f<1e3)for(e=0;e<f;++e)a[e+b]=this[e+c];else Uint8Array.prototype.set.call(a,this.subarray(c,c+f),b);return f},Buffer.prototype.fill=function(a,b,c,d){if("string"==typeof a){if("string"==typeof b?(d=b,b=0,c=this.length):"string"==typeof c&&(d=c,c=this.length),1===a.length){var e=a.charCodeAt(0);e<256&&(a=e)}if(void 0!==d&&"string"!=typeof d)throw new TypeError("encoding must be a string");if("string"==typeof d&&!Buffer.isEncoding(d))throw new TypeError("Unknown encoding: "+d)}else"number"==typeof a&&(a&=255);if(b<0||this.length<b||this.length<c)throw new RangeError("Out of range index");if(c<=b)return this;b>>>=0,c=void 0===c?this.length:c>>>0,a||(a=0);var f;if("number"==typeof a)for(f=b;f<c;++f)this[f]=a;else{var g=Buffer.isBuffer(a)?a:new Buffer(a,d),h=g.length;for(f=0;f<c-b;++f)this[f+b]=g[f%h]}return this};var $=/[^+\/0-9A-Za-z-_]/g},{"base64-js":105,ieee754:224}],105:[function(a,b,c){"use strict";function d(a){var b=a.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h=a.length;f=d(a),g=new l(3*h/4-f),c=f>0?h-4:h;var i=0;for(b=0;b<c;b+=4)e=k[a.charCodeAt(b)]<<18|k[a.charCodeAt(b+1)]<<12|k[a.charCodeAt(b+2)]<<6|k[a.charCodeAt(b+3)],g[i++]=e>>16&255,g[i++]=e>>8&255,g[i++]=255&e;return 2===f?(e=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,g[i++]=255&e):1===f&&(e=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,g[i++]=e>>8&255,g[i++]=255&e),g}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;f<c;f+=3)d=(a[f]<<16)+(a[f+1]<<8)+a[f+2],e.push(g(d));return e.join("")}function i(a){for(var b,c=a.length,d=c%3,e="",f=[],g=16383,i=0,k=c-d;i<k;i+=g)f.push(h(a,i,i+g>k?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;n<o;++n)j[n]=m[n],k[m.charCodeAt(n)]=n;k["-".charCodeAt(0)]=62,k["_".charCodeAt(0)]=63},{}],106:[function(a,b,c){function d(a){e.call(this),this.hashMode="string"==typeof a,this.hashMode?this[a]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}var Buffer=a("safe-buffer").Buffer,e=a("stream").Transform,f=a("string_decoder").StringDecoder,g=a("inherits");g(d,e),d.prototype.update=function(a,b,c){"string"==typeof a&&(a=Buffer.from(a,b));var d=this._update(a);return this.hashMode?this:(c&&(d=this._toString(d,c)),d)},d.prototype.setAutoPadding=function(){},d.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},d.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},d.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},d.prototype._transform=function(a,b,c){var d;try{this.hashMode?this._update(a):this.push(this._update(a))}catch(a){d=a}finally{c(d)}},d.prototype._flush=function(a){var b;try{this.push(this.__final())}catch(a){b=a}a(b)},d.prototype._finalOrDigest=function(a){var b=this.__final()||Buffer.alloc(0);return a&&(b=this._toString(b,a,!0)),b},d.prototype._toString=function(a,b,c){if(this._decoder||(this._decoder=new f(b),this._encoding=b),this._encoding!==b)throw new Error("can't switch encodings");var d=this._decoder.write(a);return c&&(d+=this._decoder.end()),d},b.exports=d},{inherits:226,"safe-buffer":288,stream:304,string_decoder:305}],107:[function(a,b,c){function d(a){if(a)return e(a)}function e(a){for(var b in d.prototype)a[b]=d.prototype[b];return a}b.exports=d,d.prototype.on=d.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks[a]=this._callbacks[a]||[]).push(b),this},d.prototype.once=function(a,b){function c(){d.off(a,c),b.apply(this,arguments)}var d=this;return this._callbacks=this._callbacks||{},c.fn=b,this.on(a,c),this},d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks[a];if(!c)return this;if(1==arguments.length)return delete this._callbacks[a],this;for(var d,e=0;e<c.length;e++)if(d=c[e],d===b||d.fn===b){c.splice(e,1);break}return this},d.prototype.emit=function(a){this._callbacks=this._callbacks||{};var b=[].slice.call(arguments,1),c=this._callbacks[a];if(c){c=c.slice(0);for(var d=0,e=c.length;d<e;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks[a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],108:[function(a,b,c){(function(Buffer){function a(a){return Array.isArray?Array.isArray(a):"[object Array]"===p(a)}function b(a){return"boolean"==typeof a}function d(a){return null===a}function e(a){return null==a}function f(a){return"number"==typeof a}function g(a){return"string"==typeof a}function h(a){return"symbol"==typeof a}function i(a){return void 0===a}function j(a){return"[object RegExp]"===p(a)}function k(a){return"object"==typeof a&&null!==a}function l(a){return"[object Date]"===p(a)}function m(a){return"[object Error]"===p(a)||a instanceof Error}function n(a){return"function"==typeof a}function o(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function p(a){return Object.prototype.toString.call(a)}c.isArray=a,c.isBoolean=b,c.isNull=d,c.isNullOrUndefined=e,c.isNumber=f,c.isString=g,c.isSymbol=h,c.isUndefined=i,c.isRegExp=j,c.isObject=k,c.isDate=l,c.isError=m,c.isFunction=n,c.isPrimitive=o,c.isBuffer=Buffer.isBuffer}).call(this,{isBuffer:a("../../is-buffer/index.js")})},{"../../is-buffer/index.js":227}],109:[function(a,b,c){(function(Buffer){function c(a){this.curveType=g[a],this.curveType||(this.curveType={name:a}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function d(a,b,c){Array.isArray(a)||(a=a.toArray());var d=new Buffer(a);if(c&&d.length<c){var e=new Buffer(c-d.length);e.fill(0),d=Buffer.concat([e,d])}return b?d.toString(b):d}var e=a("elliptic"),f=a("bn.js");b.exports=function(a){return new c(a)};var g={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};g.p224=g.secp224r1,g.p256=g.secp256r1=g.prime256v1,g.p192=g.secp192r1=g.prime192v1,g.p384=g.secp384r1,g.p521=g.secp521r1,c.prototype.generateKeys=function(a,b){return this.keys=this.curve.genKeyPair(),this.getPublicKey(a,b)},c.prototype.computeSecret=function(a,b,c){b=b||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,b));var e=this.curve.keyFromPublic(a).getPublic(),f=e.mul(this.keys.getPrivate()).getX();return d(f,c,this.curveType.byteLength)},c.prototype.getPublicKey=function(a,b){var c=this.keys.getPublic("compressed"===b,!0);return"hybrid"===b&&(c[c.length-1]%2?c[0]=7:c[0]=6),d(c,a)},c.prototype.getPrivateKey=function(a){return d(this.keys.getPrivate(),a)},c.prototype.setPublicKey=function(a,b){return b=b||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,b)),this.keys._importPublic(a),this},c.prototype.setPrivateKey=function(a,b){b=b||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,b));var c=new f(a);return c=c.toString(16),this.keys._importPrivate(c),this}}).call(this,a("buffer").Buffer)},{"bn.js":75,buffer:104,elliptic:192}],110:[function(a,b,c){(function(Buffer){"use strict";function c(a){i.call(this,"digest"),this._hash=a,this.buffers=[]}function d(a){i.call(this,"digest"),this._hash=a}var e=a("inherits"),f=a("./md5"),g=a("ripemd160"),h=a("sha.js"),i=a("cipher-base");e(c,i),c.prototype._update=function(a){this.buffers.push(a)},c.prototype._final=function(){var a=Buffer.concat(this.buffers),b=this._hash(a);return this.buffers=null,b},e(d,i),d.prototype._update=function(a){this._hash.update(a)},d.prototype._final=function(){return this._hash.digest()},b.exports=function(a){return a=a.toLowerCase(),"md5"===a?new c(f):new d("rmd160"===a||"ripemd160"===a?new g:h(a))}}).call(this,a("buffer").Buffer)},{"./md5":112,buffer:104,"cipher-base":106,inherits:226,ripemd160:287,"sha.js":296}],111:[function(a,b,c){(function(Buffer){"use strict";function a(a){if(a.length%c!==0){var b=a.length+(c-a.length%c);a=Buffer.concat([a,d],b)}for(var e=new Array(a.length>>>2),f=0,g=0;f<a.length;f+=c,g++)e[g]=a.readInt32LE(f);return e}var c=4,d=new Buffer(c);d.fill(0);var e=8,f=16;b.exports=function(b,c){var d=c(a(b),b.length*e);b=new Buffer(f);for(var g=0;g<d.length;g++)b.writeInt32LE(d[g],g<<2,!0);return b}}).call(this,a("buffer").Buffer)},{buffer:104}],112:[function(a,b,c){"use strict";function d(a,b){a[b>>5]|=128<<b%32,a[(b+64>>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,k=271733878,l=0;l<a.length;l+=16){var m=c,n=d,o=e,p=k;c=f(c,d,e,k,a[l+0],7,-680876936),k=f(k,c,d,e,a[l+1],12,-389564586),e=f(e,k,c,d,a[l+2],17,606105819),d=f(d,e,k,c,a[l+3],22,-1044525330),c=f(c,d,e,k,a[l+4],7,-176418897),k=f(k,c,d,e,a[l+5],12,1200080426),e=f(e,k,c,d,a[l+6],17,-1473231341),d=f(d,e,k,c,a[l+7],22,-45705983),c=f(c,d,e,k,a[l+8],7,1770035416),k=f(k,c,d,e,a[l+9],12,-1958414417),e=f(e,k,c,d,a[l+10],17,-42063),d=f(d,e,k,c,a[l+11],22,-1990404162),c=f(c,d,e,k,a[l+12],7,1804603682),k=f(k,c,d,e,a[l+13],12,-40341101),e=f(e,k,c,d,a[l+14],17,-1502002290),d=f(d,e,k,c,a[l+15],22,1236535329),c=g(c,d,e,k,a[l+1],5,-165796510),k=g(k,c,d,e,a[l+6],9,-1069501632),e=g(e,k,c,d,a[l+11],14,643717713),d=g(d,e,k,c,a[l+0],20,-373897302),c=g(c,d,e,k,a[l+5],5,-701558691),k=g(k,c,d,e,a[l+10],9,38016083),e=g(e,k,c,d,a[l+15],14,-660478335),d=g(d,e,k,c,a[l+4],20,-405537848),c=g(c,d,e,k,a[l+9],5,568446438),k=g(k,c,d,e,a[l+14],9,-1019803690),e=g(e,k,c,d,a[l+3],14,-187363961),d=g(d,e,k,c,a[l+8],20,1163531501),c=g(c,d,e,k,a[l+13],5,-1444681467),k=g(k,c,d,e,a[l+2],9,-51403784),e=g(e,k,c,d,a[l+7],14,1735328473),d=g(d,e,k,c,a[l+12],20,-1926607734),c=h(c,d,e,k,a[l+5],4,-378558),k=h(k,c,d,e,a[l+8],11,-2022574463),e=h(e,k,c,d,a[l+11],16,1839030562),d=h(d,e,k,c,a[l+14],23,-35309556),c=h(c,d,e,k,a[l+1],4,-1530992060),k=h(k,c,d,e,a[l+4],11,1272893353),e=h(e,k,c,d,a[l+7],16,-155497632),d=h(d,e,k,c,a[l+10],23,-1094730640),c=h(c,d,e,k,a[l+13],4,681279174),k=h(k,c,d,e,a[l+0],11,-358537222),e=h(e,k,c,d,a[l+3],16,-722521979),d=h(d,e,k,c,a[l+6],23,76029189),c=h(c,d,e,k,a[l+9],4,-640364487),k=h(k,c,d,e,a[l+12],11,-421815835),e=h(e,k,c,d,a[l+15],16,530742520),d=h(d,e,k,c,a[l+2],23,-995338651),c=i(c,d,e,k,a[l+0],6,-198630844),k=i(k,c,d,e,a[l+7],10,1126891415),e=i(e,k,c,d,a[l+14],15,-1416354905),d=i(d,e,k,c,a[l+5],21,-57434055),c=i(c,d,e,k,a[l+12],6,1700485571),k=i(k,c,d,e,a[l+3],10,-1894986606),e=i(e,k,c,d,a[l+10],15,-1051523),d=i(d,e,k,c,a[l+1],21,-2054922799),c=i(c,d,e,k,a[l+8],6,1873313359),k=i(k,c,d,e,a[l+15],10,-30611744),e=i(e,k,c,d,a[l+6],15,-1560198380),d=i(d,e,k,c,a[l+13],21,1309151649),c=i(c,d,e,k,a[l+4],6,-145523070),k=i(k,c,d,e,a[l+11],10,-1120210379),e=i(e,k,c,d,a[l+2],15,718787259),d=i(d,e,k,c,a[l+9],21,-343485551),c=j(c,m),d=j(d,n),e=j(e,o),k=j(k,p)}return[c,d,e,k]}function e(a,b,c,d,e,f){return j(k(j(j(b,a),j(d,f)),e),c)}function f(a,b,c,d,f,g,h){return e(b&c|~b&d,a,b,f,g,h)}function g(a,b,c,d,f,g,h){return e(b&d|c&~d,a,b,f,g,h)}function h(a,b,c,d,f,g,h){return e(b^c^d,a,b,f,g,h)}function i(a,b,c,d,f,g,h){return e(c^(b|~d),a,b,f,g,h)}function j(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function k(a,b){return a<<b|a>>>32-b}var l=a("./make-hash");b.exports=function(a){return l(a,d)}},{"./make-hash":111}],113:[function(a,b,c){"use strict";function d(a,b){g.call(this,"digest"),"string"==typeof b&&(b=Buffer.from(b));var c="sha512"===a||"sha384"===a?128:64;if(this._alg=a,this._key=b,b.length>c){var d="rmd160"===a?new i:j(a);b=d.update(b).digest()}else b.length<c&&(b=Buffer.concat([b,k],c));for(var e=this._ipad=Buffer.allocUnsafe(c),f=this._opad=Buffer.allocUnsafe(c),h=0;h<c;h++)e[h]=54^b[h],f[h]=92^b[h];this._hash="rmd160"===a?new i:j(a),this._hash.update(e)}var e=a("inherits"),f=a("./legacy"),g=a("cipher-base"),Buffer=a("safe-buffer").Buffer,h=a("create-hash/md5"),i=a("ripemd160"),j=a("sha.js"),k=Buffer.alloc(128);e(d,g),d.prototype._update=function(a){this._hash.update(a)},d.prototype._final=function(){var a=this._hash.digest(),b="rmd160"===this._alg?new i:j(this._alg);return b.update(this._opad).update(a).digest()},b.exports=function(a,b){return a=a.toLowerCase(),"rmd160"===a||"ripemd160"===a?new d("rmd160",b):"md5"===a?new f(h,b):new d(a,b)}},{"./legacy":114,"cipher-base":106,"create-hash/md5":112,inherits:226,ripemd160:287,"safe-buffer":288,"sha.js":296}],114:[function(a,b,c){"use strict";function d(a,b){f.call(this,"digest"),"string"==typeof b&&(b=Buffer.from(b)),this._alg=a,this._key=b,b.length>h?b=a(b):b.length<h&&(b=Buffer.concat([b,g],h));for(var c=this._ipad=Buffer.allocUnsafe(h),d=this._opad=Buffer.allocUnsafe(h),e=0;e<h;e++)c[e]=54^b[e],d[e]=92^b[e];this._hash=[c]}var e=a("inherits"),Buffer=a("safe-buffer").Buffer,f=a("cipher-base"),g=Buffer.alloc(128),h=64;e(d,f),d.prototype._update=function(a){this._hash.push(a)},d.prototype._final=function(){var a=this._alg(Buffer.concat(this._hash));return this._alg(Buffer.concat([this._opad,a]))},b.exports=d},{"cipher-base":106,inherits:226,"safe-buffer":288}],115:[function(a,b,c){"use strict";c.randomBytes=c.rng=c.pseudoRandomBytes=c.prng=a("randombytes"),c.createHash=c.Hash=a("create-hash"),c.createHmac=c.Hmac=a("create-hmac");var d=a("browserify-sign/algos"),e=Object.keys(d),f=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(e);c.getHashes=function(){return f};var g=a("pbkdf2");c.pbkdf2=g.pbkdf2,c.pbkdf2Sync=g.pbkdf2Sync;var h=a("browserify-cipher");c.Cipher=h.Cipher,c.createCipher=h.createCipher,c.Cipheriv=h.Cipheriv,c.createCipheriv=h.createCipheriv,c.Decipher=h.Decipher,c.createDecipher=h.createDecipher,c.Decipheriv=h.Decipheriv,c.createDecipheriv=h.createDecipheriv,c.getCiphers=h.getCiphers,c.listCiphers=h.listCiphers;var i=a("diffie-hellman");c.DiffieHellmanGroup=i.DiffieHellmanGroup,c.createDiffieHellmanGroup=i.createDiffieHellmanGroup,c.getDiffieHellman=i.getDiffieHellman,c.createDiffieHellman=i.createDiffieHellman,c.DiffieHellman=i.DiffieHellman;var j=a("browserify-sign");c.createSign=j.createSign,c.Sign=j.Sign,c.createVerify=j.createVerify,c.Verify=j.Verify,c.createECDH=a("create-ecdh");var k=a("public-encrypt");c.publicEncrypt=k.publicEncrypt,c.privateEncrypt=k.privateEncrypt,c.publicDecrypt=k.publicDecrypt,c.privateDecrypt=k.privateDecrypt;var l=a("randomfill");c.randomFill=l.randomFill,c.randomFillSync=l.randomFillSync,c.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},c.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},{"browserify-cipher":95,"browserify-sign":134,"browserify-sign/algos":131,"create-ecdh":109,"create-hash":110,"create-hmac":113,"diffie-hellman":183,pbkdf2:236,"public-encrypt":239,randombytes:271,randomfill:272}],116:[function(a,b,c){var d=c;d.bignum=a("bn.js"),d.define=a("./asn1/api").define,d.base=a("./asn1/base"),d.constants=a("./asn1/constants"),d.decoders=a("./asn1/decoders"),d.encoders=a("./asn1/encoders")},{"./asn1/api":117,"./asn1/base":119,"./asn1/constants":123,"./asn1/decoders":125,"./asn1/encoders":128,"bn.js":75}],117:[function(a,b,c){function d(a,b){this.name=a,this.body=b,this.decoders={},this.encoders={}}var e=a("../asn1"),f=a("inherits"),g=c;g.define=function(a,b){return new d(a,b)},d.prototype._createNamed=function(b){var c;try{c=a("vm").runInThisContext("(function "+this.name+"(entity) {\n  this._initNamed(entity);\n})")}catch(a){c=function(a){this._initNamed(a)}}return f(c,b),c.prototype._initNamed=function(a){b.call(this,a)},new c(this)},d.prototype._getDecoder=function(a){return a=a||"der",this.decoders.hasOwnProperty(a)||(this.decoders[a]=this._createNamed(e.decoders[a])),this.decoders[a]},d.prototype.decode=function(a,b,c){return this._getDecoder(b).decode(a,c)},d.prototype._getEncoder=function(a){return a=a||"der",this.encoders.hasOwnProperty(a)||(this.encoders[a]=this._createNamed(e.encoders[a])),this.encoders[a]},d.prototype.encode=function(a,b,c){return this._getEncoder(b).encode(a,c)}},{"../asn1":116,inherits:226,vm:322}],118:[function(a,b,c){function d(a,b){return g.call(this,b),Buffer.isBuffer(a)?(this.base=a,this.offset=0,void(this.length=a.length)):void this.error("Input not Buffer")}function e(a,b){if(Array.isArray(a))this.length=0,this.value=a.map(function(a){return a instanceof e||(a=new e(a,b)),this.length+=a.length,a},this);else if("number"==typeof a){if(!(0<=a&&a<=255))return b.error("non-byte EncoderBuffer value");this.value=a,this.length=1}else if("string"==typeof a)this.value=a,this.length=Buffer.byteLength(a);else{if(!Buffer.isBuffer(a))return b.error("Unsupported type: "+typeof a);this.value=a,this.length=a.length}}var f=a("inherits"),g=a("../base").Reporter,Buffer=a("buffer").Buffer;f(d,g),c.DecoderBuffer=d,d.prototype.save=function(){return{offset:this.offset,reporter:g.prototype.save.call(this)}},d.prototype.restore=function(a){var b=new d(this.base);return b.offset=a.offset,b.length=this.offset,this.offset=a.offset,g.prototype.restore.call(this,a.reporter),b},d.prototype.isEmpty=function(){return this.offset===this.length},d.prototype.readUInt8=function(a){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(a||"DecoderBuffer overrun")},d.prototype.skip=function(a,b){if(!(this.offset+a<=this.length))return this.error(b||"DecoderBuffer overrun");var c=new d(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+a,this.offset+=a,c},d.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)},c.EncoderBuffer=e,e.prototype.join=function(a,b){return a||(a=new Buffer(this.length)),b||(b=0),0===this.length?a:(Array.isArray(this.value)?this.value.forEach(function(c){c.join(a,b),b+=c.length}):("number"==typeof this.value?a[b]=this.value:"string"==typeof this.value?a.write(this.value,b):Buffer.isBuffer(this.value)&&this.value.copy(a,b),b+=this.length),a)}},{"../base":119,buffer:104,inherits:226}],119:[function(a,b,c){var d=c;d.Reporter=a("./reporter").Reporter,d.DecoderBuffer=a("./buffer").DecoderBuffer,d.EncoderBuffer=a("./buffer").EncoderBuffer,d.Node=a("./node")},{"./buffer":118,"./node":120,"./reporter":121}],120:[function(a,b,c){function d(a,b){var c={};this._baseState=c,c.enc=a,c.parent=b||null,c.children=null,c.tag=null,c.args=null,c.reverseArgs=null,c.choice=null,c.optional=!1,c.any=!1,c.obj=!1,c.use=null,c.useDecoder=null,c.key=null,c.default=null,c.explicit=null,c.implicit=null,c.contains=null,c.parent||(c.children=[],this._wrap())}var e=a("../base").Reporter,f=a("../base").EncoderBuffer,g=a("../base").DecoderBuffer,h=a("minimalistic-assert"),i=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],j=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i),k=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];b.exports=d;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var a=this._baseState,b={};l.forEach(function(c){b[c]=a[c]});var c=new this.constructor(b.parent);return c._baseState=b,c},d.prototype._wrap=function(){var a=this._baseState;j.forEach(function(b){this[b]=function(){var c=new this.constructor(this);return a.children.push(c),c[b].apply(c,arguments)}},this)},d.prototype._init=function(a){var b=this._baseState;h(null===b.parent),a.call(this),b.children=b.children.filter(function(a){return a._baseState.parent===this},this),h.equal(b.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(a){var b=this._baseState,c=a.filter(function(a){return a instanceof this.constructor},this);a=a.filter(function(a){return!(a instanceof this.constructor)},this),0!==c.length&&(h(null===b.children),b.children=c,c.forEach(function(a){a._baseState.parent=this},this)),0!==a.length&&(h(null===b.args),b.args=a,b.reverseArgs=a.map(function(a){if("object"!=typeof a||a.constructor!==Object)return a;var b={};
11
return Object.keys(a).forEach(function(c){c==(0|c)&&(c|=0);var d=a[c];b[d]=c}),b}))},k.forEach(function(a){d.prototype[a]=function(){var b=this._baseState;throw new Error(a+" not implemented for encoding: "+b.enc)}}),i.forEach(function(a){d.prototype[a]=function(){var b=this._baseState,c=Array.prototype.slice.call(arguments);return h(null===b.tag),b.tag=a,this._useArgs(c),this}}),d.prototype.use=function(a){h(a);var b=this._baseState;return h(null===b.use),b.use=a,this},d.prototype.optional=function(){var a=this._baseState;return a.optional=!0,this},d.prototype.def=function(a){var b=this._baseState;return h(null===b.default),b.default=a,b.optional=!0,this},d.prototype.explicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.explicit=a,this},d.prototype.implicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.implicit=a,this},d.prototype.obj=function(){var a=this._baseState,b=Array.prototype.slice.call(arguments);return a.obj=!0,0!==b.length&&this._useArgs(b),this},d.prototype.key=function(a){var b=this._baseState;return h(null===b.key),b.key=a,this},d.prototype.any=function(){var a=this._baseState;return a.any=!0,this},d.prototype.choice=function(a){var b=this._baseState;return h(null===b.choice),b.choice=a,this._useArgs(Object.keys(a).map(function(b){return a[b]})),this},d.prototype.contains=function(a){var b=this._baseState;return h(null===b.use),b.contains=a,this},d.prototype._decode=function(a,b){var c=this._baseState;if(null===c.parent)return a.wrapResult(c.children[0]._decode(a,b));var d=c.default,e=!0,f=null;if(null!==c.key&&(f=a.enterKey(c.key)),c.optional){var h=null;if(null!==c.explicit?h=c.explicit:null!==c.implicit?h=c.implicit:null!==c.tag&&(h=c.tag),null!==h||c.any){if(e=this._peekTag(a,h,c.any),a.isError(e))return e}else{var i=a.save();try{null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),e=!0}catch(a){e=!1}a.restore(i)}}var j;if(c.obj&&e&&(j=a.enterObject()),e){if(null!==c.explicit){var k=this._decodeTag(a,c.explicit);if(a.isError(k))return k;a=k}var l=a.offset;if(null===c.use&&null===c.choice){if(c.any)var i=a.save();var m=this._decodeTag(a,null!==c.implicit?c.implicit:c.tag,c.any);if(a.isError(m))return m;c.any?d=a.raw(i):a=m}if(b&&b.track&&null!==c.tag&&b.track(a.path(),l,a.length,"tagged"),b&&b.track&&null!==c.tag&&b.track(a.path(),a.offset,a.length,"content"),d=c.any?d:null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),a.isError(d))return d;if(c.any||null!==c.choice||null===c.children||c.children.forEach(function(c){c._decode(a,b)}),c.contains&&("octstr"===c.tag||"bitstr"===c.tag)){var n=new g(d);d=this._getUse(c.contains,a._reporterState.obj)._decode(n,b)}}return c.obj&&e&&(d=a.leaveObject(j)),null===c.key||null===d&&e!==!0?null!==f&&a.exitKey(f):a.leaveKey(f,c.key,d),d},d.prototype._decodeGeneric=function(a,b,c){var d=this._baseState;return"seq"===a||"set"===a?null:"seqof"===a||"setof"===a?this._decodeList(b,a,d.args[0],c):/str$/.test(a)?this._decodeStr(b,a,c):"objid"===a&&d.args?this._decodeObjid(b,d.args[0],d.args[1],c):"objid"===a?this._decodeObjid(b,null,null,c):"gentime"===a||"utctime"===a?this._decodeTime(b,a,c):"null_"===a?this._decodeNull(b,c):"bool"===a?this._decodeBool(b,c):"objDesc"===a?this._decodeStr(b,a,c):"int"===a||"enum"===a?this._decodeInt(b,d.args&&d.args[0],c):null!==d.use?this._getUse(d.use,b._reporterState.obj)._decode(b,c):b.error("unknown tag: "+a)},d.prototype._getUse=function(a,b){var c=this._baseState;return c.useDecoder=this._use(a,b),h(null===c.useDecoder._baseState.parent),c.useDecoder=c.useDecoder._baseState.children[0],c.implicit!==c.useDecoder._baseState.implicit&&(c.useDecoder=c.useDecoder.clone(),c.useDecoder._baseState.implicit=c.implicit),c.useDecoder},d.prototype._decodeChoice=function(a,b){var c=this._baseState,d=null,e=!1;return Object.keys(c.choice).some(function(f){var g=a.save(),h=c.choice[f];try{var i=h._decode(a,b);if(a.isError(i))return!1;d={type:f,value:i},e=!0}catch(b){return a.restore(g),!1}return!0},this),e?d:a.error("Choice not matched")},d.prototype._createEncoderBuffer=function(a){return new f(a,this.reporter)},d.prototype._encode=function(a,b,c){var d=this._baseState;if(null===d.default||d.default!==a){var e=this._encodeValue(a,b,c);if(void 0!==e&&!this._skipDefault(e,b,c))return e}},d.prototype._encodeValue=function(a,b,c){var d=this._baseState;if(null===d.parent)return d.children[0]._encode(a,b||new e);var f=null;if(this.reporter=b,d.optional&&void 0===a){if(null===d.default)return;a=d.default}var g=null,h=!1;if(d.any)f=this._createEncoderBuffer(a);else if(d.choice)f=this._encodeChoice(a,b);else if(d.contains)g=this._getUse(d.contains,c)._encode(a,b),h=!0;else if(d.children)g=d.children.map(function(c){if("null_"===c._baseState.tag)return c._encode(null,b,a);if(null===c._baseState.key)return b.error("Child should have a key");var d=b.enterKey(c._baseState.key);if("object"!=typeof a)return b.error("Child expected, but input is not object");var e=c._encode(a[c._baseState.key],b,a);return b.leaveKey(d),e},this).filter(function(a){return a}),g=this._createEncoderBuffer(g);else if("seqof"===d.tag||"setof"===d.tag){if(!d.args||1!==d.args.length)return b.error("Too many args for : "+d.tag);if(!Array.isArray(a))return b.error("seqof/setof, but data is not Array");var i=this.clone();i._baseState.implicit=null,g=this._createEncoderBuffer(a.map(function(c){var d=this._baseState;return this._getUse(d.args[0],a)._encode(c,b)},i))}else null!==d.use?f=this._getUse(d.use,c)._encode(a,b):(g=this._encodePrimitive(d.tag,a),h=!0);var f;if(!d.any&&null===d.choice){var j=null!==d.implicit?d.implicit:d.tag,k=null===d.implicit?"universal":"context";null===j?null===d.use&&b.error("Tag could be omitted only for .use()"):null===d.use&&(f=this._encodeComposite(j,h,k,g))}return null!==d.explicit&&(f=this._encodeComposite(d.explicit,!1,"context",f)),f},d.prototype._encodeChoice=function(a,b){var c=this._baseState,d=c.choice[a.type];return d||h(!1,a.type+" not found in "+JSON.stringify(Object.keys(c.choice))),d._encode(a.value,b)},d.prototype._encodePrimitive=function(a,b){var c=this._baseState;if(/str$/.test(a))return this._encodeStr(b,a);if("objid"===a&&c.args)return this._encodeObjid(b,c.reverseArgs[0],c.args[1]);if("objid"===a)return this._encodeObjid(b,null,null);if("gentime"===a||"utctime"===a)return this._encodeTime(b,a);if("null_"===a)return this._encodeNull();if("int"===a||"enum"===a)return this._encodeInt(b,c.args&&c.reverseArgs[0]);if("bool"===a)return this._encodeBool(b);if("objDesc"===a)return this._encodeStr(b,a);throw new Error("Unsupported tag: "+a)},d.prototype._isNumstr=function(a){return/^[0-9 ]*$/.test(a)},d.prototype._isPrintstr=function(a){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(a)}},{"../base":119,"minimalistic-assert":234}],121:[function(a,b,c){function d(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}function e(a,b){this.path=a,this.rethrow(b)}var f=a("inherits");c.Reporter=d,d.prototype.isError=function(a){return a instanceof e},d.prototype.save=function(){var a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},d.prototype.restore=function(a){var b=this._reporterState;b.obj=a.obj,b.path=b.path.slice(0,a.pathLen)},d.prototype.enterKey=function(a){return this._reporterState.path.push(a)},d.prototype.exitKey=function(a){var b=this._reporterState;b.path=b.path.slice(0,a-1)},d.prototype.leaveKey=function(a,b,c){var d=this._reporterState;this.exitKey(a),null!==d.obj&&(d.obj[b]=c)},d.prototype.path=function(){return this._reporterState.path.join("/")},d.prototype.enterObject=function(){var a=this._reporterState,b=a.obj;return a.obj={},b},d.prototype.leaveObject=function(a){var b=this._reporterState,c=b.obj;return b.obj=a,c},d.prototype.error=function(a){var b,c=this._reporterState,d=a instanceof e;if(b=d?a:new e(c.path.map(function(a){return"["+JSON.stringify(a)+"]"}).join(""),a.message||a,a.stack),!c.options.partial)throw b;return d||c.errors.push(b),b},d.prototype.wrapResult=function(a){var b=this._reporterState;return b.options.partial?{result:this.isError(a)?null:a,errors:b.errors}:a},f(e,Error),e.prototype.rethrow=function(a){if(this.message=a+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(a){this.stack=a.stack}return this}},{inherits:226}],122:[function(a,b,c){var d=a("../constants");c.tagClass={0:"universal",1:"application",2:"context",3:"private"},c.tagClassByName=d._reverse(c.tagClass),c.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},c.tagByName=d._reverse(c.tag)},{"../constants":123}],123:[function(a,b,c){var d=c;d._reverse=function(a){var b={};return Object.keys(a).forEach(function(c){(0|c)==c&&(c|=0);var d=a[c];b[d]=c}),b},d.der=a("./der")},{"./der":122}],124:[function(a,b,c){function d(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new e,this.tree._init(a.body)}function e(a){j.Node.call(this,"der",a)}function f(a,b){var c=a.readUInt8(b);if(a.isError(c))return c;var d=l.tagClass[c>>6],e=0===(32&c);if(31===(31&c)){var f=c;for(c=0;128===(128&f);){if(f=a.readUInt8(b),a.isError(f))return f;c<<=7,c|=127&f}}else c&=31;var g=l.tag[c];return{cls:d,primitive:e,tag:c,tagStr:g}}function g(a,b,c){var d=a.readUInt8(c);if(a.isError(d))return d;if(!b&&128===d)return null;if(0===(128&d))return d;var e=127&d;if(e>4)return a.error("length octect is too long");d=0;for(var f=0;f<e;f++){d<<=8;var g=a.readUInt8(c);if(a.isError(g))return g;d|=g}return d}var h=a("inherits"),i=a("../../asn1"),j=i.base,k=i.bignum,l=i.constants.der;b.exports=d,d.prototype.decode=function(a,b){return a instanceof j.DecoderBuffer||(a=new j.DecoderBuffer(a,b)),this.tree._decode(a,b)},h(e,j.Node),e.prototype._peekTag=function(a,b,c){if(a.isEmpty())return!1;var d=a.save(),e=f(a,'Failed to peek tag: "'+b+'"');return a.isError(e)?e:(a.restore(d),e.tag===b||e.tagStr===b||e.tagStr+"of"===b||c)},e.prototype._decodeTag=function(a,b,c){var d=f(a,'Failed to decode tag of "'+b+'"');if(a.isError(d))return d;var e=g(a,d.primitive,'Failed to get length of "'+b+'"');if(a.isError(e))return e;if(!c&&d.tag!==b&&d.tagStr!==b&&d.tagStr+"of"!==b)return a.error('Failed to match tag: "'+b+'"');if(d.primitive||null!==e)return a.skip(e,'Failed to match body of: "'+b+'"');var h=a.save(),i=this._skipUntilEnd(a,'Failed to skip indefinite length body: "'+this.tag+'"');return a.isError(i)?i:(e=a.offset-h.offset,a.restore(h),a.skip(e,'Failed to match body of: "'+b+'"'))},e.prototype._skipUntilEnd=function(a,b){for(;;){var c=f(a,b);if(a.isError(c))return c;var d=g(a,c.primitive,b);if(a.isError(d))return d;var e;if(e=c.primitive||null!==d?a.skip(d):this._skipUntilEnd(a,b),a.isError(e))return e;if("end"===c.tagStr)break}},e.prototype._decodeList=function(a,b,c,d){for(var e=[];!a.isEmpty();){var f=this._peekTag(a,"end");if(a.isError(f))return f;var g=c.decode(a,"der",d);if(a.isError(g)&&f)break;e.push(g)}return e},e.prototype._decodeStr=function(a,b){if("bitstr"===b){var c=a.readUInt8();return a.isError(c)?c:{unused:c,data:a.raw()}}if("bmpstr"===b){var d=a.raw();if(d.length%2===1)return a.error("Decoding of string type: bmpstr length mismatch");for(var e="",f=0;f<d.length/2;f++)e+=String.fromCharCode(d.readUInt16BE(2*f));return e}if("numstr"===b){var g=a.raw().toString("ascii");return this._isNumstr(g)?g:a.error("Decoding of string type: numstr unsupported characters")}if("octstr"===b)return a.raw();if("objDesc"===b)return a.raw();if("printstr"===b){var h=a.raw().toString("ascii");return this._isPrintstr(h)?h:a.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(b)?a.raw().toString():a.error("Decoding of string type: "+b+" unsupported")},e.prototype._decodeObjid=function(a,b,c){for(var d,e=[],f=0;!a.isEmpty();){var g=a.readUInt8();f<<=7,f|=127&g,0===(128&g)&&(e.push(f),f=0)}128&g&&e.push(f);var h=e[0]/40|0,i=e[0]%40;if(d=c?e:[h,i].concat(e.slice(1)),b){var j=b[d.join(" ")];void 0===j&&(j=b[d.join(".")]),void 0!==j&&(d=j)}return d},e.prototype._decodeTime=function(a,b){var c=a.raw().toString();if("gentime"===b)var d=0|c.slice(0,4),e=0|c.slice(4,6),f=0|c.slice(6,8),g=0|c.slice(8,10),h=0|c.slice(10,12),i=0|c.slice(12,14);else{if("utctime"!==b)return a.error("Decoding "+b+" time is not supported yet");var d=0|c.slice(0,2),e=0|c.slice(2,4),f=0|c.slice(4,6),g=0|c.slice(6,8),h=0|c.slice(8,10),i=0|c.slice(10,12);d=d<70?2e3+d:1900+d}return Date.UTC(d,e-1,f,g,h,i,0)},e.prototype._decodeNull=function(a){return null},e.prototype._decodeBool=function(a){var b=a.readUInt8();return a.isError(b)?b:0!==b},e.prototype._decodeInt=function(a,b){var c=a.raw(),d=new k(c);return b&&(d=b[d.toString(10)]||d),d},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getDecoder("der").tree}},{"../../asn1":116,inherits:226}],125:[function(a,b,c){var d=c;d.der=a("./der"),d.pem=a("./pem")},{"./der":124,"./pem":126}],126:[function(a,b,c){function d(a){f.call(this,a),this.enc="pem"}var e=a("inherits"),Buffer=a("buffer").Buffer,f=a("./der");e(d,f),b.exports=d,d.prototype.decode=function(a,b){for(var c=a.toString().split(/[\r\n]+/g),d=b.label.toUpperCase(),e=/^-----(BEGIN|END) ([^-]+)-----$/,g=-1,h=-1,i=0;i<c.length;i++){var j=c[i].match(e);if(null!==j&&j[2]===d){if(g!==-1){if("END"!==j[1])break;h=i;break}if("BEGIN"!==j[1])break;g=i}}if(g===-1||h===-1)throw new Error("PEM section not found for: "+d);var k=c.slice(g+1,h).join("");k.replace(/[^a-z0-9\+\/=]+/gi,"");var l=new Buffer(k,"base64");return f.prototype.decode.call(this,l,b)}},{"./der":124,buffer:104,inherits:226}],127:[function(a,b,c){function d(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new e,this.tree._init(a.body)}function e(a){j.Node.call(this,"der",a)}function f(a){return a<10?"0"+a:a}function g(a,b,c,d){var e;if("seqof"===a?a="seq":"setof"===a&&(a="set"),k.tagByName.hasOwnProperty(a))e=k.tagByName[a];else{if("number"!=typeof a||(0|a)!==a)return d.error("Unknown tag: "+a);e=a}return e>=31?d.error("Multi-octet tag encoding unsupported"):(b||(e|=32),e|=k.tagClassByName[c||"universal"]<<6)}var h=a("inherits"),Buffer=a("buffer").Buffer,i=a("../../asn1"),j=i.base,k=i.constants.der;b.exports=d,d.prototype.encode=function(a,b){return this.tree._encode(a,b).join()},h(e,j.Node),e.prototype._encodeComposite=function(a,b,c,d){var e=g(a,b,c,this.reporter);if(d.length<128){var f=new Buffer(2);return f[0]=e,f[1]=d.length,this._createEncoderBuffer([f,d])}for(var h=1,i=d.length;i>=256;i>>=8)h++;var f=new Buffer(2+h);f[0]=e,f[1]=128|h;for(var i=1+h,j=d.length;j>0;i--,j>>=8)f[i]=255&j;return this._createEncoderBuffer([f,d])},e.prototype._encodeStr=function(a,b){if("bitstr"===b)return this._createEncoderBuffer([0|a.unused,a.data]);if("bmpstr"===b){for(var c=new Buffer(2*a.length),d=0;d<a.length;d++)c.writeUInt16BE(a.charCodeAt(d),2*d);return this._createEncoderBuffer(c)}return"numstr"===b?this._isNumstr(a)?this._createEncoderBuffer(a):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===b?this._isPrintstr(a)?this._createEncoderBuffer(a):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(b)?this._createEncoderBuffer(a):"objDesc"===b?this._createEncoderBuffer(a):this.reporter.error("Encoding of string type: "+b+" unsupported")},e.prototype._encodeObjid=function(a,b,c){if("string"==typeof a){if(!b)return this.reporter.error("string objid given, but no values map found");if(!b.hasOwnProperty(a))return this.reporter.error("objid not found in values map");a=b[a].split(/[\s\.]+/g);for(var d=0;d<a.length;d++)a[d]|=0}else if(Array.isArray(a)){a=a.slice();for(var d=0;d<a.length;d++)a[d]|=0}if(!Array.isArray(a))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(a));if(!c){if(a[1]>=40)return this.reporter.error("Second objid identifier OOB");a.splice(0,2,40*a[0]+a[1])}for(var e=0,d=0;d<a.length;d++){var f=a[d];for(e++;f>=128;f>>=7)e++}for(var g=new Buffer(e),h=g.length-1,d=a.length-1;d>=0;d--){var f=a[d];for(g[h--]=127&f;(f>>=7)>0;)g[h--]=128|127&f}return this._createEncoderBuffer(g)},e.prototype._encodeTime=function(a,b){var c,d=new Date(a);return"gentime"===b?c=[f(d.getFullYear()),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):"utctime"===b?c=[f(d.getFullYear()%100),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+b+" time is not supported yet"),this._encodeStr(c,"octstr")},e.prototype._encodeNull=function(){return this._createEncoderBuffer("")},e.prototype._encodeInt=function(a,b){if("string"==typeof a){if(!b)return this.reporter.error("String int or enum given, but no values map");if(!b.hasOwnProperty(a))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(a));a=b[a]}if("number"!=typeof a&&!Buffer.isBuffer(a)){var c=a.toArray();!a.sign&&128&c[0]&&c.unshift(0),a=new Buffer(c)}if(Buffer.isBuffer(a)){var d=a.length;0===a.length&&d++;var e=new Buffer(d);return a.copy(e),0===a.length&&(e[0]=0),this._createEncoderBuffer(e)}if(a<128)return this._createEncoderBuffer(a);if(a<256)return this._createEncoderBuffer([0,a]);for(var d=1,f=a;f>=256;f>>=8)d++;for(var e=new Array(d),f=e.length-1;f>=0;f--)e[f]=255&a,a>>=8;return 128&e[0]&&e.unshift(0),this._createEncoderBuffer(new Buffer(e))},e.prototype._encodeBool=function(a){return this._createEncoderBuffer(a?255:0)},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getEncoder("der").tree},e.prototype._skipDefault=function(a,b,c){var d,e=this._baseState;if(null===e.default)return!1;var f=a.join();if(void 0===e.defaultBuffer&&(e.defaultBuffer=this._encodeValue(e.default,b,c).join()),f.length!==e.defaultBuffer.length)return!1;for(d=0;d<f.length;d++)if(f[d]!==e.defaultBuffer[d])return!1;return!0}},{"../../asn1":116,buffer:104,inherits:226}],128:[function(a,b,c){var d=c;d.der=a("./der"),d.pem=a("./pem")},{"./der":127,"./pem":129}],129:[function(a,b,c){function d(a){f.call(this,a),this.enc="pem"}var e=a("inherits"),f=a("./der");e(d,f),b.exports=d,d.prototype.encode=function(a,b){for(var c=f.prototype.encode.call(this,a),d=c.toString("base64"),e=["-----BEGIN "+b.label+"-----"],g=0;g<d.length;g+=64)e.push(d.slice(g,g+64));return e.push("-----END "+b.label+"-----"),e.join("\n")}},{"./der":127,inherits:226}],130:[function(a,b,c){(function(Buffer){function c(a){var b=e(a),c=b.toRed(f.mont(a.modulus)).redPow(new f(a.publicExponent)).fromRed();return{blinder:c,unblinder:b.invm(a.modulus)}}function d(a,b){var d=c(b),e=b.modulus.byteLength(),g=(f.mont(b.modulus),new f(a).mul(d.blinder).umod(b.modulus)),h=g.toRed(f.mont(b.prime1)),i=g.toRed(f.mont(b.prime2)),j=b.coefficient,k=b.prime1,l=b.prime2,m=h.redPow(b.exponent1),n=i.redPow(b.exponent2);m=m.fromRed(),n=n.fromRed();var o=m.isub(n).imul(j).umod(k);return o.imul(l),n.iadd(o),new Buffer(n.imul(d.unblinder).umod(b.modulus).toArray(!1,e))}function e(a){for(var b=a.modulus.byteLength(),c=new f(g(b));c.cmp(a.modulus)>=0||!c.umod(a.prime1)||!c.umod(a.prime2);)c=new f(g(b));return c}var f=a("bn.js"),g=a("randombytes");b.exports=d,d.getr=e}).call(this,a("buffer").Buffer)},{"bn.js":75,buffer:104,randombytes:271}],131:[function(a,b,c){b.exports=a("./browser/algorithms.json")},{"./browser/algorithms.json":132}],132:[function(a,b,c){b.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],133:[function(a,b,c){b.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],134:[function(a,b,c){(function(Buffer){function c(a){h.Writable.call(this);var b=l[a];if(!b)throw new Error("Unknown message digest");this._hashType=b.hash,this._hash=g(b.hash),this._tag=b.id,this._signType=b.sign}function d(a){h.Writable.call(this);var b=l[a];if(!b)throw new Error("Unknown message digest");this._hash=g(b.hash),this._tag=b.id,this._signType=b.sign}function e(a){return new c(a)}function f(a){return new d(a)}var g=a("create-hash"),h=a("stream"),i=a("inherits"),j=a("./sign"),k=a("./verify"),l=a("./algorithms.json");Object.keys(l).forEach(function(a){l[a].id=new Buffer(l[a].id,"hex"),l[a.toLowerCase()]=l[a]}),i(c,h.Writable),c.prototype._write=function(a,b,c){this._hash.update(a),c()},c.prototype.update=function(a,b){return"string"==typeof a&&(a=new Buffer(a,b)),this._hash.update(a),this},c.prototype.sign=function(a,b){this.end();var c=this._hash.digest(),d=j(c,a,this._hashType,this._signType,this._tag);return b?d.toString(b):d},i(d,h.Writable),d.prototype._write=function(a,b,c){this._hash.update(a),c()},d.prototype.update=function(a,b){return"string"==typeof a&&(a=new Buffer(a,b)),this._hash.update(a),this},d.prototype.verify=function(a,b,c){"string"==typeof b&&(b=new Buffer(b,c)),this.end();var d=this._hash.digest();return k(b,d,a,this._signType,this._tag)},b.exports={Sign:e,Verify:f,createSign:e,createVerify:f}}).call(this,a("buffer").Buffer)},{"./algorithms.json":132,"./sign":135,"./verify":136,buffer:104,"create-hash":110,inherits:226,stream:304}],135:[function(a,b,c){(function(Buffer){function c(a,b,c,f,g){var h=p(b);if(h.curve){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong private key type");return d(a,h)}if("dsa"===h.type){if("dsa"!==f)throw new Error("wrong private key type");return e(a,h,c)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong private key type");a=Buffer.concat([g,a]);for(var i=h.modulus.byteLength(),j=[0,1];a.length+j.length+1<i;)j.push(255);j.push(0);for(var k=-1;++k<a.length;)j.push(a[k]);var l=m(j,h);return l}function d(a,b){var c=q[b.curve.join(".")];if(!c)throw new Error("unknown curve "+b.curve.join("."));var d=new n(c),e=d.keyFromPrivate(b.privateKey),f=e.sign(a);return new Buffer(f.toDER())}function e(a,b,c){for(var d,e=b.params.priv_key,i=b.params.p,l=b.params.q,m=b.params.g,n=new o(0),p=h(a,l).mod(l),q=!1,r=g(e,l,a,c);q===!1;)d=j(l,r,c),n=k(m,d,i,l),q=d.invm(l).imul(p.add(e.mul(n))).mod(l),0===q.cmpn(0)&&(q=!1,n=new o(0));return f(n,q)}function f(a,b){a=a.toArray(),b=b.toArray(),128&a[0]&&(a=[0].concat(a)),128&b[0]&&(b=[0].concat(b));var c=a.length+b.length+4,d=[48,c,2,a.length];return d=d.concat(a,[2,b.length],b),new Buffer(d)}function g(a,b,c,d){if(a=new Buffer(a.toArray()),a.length<b.byteLength()){var e=new Buffer(b.byteLength()-a.length);e.fill(0),a=Buffer.concat([e,a])}var f=c.length,g=i(c,b),h=new Buffer(f);h.fill(1);var j=new Buffer(f);return j.fill(0),j=l(d,j).update(h).update(new Buffer([0])).update(a).update(g).digest(),h=l(d,j).update(h).digest(),j=l(d,j).update(h).update(new Buffer([1])).update(a).update(g).digest(),h=l(d,j).update(h).digest(),{k:j,v:h}}function h(a,b){var c=new o(a),d=(a.length<<3)-b.bitLength();return d>0&&c.ishrn(d),c}function i(a,b){a=h(a,b),a=a.mod(b);var c=new Buffer(a.toArray());if(c.length<b.byteLength()){var d=new Buffer(b.byteLength()-c.length);d.fill(0),c=Buffer.concat([d,c])}return c}function j(a,b,c){var d,e;do{for(d=new Buffer(0);8*d.length<a.bitLength();)b.v=l(c,b.k).update(b.v).digest(),d=Buffer.concat([d,b.v]);e=h(d,a),b.k=l(c,b.k).update(b.v).update(new Buffer([0])).digest(),b.v=l(c,b.k).update(b.v).digest()}while(e.cmp(a)!==-1);return e}function k(a,b,c,d){return a.toRed(o.mont(c)).redPow(b).fromRed().mod(d)}var l=a("create-hmac"),m=a("browserify-rsa"),n=a("elliptic").ec,o=a("bn.js"),p=a("parse-asn1"),q=a("./curves.json");b.exports=c,b.exports.getKey=g,b.exports.makeKey=j}).call(this,a("buffer").Buffer)},{"./curves.json":133,"bn.js":75,"browserify-rsa":130,buffer:104,"create-hmac":113,elliptic:192,"parse-asn1":141}],136:[function(a,b,c){(function(Buffer){function c(a,b,c,f,h){var j=i(c);if("ec"===j.type){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");return d(a,b,j)}if("dsa"===j.type){if("dsa"!==f)throw new Error("wrong public key type");return e(a,b,j)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");b=Buffer.concat([h,b]);for(var k=j.modulus.byteLength(),l=[1],m=0;b.length+l.length+2<k;)l.push(255),m++;l.push(0);for(var n=-1;++n<b.length;)l.push(b[n]);l=new Buffer(l);var o=g.mont(j.modulus);a=new g(a).toRed(o),a=a.redPow(new g(j.publicExponent)),a=new Buffer(a.fromRed().toArray());var p=m<8?1:0;for(k=Math.min(a.length,l.length),a.length!==l.length&&(p=1),n=-1;++n<k;)p|=a[n]^l[n];return 0===p}function d(a,b,c){var d=j[c.data.algorithm.curve.join(".")];if(!d)throw new Error("unknown curve "+c.data.algorithm.curve.join("."));var e=new h(d),f=c.data.subjectPrivateKey.data;return e.verify(b,a,f)}function e(a,b,c){var d=c.data.p,e=c.data.q,h=c.data.g,j=c.data.pub_key,k=i.signature.decode(a,"der"),l=k.s,m=k.r;f(l,e),f(m,e);var n=g.mont(d),o=l.invm(e),p=h.toRed(n).redPow(new g(b).mul(o).mod(e)).fromRed().mul(j.toRed(n).redPow(m.mul(o).mod(e)).fromRed()).mod(d).mod(e);return 0===p.cmp(m)}function f(a,b){if(a.cmpn(0)<=0)throw new Error("invalid sig");if(a.cmp(b)>=b)throw new Error("invalid sig")}var g=a("bn.js"),h=a("elliptic").ec,i=a("parse-asn1"),j=a("./curves.json");b.exports=c}).call(this,a("buffer").Buffer)},{"./curves.json":133,"bn.js":75,buffer:104,elliptic:192,"parse-asn1":141}],137:[function(a,b,c){b.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],138:[function(a,b,c){"use strict";var d=a("asn1.js");c.certificate=a("./certificate");var e=d.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});c.RSAPrivateKey=e;var f=d.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});c.RSAPublicKey=f;var g=d.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(h),this.key("subjectPublicKey").bitstr())});c.PublicKey=g;var h=d.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),i=d.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(h),this.key("subjectPrivateKey").octstr())});c.PrivateKey=i;var j=d.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});c.EncryptedPrivateKey=j;var k=d.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});c.DSAPrivateKey=k,c.DSAparam=d.define("DSAparam",function(){this.int()});var l=d.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(m),this.key("publicKey").optional().explicit(1).bitstr())});c.ECPrivateKey=l;var m=d.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});c.signature=d.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":139,"asn1.js":116}],139:[function(a,b,c){"use strict";var d=a("asn1.js"),e=d.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),f=d.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),g=d.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),h=d.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(g),this.key("subjectPublicKey").bitstr())}),i=d.define("RelativeDistinguishedName",function(){this.setof(f)}),j=d.define("RDNSequence",function(){this.seqof(i)}),k=d.define("Name",function(){this.choice({rdnSequence:this.use(j)})}),l=d.define("Validity",function(){this.seq().obj(this.key("notBefore").use(e),this.key("notAfter").use(e))}),m=d.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),n=d.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(g),this.key("issuer").use(k),this.key("validity").use(l),this.key("subject").use(k),this.key("subjectPublicKeyInfo").use(h),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(m).optional())}),o=d.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(n),this.key("signatureAlgorithm").use(g),this.key("signatureValue").bitstr())});b.exports=o},{"asn1.js":116}],140:[function(a,b,c){(function(Buffer){var c=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,d=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,e=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,f=a("evp_bytestokey"),g=a("browserify-aes");
@@ 8-8 (lines=1) @@
5
codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message},this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message},this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message},this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message},this.message=a}}};"undefined"!=typeof b&&b.exports&&(b.exports=m),"function"==typeof define&&define([],function(){return m}),m.cipher.aes=function(a){this.o[0][0][0]||this.t();var b,c,e,f,g=this.o[0][4],h=this.o[1];b=a.length;var i=1;for(4!==b&&6!==b&&8!==b&&d(new m.exception.invalid("invalid aes key size")),this.b=[e=a.slice(0),f=[]],a=b;a<4*b+28;a++)c=e[a-1],(0===a%b||8===b&&4===a%b)&&(c=g[c>>>24]<<24^g[c>>16&255]<<16^g[c>>8&255]<<8^g[255&c],0===a%b&&(c=c<<8^c>>>24^i<<24,i=i<<1^283*(i>>7))),e[a]=e[a-b]^c;for(b=0;a;b++,a--)c=e[3&b?a:a-4],f[b]=4>=a||4>b?c:h[0][g[c>>>24]]^h[1][g[c>>16&255]]^h[2][g[c>>8&255]]^h[3][g[255&c]]},m.cipher.aes.prototype={encrypt:function(a){return e(this,a,0)},decrypt:function(a){return e(this,a,1)},o:[[[],[],[],[],[]],[[],[],[],[],[]]],t:function(){var a,b,c,d,e,f,g,h=this.o[0],i=this.o[1],j=h[4],k=i[4],l=[],m=[];for(a=0;256>a;a++)m[(l[a]=a<<1^283*(a>>7))^a]=a;for(b=c=0;!j[b];b^=d||1,c=m[c]||1)for(f=c^c<<1^c<<2^c<<3^c<<4,f=f>>8^255&f^99,j[b]=f,k[f]=b,e=l[a=l[d=l[b]]],g=16843009*e^65537*a^257*d^16843008*b,e=257*l[f]^16843008*f,a=0;4>a;a++)h[a][b]=e=e<<24^e>>>8,i[a][f]=g=g<<24^g>>>8;for(a=0;5>a;a++)h[a]=h[a].slice(0),i[a]=i[a].slice(0)}},m.bitArray={bitSlice:function(a,b,c){return a=m.bitArray.R(a.slice(b/32),32-(31&b)).slice(1),c===k?a:m.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=m.bitArray.getPartial(c);return 32===d?a.concat(b):m.bitArray.R(b,d,0|c,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===b?0:32*(b-1)+m.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;return b&=31,0<c&&b&&(a[c-1]=m.bitArray.partial(b,a[c-1]&2147483648>>b-1,1)),a},partial:function(a,b,c){return 32===a?b:(c?0|b:b<<32-a)+1099511627776*a},getPartial:function(a){return Math.round(a/1099511627776)||32},equal:function(a,b){if(m.bitArray.bitLength(a)!==m.bitArray.bitLength(b))return l;var c,d=0;for(c=0;c<a.length;c++)d|=a[c]^b[c];return 0===d},R:function(a,b,c,d){var e;for(e=0,d===k&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;return e=a.length?a[a.length-1]:0,a=m.bitArray.getPartial(e),d.push(m.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1)),d},j:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&65280|(65280&c)<<8|c<<24;return a}},m.codec.utf8String={fromBits:function(a){var b,c,d="",e=m.bitArray.bitLength(a);for(b=0;b<e/8;b++)0===(3&b)&&(c=a[b/4]),d+=String.fromCharCode(c>>>24),c<<=8;return decodeURIComponent(escape(d))},toBits:function(a){a=unescape(encodeURIComponent(a));var b,c=[],d=0;for(b=0;b<a.length;b++)d=d<<8|a.charCodeAt(b),3===(3&b)&&(c.push(d),d=0);return 3&b&&c.push(m.bitArray.partial(8*(3&b),d)),c}},m.codec.hex={fromBits:function(a){var b,c="";for(b=0;b<a.length;b++)c+=((0|a[b])+0xf00000000000).toString(16).substr(4);return c.substr(0,m.bitArray.bitLength(a)/4)},toBits:function(a){var b,c,d=[];for(a=a.replace(/\s|0x/g,""),c=a.length,a+="00000000",b=0;b<a.length;b+=8)d.push(0^parseInt(a.substr(b,8),16));return m.bitArray.clamp(d,4*c)}},m.codec.base64={M:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=m.codec.base64.M,g=0,h=m.bitArray.bitLength(a);for(c&&(f=f.substr(0,62)+"-_"),c=0;6*d.length<h;)d+=f.charAt((g^a[c]>>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;3&d.length&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c,e,f=[],g=0,h=m.codec.base64.M,i=0;for(b&&(h=h.substr(0,62)+"-_"),c=0;c<a.length;c++)e=h.indexOf(a.charAt(c)),0>e&&d(new m.exception.invalid("this isn't base64!")),26<g?(g-=26,f.push(i^e>>>g),i=e<<32-g):(g+=6,i^=e<<32-g);return 56&g&&f.push(m.bitArray.partial(56&g,i,1)),f}},m.codec.base64url={fromBits:function(a){return m.codec.base64.fromBits(a,1,1)},toBits:function(a){return m.codec.base64.toBits(a,1)}},m.hash.sha256=function(a){this.b[0]||this.t(),a?(this.e=a.e.slice(0),this.d=a.d.slice(0),this.c=a.c):this.reset()},m.hash.sha256.hash=function(a){return(new m.hash.sha256).update(a).finalize()},m.hash.sha256.prototype={blockSize:512,reset:function(){return this.e=this.l.slice(0),this.d=[],this.c=0,this},update:function(a){"string"==typeof a&&(a=m.codec.utf8String.toBits(a));var b,c=this.d=m.bitArray.concat(this.d,a);for(b=this.c,a=this.c=b+m.bitArray.bitLength(a),b=512+b&-512;b<=a;b+=512)this.r(c.splice(0,16));return this},finalize:function(){var a,b=this.d,c=this.e,b=m.bitArray.concat(b,[m.bitArray.partial(1,1)]);for(a=b.length+2;15&a;a++)b.push(0);for(b.push(Math.floor(this.c/4294967296)),b.push(0|this.c);b.length;)this.r(b.splice(0,16));return this.reset(),c},l:[],b:[],t:function(){function a(a){return 4294967296*(a-Math.floor(a))|0}var b,c=0,d=2;a:for(;64>c;d++){for(b=2;b*b<=d;b++)if(0===d%b)continue a;8>c&&(this.l[c]=a(Math.pow(d,.5))),this.b[c]=a(Math.pow(d,1/3)),c++}},r:function(a){var b,c,d=a.slice(0),e=this.e,f=this.b,g=e[0],h=e[1],i=e[2],j=e[3],k=e[4],l=e[5],m=e[6],n=e[7];for(a=0;64>a;a++)16>a?b=d[a]:(b=d[a+1&15],c=d[a+14&15],b=d[15&a]=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(c>>>17^c>>>19^c>>>10^c<<15^c<<13)+d[15&a]+d[a+9&15]|0),b=b+n+(k>>>6^k>>>11^k>>>25^k<<26^k<<21^k<<7)+(m^k&(l^m))+f[a],n=m,m=l,l=k,k=j+b|0,j=i,i=h,h=g,g=b+(h&i^j&(h^i))+(h>>>2^h>>>13^h>>>22^h<<30^h<<19^h<<10)|0;e[0]=e[0]+g|0,e[1]=e[1]+h|0,e[2]=e[2]+i|0,e[3]=e[3]+j|0,e[4]=e[4]+k|0,e[5]=e[5]+l|0,e[6]=e[6]+m|0,e[7]=e[7]+n|0}},m.hash.sha512=function(a){this.b[0]||this.t(),a?(this.e=a.e.slice(0),this.d=a.d.slice(0),this.c=a.c):this.reset()},m.hash.sha512.hash=function(a){return(new m.hash.sha512).update(a).finalize()},m.hash.sha512.prototype={blockSize:1024,reset:function(){return this.e=this.l.slice(0),this.d=[],this.c=0,this},update:function(a){"string"==typeof a&&(a=m.codec.utf8String.toBits(a));var b,c=this.d=m.bitArray.concat(this.d,a);for(b=this.c,a=this.c=b+m.bitArray.bitLength(a),b=1024+b&-1024;b<=a;b+=1024)this.r(c.splice(0,32));return this},finalize:function(){var a,b=this.d,c=this.e,b=m.bitArray.concat(b,[m.bitArray.partial(1,1)]);for(a=b.length+4;31&a;a++)b.push(0);for(b.push(0),b.push(0),b.push(Math.floor(this.c/4294967296)),b.push(0|this.c);b.length;)this.r(b.splice(0,32));return this.reset(),c},l:[],ca:[12372232,13281083,9762859,1914609,15106769,4090911,4308331,8266105],b:[],ea:[2666018,15689165,5061423,9034684,4764984,380953,1658779,7176472,197186,7368638,14987916,16757986,8096111,1480369,13046325,6891156,15813330,5187043,9229749,11312229,2818677,10937475,4324308,1135541,6741931,11809296,16458047,15666916,11046850,698149,229999,945776,13774844,2541862,12856045,9810911,11494366,7844520,15576806,8533307,15795044,4337665,16291729,5553712,15684120,6662416,7413802,12308920,13816008,4303699,9366425,10176680,13195875,4295371,6546291,11712675,15708924,1519456,15772530,6568428,6495784,8568297,13007125,7492395,2515356,12632583,14740254,7262584,1535930,13146278,16321966,1853211,294276,13051027,13221564,1051980,4080310,6651434,14088940,4675607],t:function(){function a(a){return 4294967296*(a-Math.floor(a))|0}function b(a){return 1099511627776*(a-Math.floor(a))&255}var c,d=0,e=2;a:for(;80>d;e++){for(c=2;c*c<=e;c++)if(0===e%c)continue a;8>d&&(this.l[2*d]=a(Math.pow(e,.5)),this.l[2*d+1]=b(Math.pow(e,.5))<<24|this.ca[d]),this.b[2*d]=a(Math.pow(e,1/3)),this.b[2*d+1]=b(Math.pow(e,1/3))<<24|this.ea[d],d++}},r:function(a){var b,c,d=a.slice(0),e=this.e,f=this.b,g=e[0],h=e[1],i=e[2],j=e[3],k=e[4],l=e[5],m=e[6],n=e[7],o=e[8],p=e[9],q=e[10],r=e[11],s=e[12],t=e[13],u=e[14],v=e[15],w=g,x=h,y=i,z=j,A=k,B=l,C=m,D=n,E=o,F=p,G=q,H=r,I=s,J=t,K=u,L=v;for(a=0;80>a;a++){if(16>a)b=d[2*a],c=d[2*a+1];else{c=d[2*(a-15)];var M=d[2*(a-15)+1];b=(M<<31|c>>>1)^(M<<24|c>>>8)^c>>>7;var N=(c<<31|M>>>1)^(c<<24|M>>>8)^(c<<25|M>>>7);c=d[2*(a-2)];var O=d[2*(a-2)+1],M=(O<<13|c>>>19)^(c<<3|O>>>29)^c>>>6,O=(c<<13|O>>>19)^(O<<3|c>>>29)^(c<<26|O>>>6),P=d[2*(a-7)],Q=d[2*(a-16)],R=d[2*(a-16)+1];c=N+d[2*(a-7)+1],b=b+P+(c>>>0<N>>>0?1:0),c+=O,b+=M+(c>>>0<O>>>0?1:0),c+=R,b+=Q+(c>>>0<R>>>0?1:0)}d[2*a]=b|=0,d[2*a+1]=c|=0;var P=E&G^~E&I,S=F&H^~F&J,O=w&y^w&A^y&A,T=x&z^x&B^z&B,Q=(x<<4|w>>>28)^(w<<30|x>>>2)^(w<<25|x>>>7),R=(w<<4|x>>>28)^(x<<30|w>>>2)^(x<<25|w>>>7),U=f[2*a],V=f[2*a+1],M=L+((E<<18|F>>>14)^(E<<14|F>>>18)^(F<<23|E>>>9)),N=K+((F<<18|E>>>14)^(F<<14|E>>>18)^(E<<23|F>>>9))+(M>>>0<L>>>0?1:0),M=M+S,N=N+(P+(M>>>0<S>>>0?1:0)),M=M+V,N=N+(U+(M>>>0<V>>>0?1:0)),M=M+c|0,N=N+(b+(M>>>0<c>>>0?1:0));c=R+T,b=Q+O+(c>>>0<R>>>0?1:0),K=I,L=J,I=G,J=H,G=E,H=F,F=D+M|0,E=C+N+(F>>>0<D>>>0?1:0)|0,C=A,D=B,A=y,B=z,y=w,z=x,x=M+c|0,w=N+b+(x>>>0<M>>>0?1:0)|0}h=e[1]=h+x|0,e[0]=g+w+(h>>>0<x>>>0?1:0)|0,j=e[3]=j+z|0,e[2]=i+y+(j>>>0<z>>>0?1:0)|0,l=e[5]=l+B|0,e[4]=k+A+(l>>>0<B>>>0?1:0)|0,n=e[7]=n+D|0,e[6]=m+C+(n>>>0<D>>>0?1:0)|0,p=e[9]=p+F|0,e[8]=o+E+(p>>>0<F>>>0?1:0)|0,r=e[11]=r+H|0,e[10]=q+G+(r>>>0<H>>>0?1:0)|0,t=e[13]=t+J|0,e[12]=s+I+(t>>>0<J>>>0?1:0)|0,v=e[15]=v+L|0,e[14]=u+K+(v>>>0<L>>>0?1:0)|0}},m.mode.ccm={name:"ccm",w:[],listenProgress:function(a){m.mode.ccm.w.push(a)},unListenProgress:function(a){a=m.mode.ccm.w.indexOf(a),-1<a&&m.mode.ccm.w.splice(a,1)},X:function(a){var b,c=m.mode.ccm.w.slice();for(b=0;b<c.length;b+=1)c[b](a)},encrypt:function(a,b,c,e,f){var g,h=b.slice(0),i=m.bitArray,j=i.bitLength(c)/8,k=i.bitLength(h)/8;for(f=f||64,e=e||[],7>j&&d(new m.exception.invalid("ccm: iv must be at least 7 bytes")),g=2;4>g&&k>>>8*g;g++);return g<15-j&&(g=15-j),c=i.clamp(c,8*(15-g)),b=m.mode.ccm.O(a,b,c,e,f,g),h=m.mode.ccm.s(a,h,c,b,f,g),i.concat(h.data,h.tag)},decrypt:function(a,b,c,e,f){f=f||64,e=e||[];var g=m.bitArray,h=g.bitLength(c)/8,i=g.bitLength(b),j=g.clamp(b,i-f),k=g.bitSlice(b,i-f),i=(i-f)/8;for(7>h&&d(new m.exception.invalid("ccm: iv must be at least 7 bytes")),b=2;4>b&&i>>>8*b;b++);return b<15-h&&(b=15-h),c=g.clamp(c,8*(15-b)),j=m.mode.ccm.s(a,j,c,k,f,b),a=m.mode.ccm.O(a,j.data,c,e,f,b),g.equal(j.tag,a)||d(new m.exception.corrupt("ccm: tag doesn't match")),j.data},ga:function(a,b,c,d,e,f){var g=[],h=m.bitArray,i=h.j;if(d=[h.partial(8,(b.length?64:0)|d-2<<2|f-1)],d=h.concat(d,c),d[3]|=e,d=a.encrypt(d),b.length)for(c=h.bitLength(b)/8,65279>=c?g=[h.partial(16,c)]:4294967295>=c&&(g=h.concat([h.partial(16,65534)],[c])),g=h.concat(g,b),b=0;b<g.length;b+=4)d=a.encrypt(i(d,g.slice(b,b+4).concat([0,0,0])));return d},O:function(a,b,c,e,f,g){var h=m.bitArray,i=h.j;for(f/=8,(f%2||4>f||16<f)&&d(new m.exception.invalid("ccm: invalid tag length")),(4294967295<e.length||4294967295<b.length)&&d(new m.exception.bug("ccm: can't deal with 4GiB or more data")),c=m.mode.ccm.ga(a,e,c,f,h.bitLength(b)/8,g),e=0;e<b.length;e+=4)c=a.encrypt(i(c,b.slice(e,e+4).concat([0,0,0])));return h.clamp(c,8*f)},s:function(a,b,c,d,e,f){var g,h=m.bitArray;g=h.j;var i=b.length,j=h.bitLength(b),k=i/50,l=k;if(c=h.concat([h.partial(8,f-1)],c).concat([0,0,0]).slice(0,4),d=h.bitSlice(g(d,a.encrypt(c)),0,e),!i)return{tag:d,data:[]};for(g=0;g<i;g+=4)g>k&&(m.mode.ccm.X(g/i),k+=l),c[3]++,e=a.encrypt(c),b[g]^=e[0],b[g+1]^=e[1],b[g+2]^=e[2],b[g+3]^=e[3];return{tag:d,data:h.clamp(b,j)}}},m.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,e,f,g){128!==m.bitArray.bitLength(c)&&d(new m.exception.invalid("ocb iv must be 128 bits"));var h,i=m.mode.ocb2.K,j=m.bitArray,k=j.j,l=[0,0,0,0];c=i(a.encrypt(c));var n,o=[];for(e=e||[],f=f||64,h=0;h+4<b.length;h+=4)n=b.slice(h,h+4),l=k(l,n),o=o.concat(k(c,a.encrypt(k(c,n)))),c=i(c);return n=b.slice(h),b=j.bitLength(n),h=a.encrypt(k(c,[0,0,0,b])),n=j.clamp(k(n.concat([0,0,0]),h),b),l=k(l,k(n.concat([0,0,0]),h)),l=a.encrypt(k(l,k(c,i(c)))),e.length&&(l=k(l,g?e:m.mode.ocb2.pmac(a,e))),o.concat(j.concat(n,j.clamp(l,f)))},decrypt:function(a,b,c,e,f,g){128!==m.bitArray.bitLength(c)&&d(new m.exception.invalid("ocb iv must be 128 bits")),f=f||64;var h,i,j=m.mode.ocb2.K,k=m.bitArray,l=k.j,n=[0,0,0,0],o=j(a.encrypt(c)),p=m.bitArray.bitLength(b)-f,q=[];for(e=e||[],c=0;c+4<p/32;c+=4)h=l(o,a.decrypt(l(o,b.slice(c,c+4)))),n=l(n,h),q=q.concat(h),o=j(o);return i=p-32*c,h=a.encrypt(l(o,[0,0,0,i])),h=l(h,k.clamp(b.slice(c),i).concat([0,0,0])),n=l(n,h),n=a.encrypt(l(n,l(o,j(o)))),e.length&&(n=l(n,g?e:m.mode.ocb2.pmac(a,e))),k.equal(k.clamp(n,f),k.bitSlice(b,p))||d(new m.exception.corrupt("ocb: tag doesn't match")),q.concat(k.clamp(h,i))},pmac:function(a,b){var c,d=m.mode.ocb2.K,e=m.bitArray,f=e.j,g=[0,0,0,0],h=a.encrypt([0,0,0,0]),h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4)h=d(h),g=f(g,a.encrypt(f(h,b.slice(c,c+4))));return c=b.slice(c),128>e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0])),g=f(g,c),a.encrypt(f(d(f(h,d(h))),g))},K:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}},m.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);return b=m.bitArray,d=d||[],a=m.mode.gcm.s(!0,a,f,d,c,e||128),b.concat(a.data,a.tag)},decrypt:function(a,b,c,e,f){var g=b.slice(0),h=m.bitArray,i=h.bitLength(g);return f=f||128,e=e||[],f<=i?(b=h.bitSlice(g,i-f),g=h.bitSlice(g,0,i-f)):(b=g,g=[]),a=m.mode.gcm.s(l,a,g,e,c,f),h.equal(a.tag,b)||d(new m.exception.corrupt("gcm: tag doesn't match")),a.data},ba:function(a,b){var c,d,e,f,g,h=m.bitArray.j;for(e=[0,0,0,0],f=b.slice(0),c=0;128>c;c++){for((d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f)),g=0!==(1&f[3]),d=3;0<d;d--)f[d]=f[d]>>>1|(1&f[d-1])<<31;f[0]>>>=1,g&&(f[0]^=-520093696)}return e},k:function(a,b,c){var d,e=c.length;for(b=b.slice(0),d=0;d<e;d+=4)b[0]^=4294967295&c[d],b[1]^=4294967295&c[d+1],b[2]^=4294967295&c[d+2],b[3]^=4294967295&c[d+3],b=m.mode.gcm.ba(b,a);return b},s:function(a,b,c,d,e,f){var g,h,i,j,k,l,n,o,p=m.bitArray;for(l=c.length,n=p.bitLength(c),o=p.bitLength(d),h=p.bitLength(e),g=b.encrypt([0,0,0,0]),96===h?(e=e.slice(0),e=p.concat(e,[1])):(e=m.mode.gcm.k(g,[0,0,0,0],e),e=m.mode.gcm.k(g,e,[0,0,Math.floor(h/4294967296),4294967295&h])),h=m.mode.gcm.k(g,[0,0,0,0],d),k=e.slice(0),d=h.slice(0),a||(d=m.mode.gcm.k(g,h,c)),j=0;j<l;j+=4)k[3]++,i=b.encrypt(k),c[j]^=i[0],c[j+1]^=i[1],c[j+2]^=i[2],c[j+3]^=i[3];return c=p.clamp(c,n),a&&(d=m.mode.gcm.k(g,h,c)),a=[Math.floor(o/4294967296),4294967295&o,Math.floor(n/4294967296),4294967295&n],d=m.mode.gcm.k(g,d,a),i=b.encrypt(e),d[0]^=i[0],d[1]^=i[1],d[2]^=i[2],d[3]^=i[3],{tag:p.bitSlice(d,0,f),data:c}}},m.misc.hmac=function(a,b){this.P=b=b||m.hash.sha256;var c,d=[[],[]],e=b.prototype.blockSize/32;for(this.q=[new b,new b],a.length>e&&(a=b.hash(a)),c=0;c<e;c++)d[0][c]=909522486^a[c],d[1][c]=1549556828^a[c];this.q[0].update(d[0]),this.q[1].update(d[1]),this.J=new b(this.q[0])},m.misc.hmac.prototype.encrypt=m.misc.hmac.prototype.mac=function(a){return this.S&&d(new m.exception.invalid("encrypt on already updated hmac called!")),this.update(a),this.digest(a)},m.misc.hmac.prototype.reset=function(){this.J=new this.P(this.q[0]),this.S=l},m.misc.hmac.prototype.update=function(a){this.S=!0,this.J.update(a)},m.misc.hmac.prototype.digest=function(){var a=this.J.finalize(),a=new this.P(this.q[1]).update(a).finalize();return this.reset(),a},m.misc.pbkdf2=function(a,b,c,e,f){c=c||1e3,(0>e||0>c)&&d(m.exception.invalid("invalid params to pbkdf2")),"string"==typeof a&&(a=m.codec.utf8String.toBits(a)),"string"==typeof b&&(b=m.codec.utf8String.toBits(b)),f=f||m.misc.hmac,a=new f(a);var g,h,i,j,k=[],l=m.bitArray;for(j=1;32*k.length<(e||1);j++){for(f=g=a.encrypt(l.concat(b,[j])),h=1;h<c;h++)for(g=a.encrypt(g),i=0;i<g.length;i++)f[i]^=g[i];k=k.concat(f)}return e&&(k=l.clamp(k,e)),k},m.prng=function(a){this.f=[new m.hash.sha256],this.m=[0],this.I=0,this.A={},this.H=0,this.N={},this.Q=this.g=this.n=this.Z=0,this.b=[0,0,0,0,0,0,0,0],this.i=[0,0,0,0],this.F=k,this.G=a,this.u=l,this.D={progress:{},seeded:{}},this.p=this.Y=0,this.B=1,this.C=2,this.U=65536,this.L=[0,48,64,96,128,192,256,384,512,768,1024],this.V=3e4,this.T=80},m.prng.prototype={randomWords:function(a,b){var c,e=[];c=this.isReady(b);var f;if(c===this.p&&d(new m.exception.notReady("generator isn't seeded")),c&this.C){c=!(c&this.B),f=[];var g,j=0;for(this.Q=f[0]=(new Date).valueOf()+this.V,g=0;16>g;g++)f.push(4294967296*Math.random()|0);for(g=0;g<this.f.length&&(f=f.concat(this.f[g].finalize()),j+=this.m[g],this.m[g]=0,!(!c&&this.I&1<<g));g++);for(this.I>=1<<this.f.length&&(this.f.push(new m.hash.sha256),this.m.push(0)),this.g-=j,j>this.n&&(this.n=j),this.I++,this.b=m.hash.sha256.hash(this.b.concat(f)),this.F=new m.cipher.aes(this.b),c=0;4>c&&(this.i[c]=this.i[c]+1|0,!this.i[c]);c++);}for(c=0;c<a;c+=4)0===(c+1)%this.U&&h(this),f=i(this),e.push(f[0],f[1],f[2],f[3]);return h(this),e.slice(0,a)},setDefaultParanoia:function(a,b){0===a&&"Setting paranoia=0 will ruin your security; use it only for testing"!==b&&d("Setting paranoia=0 will ruin your security; use it only for testing"),this.G=a},addEntropy:function(a,b,c){c=c||"user";var e,g,h=(new Date).valueOf(),i=this.A[c],j=this.isReady(),l=0;switch(e=this.N[c],e===k&&(e=this.N[c]=this.Z++),i===k&&(i=this.A[c]=0),this.A[c]=(this.A[c]+1)%this.f.length,typeof a){case"number":b===k&&(b=1),this.f[i].update([e,this.H++,1,b,h,1,0|a]);break;case"object":if(c=Object.prototype.toString.call(a),"[object Uint32Array]"===c){for(g=[],c=0;c<a.length;c++)g.push(a[c]);a=g}else for("[object Array]"!==c&&(l=1),c=0;c<a.length&&!l;c++)"number"!=typeof a[c]&&(l=1);if(!l){if(b===k)for(c=b=0;c<a.length;c++)for(g=a[c];0<g;)b++,g>>>=1;this.f[i].update([e,this.H++,2,b,h,a.length].concat(a))}break;case"string":b===k&&(b=a.length),this.f[i].update([e,this.H++,3,b,h,a.length]),this.f[i].update(a);break;default:l=1}l&&d(new m.exception.bug("random: addEntropy only supports number, array of numbers or string")),this.m[i]+=b,this.g+=b,j===this.p&&(this.isReady()!==this.p&&f("seeded",Math.max(this.n,this.g)),f("progress",this.getProgress()))},isReady:function(a){return a=this.L[a!==k?a:this.G],this.n&&this.n>=a?this.m[0]>this.T&&(new Date).valueOf()>this.Q?this.C|this.B:this.B:this.g>=a?this.C|this.p:this.p},getProgress:function(a){return a=this.L[a?a:this.G],this.n>=a?1:this.g>a?1:this.g/a},startCollectors:function(){this.u||(this.a={loadTimeCollector:j(this,this.fa),mouseCollector:j(this,this.ha),keyboardCollector:j(this,this.da),accelerometerCollector:j(this,this.W),touchCollector:j(this,this.ja)},window.addEventListener?(window.addEventListener("load",this.a.loadTimeCollector,l),window.addEventListener("mousemove",this.a.mouseCollector,l),window.addEventListener("keypress",this.a.keyboardCollector,l),window.addEventListener("devicemotion",this.a.accelerometerCollector,l),window.addEventListener("touchmove",this.a.touchCollector,l)):document.attachEvent?(document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector)):d(new m.exception.bug("can't attach event")),this.u=!0)},stopCollectors:function(){this.u&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,l),window.removeEventListener("mousemove",this.a.mouseCollector,l),window.removeEventListener("keypress",this.a.keyboardCollector,l),window.removeEventListener("devicemotion",this.a.accelerometerCollector,l),window.removeEventListener("touchmove",this.a.touchCollector,l)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.u=l)},addEventListener:function(a,b){this.D[a][this.Y++]=b},removeEventListener:function(a,b){var c,d,e=this.D[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},da:function(){g(1)},ha:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(a){c=b=0}0!=b&&0!=c&&m.random.addEntropy([b,c],2,"mouse"),g(0)},ja:function(a){a=a.touches[0]||a.changedTouches[0],m.random.addEntropy([a.pageX||a.clientX,a.pageY||a.clientY],1,"touch"),g(0)},fa:function(){g(2)},W:function(a){if(a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z,window.orientation){var b=window.orientation;"number"==typeof b&&m.random.addEntropy(b,1,"accelerometer")}a&&m.random.addEntropy(a,2,"accelerometer"),g(0)}},m.random=new m.prng(6);a:try{var n,o,p,q;if(q="undefined"!=typeof b){var r;if(r=b.exports){var s;try{s=a("crypto")}catch(a){s=null}r=(o=s)&&o.randomBytes}q=r}if(q)n=o.randomBytes(128),n=new Uint32Array(new Uint8Array(n).buffer),m.random.addEntropy(n,1024,"crypto['randomBytes']");else if("undefined"!=typeof window&&"undefined"!=typeof Uint32Array){if(p=new Uint32Array(32),window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(p);else{if(!window.msCrypto||!window.msCrypto.getRandomValues)break a;window.msCrypto.getRandomValues(p)}m.random.addEntropy(p,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!=typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(a))}m.json={defaults:{v:1,iter:1e3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},aa:function(a,b,c,e){c=c||{},e=e||{};var f,g=m.json,h=g.h({iv:m.random.randomWords(4,0)},g.defaults);return g.h(h,c),c=h.adata,"string"==typeof h.salt&&(h.salt=m.codec.base64.toBits(h.salt)),"string"==typeof h.iv&&(h.iv=m.codec.base64.toBits(h.iv)),(!m.mode[h.mode]||!m.cipher[h.cipher]||"string"==typeof a&&100>=h.iter||64!==h.ts&&96!==h.ts&&128!==h.ts||128!==h.ks&&192!==h.ks&&256!==h.ks||2>h.iv.length||4<h.iv.length)&&d(new m.exception.invalid("json encrypt: invalid parameters")),"string"==typeof a?(f=m.misc.cachedPbkdf2(a,h),a=f.key.slice(0,h.ks/32),h.salt=f.salt):m.ecc&&a instanceof m.ecc.elGamal.publicKey&&(f=a.kem(),h.kemtag=f.tag,a=f.key.slice(0,h.ks/32)),"string"==typeof b&&(b=m.codec.utf8String.toBits(b)),"string"==typeof c&&(h.adata=c=m.codec.utf8String.toBits(c)),f=new m.cipher[h.cipher](a),g.h(e,h),e.key=a,h.ct="ccm"===h.mode&&m.arrayBuffer&&m.arrayBuffer.ccm&&b instanceof ArrayBuffer?m.arrayBuffer.ccm.encrypt(f,b,h.iv,c,h.ts):m.mode[h.mode].encrypt(f,b,h.iv,c,h.ts),h},encrypt:function(a,b,c,d){var e=m.json,f=e.aa.apply(e,arguments);return e.encode(f)},$:function(a,b,c,e){c=c||{},e=e||{};var f=m.json;b=f.h(f.h(f.h({},f.defaults),b),c,!0);var g,h;return g=b.adata,"string"==typeof b.salt&&(b.salt=m.codec.base64.toBits(b.salt)),"string"==typeof b.iv&&(b.iv=m.codec.base64.toBits(b.iv)),(!m.mode[b.mode]||!m.cipher[b.cipher]||"string"==typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&256!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)&&d(new m.exception.invalid("json decrypt: invalid parameters")),"string"==typeof a?(h=m.misc.cachedPbkdf2(a,b),a=h.key.slice(0,b.ks/32),b.salt=h.salt):m.ecc&&a instanceof m.ecc.elGamal.secretKey&&(a=a.unkem(m.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32)),"string"==typeof g&&(g=m.codec.utf8String.toBits(g)),h=new m.cipher[b.cipher](a),g="ccm"===b.mode&&m.arrayBuffer&&m.arrayBuffer.ccm&&b.ct instanceof ArrayBuffer?m.arrayBuffer.ccm.decrypt(h,b.ct,b.iv,b.tag,g,b.ts):m.mode[b.mode].decrypt(h,b.ct,b.iv,g,b.ts),f.h(e,b),e.key=a,1===c.raw?g:m.codec.utf8String.fromBits(g)},decrypt:function(a,b,c,d){var e=m.json;return e.$(a,e.decode(b),c,d)},encode:function(a){var b,c="{",e="";for(b in a)if(a.hasOwnProperty(b))switch(b.match(/^[a-z0-9]+$/i)||d(new m.exception.invalid("json encode: invalid property name")),c+=e+'"'+b+'":',e=",",typeof a[b]){case"number":case"boolean":c+=a[b];break;case"string":c+='"'+escape(a[b])+'"';break;case"object":c+='"'+m.codec.base64.fromBits(a[b],0)+'"';break;default:d(new m.exception.bug("json encode: unsupported type"))}return c+"}"},decode:function(a){a=a.replace(/\s/g,""),a.match(/^\{.*\}$/)||d(new m.exception.invalid("json decode: this isn't json!")),a=a.replace(/^\{|\}$/g,"").split(/,/);var b,c,e={};for(b=0;b<a.length;b++)(c=a[b].match(/^\s*(?:(["']?)([a-z][a-z0-9]*)\1)\s*:\s*(?:(-?\d+)|"([a-z0-9+\/%*_.@=\-]*)"|(true|false))$/i))||d(new m.exception.invalid("json decode: this isn't json!")),null!=c[3]?e[c[2]]=parseInt(c[3],10):null!=c[4]?e[c[2]]=c[2].match(/^(ct|adata|salt|iv)$/)?m.codec.base64.toBits(c[4]):unescape(c[4]):null!=c[5]&&(e[c[2]]="true"===c[5]);return e},h:function(a,b,c){if(a===k&&(a={}),b===k)return a;for(var e in b)b.hasOwnProperty(e)&&(c&&a[e]!==k&&a[e]!==b[e]&&d(new m.exception.invalid("required parameter overridden")),a[e]=b[e]);return a},la:function(a,b){var c,d={};for(c in a)a.hasOwnProperty(c)&&a[c]!==b[c]&&(d[c]=a[c]);return d},ka:function(a,b){var c,d={};for(c=0;c<b.length;c++)a[b[c]]!==k&&(d[b[c]]=a[b[c]]);return d}},m.encrypt=m.json.encrypt,m.decrypt=m.json.decrypt,m.misc.ia={},m.misc.cachedPbkdf2=function(a,b){var c,d=m.misc.ia;return b=b||{},c=b.iter||1e3,d=d[a]=d[a]||{},c=d[c]=d[c]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):m.random.randomWords(2,0)},d=b.salt===k?c.firstSalt:b.salt,c[d]=c[d]||m.misc.pbkdf2(a,d,b.iter),{key:c[d].slice(0),salt:d.slice(0)}}},{crypto:115}],30:[function(a,b,c){b.exports=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];
6
},{}],31:[function(a,b,c){function d(a){if(a.length<8)return!1;if(a.length>72)return!1;if(48!==a[0])return!1;if(a[1]!==a.length-2)return!1;if(2!==a[2])return!1;var b=a[3];if(0===b)return!1;if(5+b>=a.length)return!1;if(2!==a[4+b])return!1;var c=a[5+b];return 0!==c&&(6+b+c===a.length&&(!(128&a[4])&&(!(b>1&&0===a[4]&&!(128&a[5]))&&(!(128&a[b+6])&&!(c>1&&0===a[b+6]&&!(128&a[b+7]))))))}function e(a){if(a.length<8)throw new Error("DER sequence length is too short");if(a.length>72)throw new Error("DER sequence length is too long");if(48!==a[0])throw new Error("Expected DER sequence");if(a[1]!==a.length-2)throw new Error("DER sequence length is invalid");if(2!==a[2])throw new Error("Expected DER integer");var b=a[3];if(0===b)throw new Error("R length is zero");if(5+b>=a.length)throw new Error("R length is too long");if(2!==a[4+b])throw new Error("Expected DER integer (2)");var c=a[5+b];if(0===c)throw new Error("S length is zero");if(6+b+c!==a.length)throw new Error("S length is invalid");if(128&a[4])throw new Error("R value is negative");if(b>1&&0===a[4]&&!(128&a[5]))throw new Error("R value excessively padded");if(128&a[b+6])throw new Error("S value is negative");if(c>1&&0===a[b+6]&&!(128&a[b+7]))throw new Error("S value excessively padded");return{r:a.slice(4,4+b),s:a.slice(6+b)}}function f(a,b){var c=a.length,d=b.length;if(0===c)throw new Error("R length is zero");if(0===d)throw new Error("S length is zero");if(c>33)throw new Error("R length is too long");if(d>33)throw new Error("S length is too long");if(128&a[0])throw new Error("R value is negative");if(128&b[0])throw new Error("S value is negative");if(c>1&&0===a[0]&&!(128&a[1]))throw new Error("R value excessively padded");if(d>1&&0===b[0]&&!(128&b[1]))throw new Error("S value excessively padded");var e=Buffer.allocUnsafe(6+c+d);return e[0]=48,e[1]=e.length-2,e[2]=2,e[3]=a.length,a.copy(e,4),e[4+c]=2,e[5+c]=b.length,b.copy(e,6+c),e}var Buffer=a("safe-buffer").Buffer;b.exports={check:d,decode:e,encode:f}},{"safe-buffer":288}],32:[function(a,b,c){b.exports={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_1:81,OP_TRUE:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}},{}],33:[function(a,b,c){var d=a("./index.json"),e={};for(var f in d){var g=d[f];e[g]=f}b.exports=e},{"./index.json":32}],34:[function(a,b,c){function d(a){var b=k.decode(a);if(b.length<21)throw new TypeError(a+" is too short");if(b.length>21)throw new TypeError(a+" is too long");var c=b.readUInt8(0),d=b.slice(1);return{version:c,hash:d}}function e(a){var b=j.decode(a),c=j.fromWords(b.words.slice(1));return{version:b.words[0],prefix:b.prefix,data:Buffer.from(c)}}function f(a,b){n(o.tuple(o.Hash160bit,o.UInt8),arguments);var c=Buffer.allocUnsafe(21);return c.writeUInt8(b,0),a.copy(c,1),k.encode(c)}function g(a,b,c){var d=j.toWords(a);return d.unshift(b),j.encode(c,d)}function h(a,b){if(b=b||m.bitcoin,l.pubKeyHash.output.check(a))return f(l.compile(a).slice(3,23),b.pubKeyHash);if(l.scriptHash.output.check(a))return f(l.compile(a).slice(2,22),b.scriptHash);if(l.witnessPubKeyHash.output.check(a))return g(l.compile(a).slice(2,22),0,b.bech32);if(l.witnessScriptHash.output.check(a))return g(l.compile(a).slice(2,34),0,b.bech32);throw new Error(l.toASM(a)+" has no matching Address")}function i(a,b){b=b||m.bitcoin;var c;try{c=d(a)}catch(a){}if(c){if(c.version===b.pubKeyHash)return l.pubKeyHash.output.encode(c.hash);if(c.version===b.scriptHash)return l.scriptHash.output.encode(c.hash)}else{try{c=e(a)}catch(a){}if(c){if(c.prefix!==b.bech32)throw new Error(a+" has an invalid prefix");if(0===c.version){if(20===c.data.length)return l.witnessPubKeyHash.output.encode(c.data);if(32===c.data.length)return l.witnessScriptHash.output.encode(c.data)}}}throw new Error(a+" has no matching Script")}var Buffer=a("safe-buffer").Buffer,j=a("bech32"),k=a("bs58check"),l=a("./script"),m=a("./networks"),n=a("typeforce"),o=a("./types");b.exports={fromBase58Check:d,fromBech32:e,fromOutputScript:h,toBase58Check:f,toBech32:g,toOutputScript:i}},{"./networks":43,"./script":44,"./types":70,bech32:22,bs58check:100,"safe-buffer":288,typeforce:312}],35:[function(a,b,c){function d(){this.version=1,this.prevHash=null,this.merkleRoot=null,this.timestamp=0,this.bits=0,this.nonce=0}var Buffer=a("safe-buffer").Buffer,e=a("buffer-reverse"),f=a("./crypto"),g=a("merkle-lib/fastRoot"),h=a("typeforce"),i=a("./types"),j=a("varuint-bitcoin"),k=a("./transaction");d.fromBuffer=function(a){function b(b){return h+=b,a.slice(h-b,h)}function c(){var b=a.readUInt32LE(h);return h+=4,b}function e(){var b=a.readInt32LE(h);return h+=4,b}function f(){var b=j.decode(a,h);return h+=j.decode.bytes,b}function g(){var b=k.fromBuffer(a.slice(h),!0);return h+=b.byteLength(),b}if(a.length<80)throw new Error("Buffer too small (< 80 bytes)");var h=0,i=new d;if(i.version=e(),i.prevHash=b(32),i.merkleRoot=b(32),i.timestamp=c(),i.bits=c(),i.nonce=c(),80===a.length)return i;var l=f();i.transactions=[];for(var m=0;m<l;++m){var n=g();i.transactions.push(n)}return i},d.prototype.byteLength=function(a){return a||!this.transactions?80:80+j.encodingLength(this.transactions.length)+this.transactions.reduce(function(a,b){return a+b.byteLength()},0)},d.fromHex=function(a){return d.fromBuffer(Buffer.from(a,"hex"))},d.prototype.getHash=function(){return f.hash256(this.toBuffer(!0))},d.prototype.getId=function(){return e(this.getHash()).toString("hex")},d.prototype.getUTCDate=function(){var a=new Date(0);return a.setUTCSeconds(this.timestamp),a},d.prototype.toBuffer=function(a){function b(a){a.copy(e,f),f+=a.length}function c(a){e.writeInt32LE(a,f),f+=4}function d(a){e.writeUInt32LE(a,f),f+=4}var e=Buffer.allocUnsafe(this.byteLength(a)),f=0;return c(this.version),b(this.prevHash),b(this.merkleRoot),d(this.timestamp),d(this.bits),d(this.nonce),a||!this.transactions?e:(j.encode(this.transactions.length,e,f),f+=j.encode.bytes,this.transactions.forEach(function(a){var b=a.byteLength();a.toBuffer(e,f),f+=b}),e)},d.prototype.toHex=function(a){return this.toBuffer(a).toString("hex")},d.calculateTarget=function(a){var b=((4278190080&a)>>24)-3,c=8388607&a,d=Buffer.alloc(32,0);return d.writeUInt32BE(c,28-b),d},d.calculateMerkleRoot=function(a){if(h([{getHash:i.Function}],a),0===a.length)throw TypeError("Cannot compute merkle root for zero transactions");var b=a.map(function(a){return a.getHash()});return g(b,f.hash256)},d.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;var a=d.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(a)},d.prototype.checkProofOfWork=function(){var a=e(this.getHash()),b=d.calculateTarget(this.bits);return a.compare(b)<=0},b.exports=d},{"./crypto":37,"./transaction":68,"./types":70,"buffer-reverse":102,"merkle-lib/fastRoot":232,"safe-buffer":288,typeforce:312,"varuint-bitcoin":321}],36:[function(a,b,c){function d(a,b){if("number"!=typeof a)throw new Error("cannot write a non-number as a number");if(a<0)throw new Error("specified a negative value for writing an unsigned value");if(a>b)throw new Error("RangeError: value out of range");if(Math.floor(a)!==a)throw new Error("value has a fractional component")}function e(a,b){var c=a.readUInt32LE(b),e=a.readUInt32LE(b+4);return e*=4294967296,d(e+c,9007199254740991),e+c}function f(a,b,c){return d(b,9007199254740991),a.writeInt32LE(b&-1,c),a.writeUInt32LE(Math.floor(b/4294967296),c+4),c+8}function g(a,b){var c=j.decode(a,b);return{number:c,size:j.decode.bytes}}function h(a,b,c){return j.encode(b,a,c),j.encode.bytes}var i=a("pushdata-bitcoin"),j=a("varuint-bitcoin");b.exports={pushDataSize:i.encodingLength,readPushDataInt:i.decode,readUInt64LE:e,readVarInt:g,varIntBuffer:j.encode,varIntSize:j.encodingLength,writePushDataInt:i.encode,writeUInt64LE:f,writeVarInt:h}},{"pushdata-bitcoin":266,"varuint-bitcoin":321}],37:[function(a,b,c){function d(a){return i("rmd160").update(a).digest()}function e(a){return i("sha1").update(a).digest()}function f(a){return i("sha256").update(a).digest()}function g(a){return d(f(a))}function h(a){return f(f(a))}var i=a("create-hash");b.exports={hash160:g,hash256:h,ripemd160:d,sha1:e,sha256:f}},{"create-hash":110}],38:[function(a,b,c){function d(a,b,c){h(i.tuple(i.Hash256bit,i.Buffer256bit,i.Function),arguments);var d=Buffer.alloc(32,0),e=Buffer.alloc(32,1);d=g("sha256",d).update(e).update(k).update(b).update(a).digest(),e=g("sha256",d).update(e).digest(),d=g("sha256",d).update(e).update(l).update(b).update(a).digest(),e=g("sha256",d).update(e).digest(),e=g("sha256",d).update(e).digest();for(var f=BigInteger.fromBuffer(e);f.signum()<=0||f.compareTo(n.n)>=0||!c(f);)d=g("sha256",d).update(e).update(k).digest(),e=g("sha256",d).update(e).digest(),e=g("sha256",d).update(e).digest(),f=BigInteger.fromBuffer(e);return f}function e(a,b){h(i.tuple(i.Hash256bit,i.BigInt),arguments);var c,e,f=b.toBuffer(32),g=BigInteger.fromBuffer(a),k=n.n,l=n.G;return d(a,f,function(a){var d=l.multiply(a);return!n.isInfinity(d)&&(c=d.affineX.mod(k),0!==c.signum()&&(e=a.modInverse(k).multiply(g.add(b.multiply(c))).mod(k),0!==e.signum()))}),e.compareTo(o)>0&&(e=k.subtract(e)),new j(c,e)}function f(a,b,c){h(i.tuple(i.Hash256bit,i.ECSignature,i.ECPoint),arguments);var d=n.n,e=n.G,f=b.r,g=b.s;if(f.signum()<=0||f.compareTo(d)>=0)return!1;if(g.signum()<=0||g.compareTo(d)>=0)return!1;var j=BigInteger.fromBuffer(a),k=g.modInverse(d),l=j.multiply(k).mod(d),m=f.multiply(k).mod(d),o=e.multiplyTwo(l,c,m);if(n.isInfinity(o))return!1;var p=o.affineX,q=p.mod(d);return q.equals(f)}var Buffer=a("safe-buffer").Buffer,g=a("create-hmac"),h=a("typeforce"),i=a("./types"),BigInteger=a("bigi"),j=a("./ecsignature"),k=Buffer.alloc(1,0),l=Buffer.alloc(1,1),m=a("ecurve"),n=m.getCurveByName("secp256k1"),o=n.n.shiftRight(1);b.exports={deterministicGenerateK:d,sign:e,verify:f,__curve:n}},{"./ecsignature":40,"./types":70,bigi:25,"create-hmac":113,ecurve:189,"safe-buffer":288,typeforce:312}],39:[function(a,b,c){function ECPair(a,b,c){if(c&&h({compressed:i.maybe(i.Boolean),network:i.maybe(i.Network)},c),c=c||{},a){if(a.signum()<=0)throw new Error("Private key must be greater than 0");if(a.compareTo(m.n)>=0)throw new Error("Private key must be less than the curve order");if(b)throw new TypeError("Unexpected publicKey parameter");this.d=a}else h(i.ECPoint,b),this.__Q=b;this.compressed=void 0===c.compressed||c.compressed,this.network=c.network||k.bitcoin}var d=a("./address"),e=a("./crypto"),f=a("./ecdsa"),g=a("randombytes"),h=a("typeforce"),i=a("./types"),j=a("wif"),k=a("./networks"),BigInteger=a("bigi"),l=a("ecurve"),m=f.__curve;Object.defineProperty(ECPair.prototype,"Q",{get:function(){return!this.__Q&&this.d&&(this.__Q=m.G.multiply(this.d)),this.__Q}}),ECPair.fromPublicKeyBuffer=function(a,b){var c=l.Point.decodeFrom(m,a);return new ECPair(null,c,{compressed:c.compressed,network:b})},ECPair.fromWIF=function(a,b){var c=j.decode(a),d=c.version;if(i.Array(b)){if(b=b.filter(function(a){return d===a.wif}).pop(),!b)throw new Error("Unknown network version")}else if(b=b||k.bitcoin,d!==b.wif)throw new Error("Invalid network version");var e=BigInteger.fromBuffer(c.privateKey);return new ECPair(e,null,{compressed:c.compressed,network:b})},ECPair.makeRandom=function(a){a=a||{};var b,c=a.rng||g;do{var d=c(32);h(i.Buffer256bit,d),b=BigInteger.fromBuffer(d)}while(b.signum()<=0||b.compareTo(m.n)>=0);return new ECPair(b,null,a)},ECPair.prototype.getAddress=function(){return d.toBase58Check(e.hash160(this.getPublicKeyBuffer()),this.getNetwork().pubKeyHash)},ECPair.prototype.getNetwork=function(){return this.network},ECPair.prototype.getPublicKeyBuffer=function(){return this.Q.getEncoded(this.compressed)},ECPair.prototype.sign=function(a){if(!this.d)throw new Error("Missing private key");return f.sign(a,this.d)},ECPair.prototype.toWIF=function(){if(!this.d)throw new Error("Missing private key");return j.encode(this.network.wif,this.d.toBuffer(32),this.compressed)},ECPair.prototype.verify=function(a,b){return f.verify(a,b,this.Q)},b.exports=ECPair},{"./address":34,"./crypto":37,"./ecdsa":38,"./networks":43,"./types":70,bigi:25,ecurve:189,randombytes:271,typeforce:312,wif:324}],40:[function(a,b,c){(function(Buffer){function c(a,b){e(f.tuple(f.BigInt,f.BigInt),arguments),this.r=a,this.s=b}var d=a("bip66"),e=a("typeforce"),f=a("./types"),BigInteger=a("bigi");c.parseCompact=function(a){if(65!==a.length)throw new Error("Invalid signature length");var b=a.readUInt8(0)-27;if(b!==(7&b))throw new Error("Invalid signature parameter");var d=!!(4&b),e=3&b,f=BigInteger.fromBuffer(a.slice(1,33)),g=BigInteger.fromBuffer(a.slice(33));return{compressed:d,i:e,signature:new c(f,g)}},c.fromDER=function(a){var b=d.decode(a),e=BigInteger.fromDERInteger(b.r),f=BigInteger.fromDERInteger(b.s);return new c(e,f)},c.parseScriptSignature=function(a){var b=a.readUInt8(a.length-1),d=b&-193;if(d<=0||d>=4)throw new Error("Invalid hashType "+b);return{signature:c.fromDER(a.slice(0,-1)),hashType:b}},c.prototype.toCompact=function(a,b){b&&(a+=4),a+=27;var c=Buffer.alloc(65);return c.writeUInt8(a,0),this.r.toBuffer(32).copy(c,1),this.s.toBuffer(32).copy(c,33),c},c.prototype.toDER=function(){var a=Buffer.from(this.r.toDERInteger()),b=Buffer.from(this.s.toDERInteger());return d.encode(a,b)},c.prototype.toScriptSignature=function(a){var b=a&-193;if(b<=0||b>=4)throw new Error("Invalid hashType "+a);var c=Buffer.alloc(1);return c.writeUInt8(a,0),Buffer.concat([this.toDER(),c])},b.exports=c}).call(this,a("buffer").Buffer)},{"./types":70,bigi:25,bip66:31,buffer:104,typeforce:312}],41:[function(a,b,c){function HDNode(a,b){if(g(h.tuple("ECPair",h.Buffer256bit),arguments),!a.compressed)throw new TypeError("BIP32 only allows compressed keyPairs");this.keyPair=a,this.chainCode=b,this.depth=0,this.index=0,this.parentFingerprint=0}var Buffer=a("safe-buffer").Buffer,d=a("bs58check"),e=a("./crypto"),f=a("create-hmac"),g=a("typeforce"),h=a("./types"),i=a("./networks"),BigInteger=a("bigi"),ECPair=a("./ecpair"),j=a("ecurve"),k=j.getCurveByName("secp256k1");HDNode.HIGHEST_BIT=2147483648,HDNode.LENGTH=78,HDNode.MASTER_SECRET=Buffer.from("Bitcoin seed","utf8"),HDNode.fromSeedBuffer=function(a,b){if(g(h.tuple(h.Buffer,h.maybe(h.Network)),arguments),a.length<16)throw new TypeError("Seed should be at least 128 bits");if(a.length>64)throw new TypeError("Seed should be at most 512 bits");var c=f("sha512",HDNode.MASTER_SECRET).update(a).digest(),d=c.slice(0,32),e=c.slice(32),i=BigInteger.fromBuffer(d),j=new ECPair(i,null,{network:b});return new HDNode(j,e)},HDNode.fromSeedHex=function(a,b){return HDNode.fromSeedBuffer(Buffer.from(a,"hex"),b)},HDNode.fromBase58=function(a,b){var c=d.decode(a);if(78!==c.length)throw new Error("Invalid buffer length");var e,f=c.readUInt32BE(0);if(Array.isArray(b)){if(e=b.filter(function(a){return f===a.bip32.private||f===a.bip32.public}).pop(),!e)throw new Error("Unknown network version")}else e=b||i.bitcoin;if(f!==e.bip32.private&&f!==e.bip32.public)throw new Error("Invalid network version");var g=c[4],h=c.readUInt32BE(5);if(0===g&&0!==h)throw new Error("Invalid parent fingerprint");var l=c.readUInt32BE(9);if(0===g&&0!==l)throw new Error("Invalid index");var m,n=c.slice(13,45);if(f===e.bip32.private){if(0!==c.readUInt8(45))throw new Error("Invalid private key");var o=BigInteger.fromBuffer(c.slice(46,78));m=new ECPair(o,null,{network:e})}else{var p=j.Point.decodeFrom(k,c.slice(45,78));k.validate(p),m=new ECPair(null,p,{network:e})}var q=new HDNode(m,n);return q.depth=g,q.index=l,q.parentFingerprint=h,q},HDNode.prototype.getAddress=function(){return this.keyPair.getAddress()},HDNode.prototype.getIdentifier=function(){return e.hash160(this.keyPair.getPublicKeyBuffer())},HDNode.prototype.getFingerprint=function(){return this.getIdentifier().slice(0,4)},HDNode.prototype.getNetwork=function(){return this.keyPair.getNetwork()},HDNode.prototype.getPublicKeyBuffer=function(){return this.keyPair.getPublicKeyBuffer()},HDNode.prototype.neutered=function(){var a=new ECPair(null,this.keyPair.Q,{network:this.keyPair.network}),b=new HDNode(a,this.chainCode);return b.depth=this.depth,b.index=this.index,b.parentFingerprint=this.parentFingerprint,b},HDNode.prototype.sign=function(a){return this.keyPair.sign(a)},HDNode.prototype.verify=function(a,b){return this.keyPair.verify(a,b)},HDNode.prototype.toBase58=function(a){if(void 0!==a)throw new TypeError("Unsupported argument in 2.0.0");var b=this.keyPair.network,c=this.isNeutered()?b.bip32.public:b.bip32.private,e=Buffer.allocUnsafe(78);return e.writeUInt32BE(c,0),e.writeUInt8(this.depth,4),e.writeUInt32BE(this.parentFingerprint,5),e.writeUInt32BE(this.index,9),this.chainCode.copy(e,13),this.isNeutered()?this.keyPair.getPublicKeyBuffer().copy(e,45):(e.writeUInt8(0,45),this.keyPair.d.toBuffer(32).copy(e,46)),d.encode(e)},HDNode.prototype.derive=function(a){g(h.UInt32,a);var b=a>=HDNode.HIGHEST_BIT,c=Buffer.allocUnsafe(37);if(b){if(this.isNeutered())throw new TypeError("Could not derive hardened child key");c[0]=0,this.keyPair.d.toBuffer(32).copy(c,1),c.writeUInt32BE(a,33)}else this.keyPair.getPublicKeyBuffer().copy(c,0),c.writeUInt32BE(a,33);var d=f("sha512",this.chainCode).update(c).digest(),e=d.slice(0,32),i=d.slice(32),j=BigInteger.fromBuffer(e);if(j.compareTo(k.n)>=0)return this.derive(a+1);var l;if(this.isNeutered()){var m=k.G.multiply(j).add(this.keyPair.Q);if(k.isInfinity(m))return this.derive(a+1);l=new ECPair(null,m,{network:this.keyPair.network})}else{var n=j.add(this.keyPair.d).mod(k.n);if(0===n.signum())return this.derive(a+1);l=new ECPair(n,null,{network:this.keyPair.network})}var o=new HDNode(l,i);return o.depth=this.depth+1,o.index=a,o.parentFingerprint=this.getFingerprint().readUInt32BE(0),o},HDNode.prototype.deriveHardened=function(a){return g(h.UInt31,a),this.derive(a+HDNode.HIGHEST_BIT)},HDNode.prototype.isNeutered=function(){return!this.keyPair.d},HDNode.prototype.derivePath=function(a){g(h.BIP32Path,a);var b=a.split("/");if("m"===b[0]){if(this.parentFingerprint)throw new Error("Not a master node");b=b.slice(1)}return b.reduce(function(a,b){var c;return"'"===b.slice(-1)?(c=parseInt(b.slice(0,-1),10),a.deriveHardened(c)):(c=parseInt(b,10),a.derive(c))},this)},b.exports=HDNode},{"./crypto":37,"./ecpair":39,"./networks":43,"./types":70,bigi:25,bs58check:100,"create-hmac":113,ecurve:189,"safe-buffer":288,typeforce:312}],42:[function(a,b,c){b.exports={Block:a("./block"),ECPair:a("./ecpair"),ECSignature:a("./ecsignature"),HDNode:a("./hdnode"),Transaction:a("./transaction"),TransactionBuilder:a("./transaction_builder"),address:a("./address"),bufferutils:a("./bufferutils"),crypto:a("./crypto"),networks:a("./networks"),opcodes:a("bitcoin-ops"),script:a("./script")}},{"./address":34,"./block":35,"./bufferutils":36,"./crypto":37,"./ecpair":39,"./ecsignature":40,"./hdnode":41,"./networks":43,"./script":44,"./transaction":68,"./transaction_builder":69,"bitcoin-ops":32}],43:[function(a,b,c){b.exports={bitcoincash:{messagePrefix:"Bitcoin Signed Message:\n",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},bitcoincashtestnet:{messagePrefix:"Bitcoin Signed Message:\n",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},testnet:{messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},litecoin:{messagePrefix:"Litecoin Signed Message:\n",bip32:{public:27108450,private:27106558},pubKeyHash:48,scriptHash:50,wif:176}}},{}],44:[function(a,b,c){function d(a){return s.Number(a)&&(a===u.OP_0||a>=u.OP_1&&a<=u.OP_16||a===u.OP_1NEGATE)}function e(a){return s.Buffer(a)||d(a)}function f(a){return s.Array(a)&&a.every(e)}function g(a){if(0===a.length)return u.OP_0;if(1===a.length)return a[0]>=1&&a[0]<=16?w+a[0]:129===a[0]?u.OP_1NEGATE:void 0}function h(a){if(Buffer.isBuffer(a))return a;r(s.Array,a);var b=a.reduce(function(a,b){return Buffer.isBuffer(b)?1===b.length&&void 0!==g(b)?a+1:a+q.encodingLength(b.length)+b.length:a+1},0),c=Buffer.allocUnsafe(b),d=0;if(a.forEach(function(a){if(Buffer.isBuffer(a)){var b=g(a);if(void 0!==b)return c.writeUInt8(b,d),void(d+=1);d+=q.encode(c,a.length,d),a.copy(c,d),d+=a.length}else c.writeUInt8(a,d),d+=1}),d!==c.length)throw new Error("Could not decode chunks");return c}function i(a){if(s.Array(a))return a;r(s.Buffer,a);for(var b=[],c=0;c<a.length;){var d=a[c];if(d>u.OP_0&&d<=u.OP_PUSHDATA4){var e=q.decode(a,c);if(null===e)return[];if(c+=e.size,c+e.number>a.length)return[];var f=a.slice(c,c+e.number);c+=e.number;var h=g(f);void 0!==h?b.push(h):b.push(f)}else b.push(d),c+=1}return b}function j(a){return Buffer.isBuffer(a)&&(a=i(a)),a.map(function(a){if(Buffer.isBuffer(a)){var b=g(a);if(void 0===b)return a.toString("hex");a=b}return v[a]}).join(" ")}function k(asm){return r(s.String,asm),h(asm.split(" ").map(function(a){return void 0!==u[a]?u[a]:(r(s.Hex,a),Buffer.from(a,"hex"))}))}function l(a){return a=i(a),r(f,a),a.map(function(a){return Buffer.isBuffer(a)?a:a===u.OP_0?Buffer.allocUnsafe(0):t.encode(a-w)})}function m(a){if(!Buffer.isBuffer(a))return!1;if(a.length<33)return!1;switch(a[0]){case 2:case 3:return 33===a.length;case 4:return 65===a.length}return!1}function n(a){var b=a&-193;return b>0&&b<4}function o(a){return!!Buffer.isBuffer(a)&&(!!n(a[a.length-1])&&p.check(a.slice(0,-1)))}var Buffer=a("safe-buffer").Buffer,p=a("bip66"),q=a("pushdata-bitcoin"),r=a("typeforce"),s=a("./types"),t=a("./script_number"),u=a("bitcoin-ops"),v=a("bitcoin-ops/map"),w=u.OP_RESERVED;b.exports={compile:h,decompile:i,fromASM:k,toASM:j,toStack:l,number:a("./script_number"),isCanonicalPubKey:m,isCanonicalSignature:o,isPushOnly:f,isDefinedHashType:n};var x=a("./templates");for(var y in x)b.exports[y]=x[y]},{"./script_number":45,"./templates":46,"./types":70,bip66:31,"bitcoin-ops":32,"bitcoin-ops/map":33,"pushdata-bitcoin":266,"safe-buffer":288,typeforce:312}],45:[function(a,b,c){function d(a,b,c){b=b||4,c=void 0===c||c;var d=a.length;if(0===d)return 0;if(d>b)throw new TypeError("Script number overflow");if(c&&0===(127&a[d-1])&&(d<=1||0===(128&a[d-2])))throw new Error("Non-minimally encoded script number");if(5===d){var e=a.readUInt32LE(0),f=a.readUInt8(4);return 128&f?-(4294967296*(f&-129)+e):4294967296*f+e}for(var g=0,h=0;h<d;++h)g|=a[h]<<8*h;return 128&a[d-1]?-(g&~(128<<8*(d-1))):g}function e(a){return a>2147483647?5:a>8388607?4:a>32767?3:a>127?2:a>0?1:0}function f(a){for(var b=Math.abs(a),c=e(b),d=Buffer.allocUnsafe(c),f=a<0,g=0;g<c;++g)d.writeUInt8(255&b,g),b>>=8;return 128&d[c-1]?d.writeUInt8(f?128:0,c-1):f&&(d[c-1]|=128),d}var Buffer=a("safe-buffer").Buffer;b.exports={decode:d,encode:f}},{"safe-buffer":288}],46:[function(a,b,c){function d(a){if(m.output.check(a))return p.P2WPKH;if(n.output.check(a))return p.P2WSH;if(k.output.check(a))return p.P2PKH;if(l.output.check(a))return p.P2SH;var b=g(a);return h.output.check(b)?p.MULTISIG:j.output.check(b)?p.P2PK:o.output.check(b)?p.WITNESS_COMMITMENT:i.output.check(b)?p.NULLDATA:p.NONSTANDARD}function e(a,b){var c=g(a);return k.input.check(c)?p.P2PKH:h.input.check(c,b)?p.MULTISIG:l.input.check(c,b)?p.P2SH:j.input.check(c)?p.P2PK:p.NONSTANDARD}function f(a,b){var c=g(a);return m.input.check(c)?p.P2WPKH:n.input.check(c,b)?p.P2WSH:p.NONSTANDARD}var g=a("../script").decompile,h=a("./multisig"),i=a("./nulldata"),j=a("./pubkey"),k=a("./pubkeyhash"),l=a("./scripthash"),m=a("./witnesspubkeyhash"),n=a("./witnessscripthash"),o=a("./witnesscommitment"),p={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};b.exports={classifyInput:e,classifyOutput:d,classifyWitness:f,multisig:h,nullData:i,pubKey:j,pubKeyHash:k,scriptHash:l,witnessPubKeyHash:m,witnessScriptHash:n,witnessCommitment:o,types:p}},{"../script":44,"./multisig":47,"./nulldata":50,"./pubkey":51,"./pubkeyhash":54,"./scripthash":57,"./witnesscommitment":60,"./witnesspubkeyhash":62,"./witnessscripthash":65}],47:[function(a,b,c){b.exports={input:a("./input"),output:a("./output")}},{"./input":48,"./output":49}],48:[function(a,b,c){function d(a){return a===l.OP_0||j.isCanonicalSignature(a)}function e(a,b){var c=j.decompile(a);return!(c.length<2)&&(c[0]===l.OP_0&&(b?c.slice(1).every(d):c.slice(1).every(j.isCanonicalSignature)))}function f(a,b){if(k([d],a),b){var c=j.multisig.output.decode(b);if(a.length<c.m)throw new TypeError("Not enough signatures provided");if(a.length>c.pubKeys.length)throw new TypeError("Too many signatures provided")}return[].concat(m,a.map(function(a){return a===l.OP_0?m:a}))}function g(a,b){return j.compile(f(a,b))}function h(a,b){return k(e,a,b),a.slice(1)}function i(a,b){var c=j.decompile(a);return h(c,b)}var Buffer=a("safe-buffer").Buffer,j=a("../../script"),k=a("typeforce"),l=a("bitcoin-ops");e.toJSON=function(){return"multisig input"};var m=Buffer.allocUnsafe(0);b.exports={check:e,decode:i,decodeStack:h,encode:g,encodeStack:f}},{"../../script":44,"bitcoin-ops":32,"safe-buffer":288,typeforce:312}],49:[function(a,b,c){function d(a,b){var c=g.decompile(a);if(c.length<4)return!1;if(c[c.length-1]!==j.OP_CHECKMULTISIG)return!1;if(!h.Number(c[0]))return!1;if(!h.Number(c[c.length-2]))return!1;var d=c[0]-k,e=c[c.length-2]-k;if(d<=0)return!1;if(e>16)return!1;if(d>e)return!1;if(e!==c.length-3)return!1;if(b)return!0;var f=c.slice(1,-2);return f.every(g.isCanonicalPubKey)}function e(a,b){i({m:h.Number,pubKeys:[g.isCanonicalPubKey]},{m:a,pubKeys:b});var c=b.length;if(c<a)throw new TypeError("Not enough pubKeys provided");return g.compile([].concat(k+a,b,k+c,j.OP_CHECKMULTISIG))}function f(a,b){var c=g.decompile(a);return i(d,c,b),{m:c[0]-k,pubKeys:c.slice(1,-2)}}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops"),k=j.OP_RESERVED;d.toJSON=function(){return"multi-sig output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],50:[function(a,b,c){function d(a){var b=g.compile(a);return b.length>1&&b[0]===j.OP_RETURN}function e(a){return i(h.Buffer,a),g.compile([j.OP_RETURN,a])}function f(a){return i(d,a),a.slice(2)}var g=a("../script"),h=a("../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"null data output"},b.exports={output:{check:d,decode:f,encode:e}}},{"../script":44,"../types":70,"bitcoin-ops":32,typeforce:312}],51:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":52,"./output":53,dup:47}],52:[function(a,b,c){function d(a){var b=i.decompile(a);return 1===b.length&&i.isCanonicalSignature(b[0])}function e(a){return j(i.isCanonicalSignature,a),[a]}function f(a){return i.compile(e(a))}function g(a){return j(d,a),a[0]}function h(a){var b=i.decompile(a);return g(b)}var i=a("../../script"),j=a("typeforce");d.toJSON=function(){return"pubKey input"},b.exports={check:d,decode:h,decodeStack:g,encode:f,encodeStack:e}},{"../../script":44,typeforce:312}],53:[function(a,b,c){function d(a){var b=g.decompile(a);return 2===b.length&&g.isCanonicalPubKey(b[0])&&b[1]===i.OP_CHECKSIG}function e(a){return h(g.isCanonicalPubKey,a),g.compile([a,i.OP_CHECKSIG])}function f(a){var b=g.decompile(a);return h(d,b),b[0]}var g=a("../../script"),h=a("typeforce"),i=a("bitcoin-ops");d.toJSON=function(){return"pubKey output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"bitcoin-ops":32,typeforce:312}],54:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":55,"./output":56,dup:47}],55:[function(a,b,c){function d(a){var b=i.decompile(a);return 2===b.length&&i.isCanonicalSignature(b[0])&&i.isCanonicalPubKey(b[1])}function e(a,b){return j({signature:i.isCanonicalSignature,pubKey:i.isCanonicalPubKey},{signature:a,pubKey:b}),[a,b]}function f(a,b){return i.compile(e(a,b))}function g(a){return j(d,a),{signature:a[0],pubKey:a[1]}}function h(a){var b=i.decompile(a);return g(b)}var i=a("../../script"),j=a("typeforce");d.toJSON=function(){return"pubKeyHash input"},b.exports={check:d,decode:h,decodeStack:g,encode:f,encodeStack:e}},{"../../script":44,typeforce:312}],56:[function(a,b,c){function d(a){var b=g.compile(a);return 25===b.length&&b[0]===j.OP_DUP&&b[1]===j.OP_HASH160&&20===b[2]&&b[23]===j.OP_EQUALVERIFY&&b[24]===j.OP_CHECKSIG}function e(a){return i(h.Hash160bit,a),g.compile([j.OP_DUP,j.OP_HASH160,a,j.OP_EQUALVERIFY,j.OP_CHECKSIG])}function f(a){return i(d,a),a.slice(3,23)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"pubKeyHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],57:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":58,"./output":59,dup:47}],58:[function(a,b,c){function d(a,b){var c=i.decompile(a);if(c.length<1)return!1;var d=c[c.length-1];if(!Buffer.isBuffer(d))return!1;var e=i.decompile(i.compile(c.slice(0,-1))),f=i.decompile(d);if(0===f.length)return!1;if(!i.isPushOnly(e))return!1;var g=i.classifyInput(e,b),h=i.classifyOutput(f);return 1===c.length?h===i.types.P2WSH||h===i.types.P2WPKH:g===h}function e(a,b){var c=i.compile(b);return[].concat(a,c)}function f(a,b){var c=i.decompile(a);return i.compile(e(c,b))}function g(a){return j(d,a),{redeemScriptStack:a.slice(0,-1),redeemScript:a[a.length-1]}}function h(a){var b=i.decompile(a),c=g(b);return c.redeemScriptSig=i.compile(c.redeemScriptStack),delete c.redeemScriptStack,c}var Buffer=a("safe-buffer").Buffer,i=a("../../script"),j=a("typeforce");d.toJSON=function(){return"scriptHash input"},b.exports={check:d,decode:h,decodeStack:g,encode:f,encodeStack:e}},{"../../script":44,"safe-buffer":288,typeforce:312}],59:[function(a,b,c){function d(a){var b=g.compile(a);return 23===b.length&&b[0]===j.OP_HASH160&&20===b[1]&&b[22]===j.OP_EQUAL}function e(a){return i(h.Hash160bit,a),g.compile([j.OP_HASH160,a,j.OP_EQUAL])}function f(a){return i(d,a),a.slice(2,22)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"scriptHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],60:[function(a,b,c){b.exports={output:a("./output")}},{"./output":61}],61:[function(a,b,c){function d(a){var b=g.compile(a);return b.length>37&&b[0]===j.OP_RETURN&&36===b[1]&&b.slice(2,6).equals(k)}function e(a){i(h.Hash256bit,a);var b=Buffer.allocUnsafe(36);return k.copy(b,0),a.copy(b,4),g.compile([j.OP_RETURN,b])}function f(a){return i(d,a),g.decompile(a)[1].slice(4,36)}var Buffer=a("safe-buffer").Buffer,g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops"),k=Buffer.from("aa21a9ed","hex");
7
d.toJSON=function(){return"Witness commitment output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,"safe-buffer":288,typeforce:312}],62:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":63,"./output":64,dup:47}],63:[function(a,b,c){function d(a){return h.isCanonicalPubKey(a)&&33===a.length}function e(a){var b=h.decompile(a);return 2===b.length&&h.isCanonicalSignature(b[0])&&d(b[1])}function f(a,b){return i({signature:h.isCanonicalSignature,pubKey:d},{signature:a,pubKey:b}),[a,b]}function g(a){return i(e,a),{signature:a[0],pubKey:a[1]}}var h=a("../../script"),i=a("typeforce");e.toJSON=function(){return"witnessPubKeyHash input"},b.exports={check:e,decodeStack:g,encodeStack:f}},{"../../script":44,typeforce:312}],64:[function(a,b,c){function d(a){var b=g.compile(a);return 22===b.length&&b[0]===j.OP_0&&20===b[1]}function e(a){return i(h.Hash160bit,a),g.compile([j.OP_0,a])}function f(a){return i(d,a),a.slice(2)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"Witness pubKeyHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],65:[function(a,b,c){arguments[4][47][0].apply(c,arguments)},{"./input":66,"./output":67,dup:47}],66:[function(a,b,c){var d=a("../scripthash/input");b.exports={check:d.check,decodeStack:d.decodeStack,encodeStack:d.encodeStack}},{"../scripthash/input":58}],67:[function(a,b,c){function d(a){var b=g.compile(a);return 34===b.length&&b[0]===j.OP_0&&32===b[1]}function e(a){return i(h.Hash256bit,a),g.compile([j.OP_0,a])}function f(a){return i(d,a),a.slice(2)}var g=a("../../script"),h=a("../../types"),i=a("typeforce"),j=a("bitcoin-ops");d.toJSON=function(){return"Witness scriptHash output"},b.exports={check:d,decode:f,encode:e}},{"../../script":44,"../../types":70,"bitcoin-ops":32,typeforce:312}],68:[function(a,b,c){function d(a){var b=a.length;return n.encodingLength(b)+b}function e(a){var b=a.length;return n.encodingLength(b)+a.reduce(function(a,b){return a+d(b)},0)}function f(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}var Buffer=a("safe-buffer").Buffer,g=a("buffer-reverse"),h=a("./crypto"),i=a("./script"),j=a("./bufferutils"),k=a("bitcoin-ops"),l=a("typeforce"),m=a("./types"),n=a("varuint-bitcoin");f.DEFAULT_SEQUENCE=4294967295,f.SIGHASH_ALL=1,f.SIGHASH_NONE=2,f.SIGHASH_SINGLE=3,f.SIGHASH_ANYONECANPAY=128,f.SIGHASH_BITCOINCASHBIP143=64,f.ADVANCED_TRANSACTION_MARKER=0,f.ADVANCED_TRANSACTION_FLAG=1;var o=Buffer.allocUnsafe(0),p=[],q=Buffer.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),r=Buffer.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),s=Buffer.from("ffffffffffffffff","hex"),t={script:o,valueBuffer:s};f.fromBuffer=function(a,b){function c(b){return l+=b,a.slice(l-b,l)}function d(){var b=a.readUInt32LE(l);return l+=4,b}function e(){var b=a.readInt32LE(l);return l+=4,b}function g(){var b=j.readUInt64LE(a,l);return l+=8,b}function h(){var b=n.decode(a,l);return l+=n.decode.bytes,b}function i(){return c(h())}function k(){for(var a=h(),b=[],c=0;c<a;c++)b.push(i());return b}var l=0,m=new f;m.version=e();var o=a.readUInt8(l),q=a.readUInt8(l+1),r=!1;o===f.ADVANCED_TRANSACTION_MARKER&&q===f.ADVANCED_TRANSACTION_FLAG&&(l+=2,r=!0);for(var s=h(),t=0;t<s;++t)m.ins.push({hash:c(32),index:d(),script:i(),sequence:d(),witness:p});var u=h();for(t=0;t<u;++t)m.outs.push({value:g(),script:i()});if(r){for(t=0;t<s;++t)m.ins[t].witness=k();if(!m.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(m.locktime=d(),b)return m;if(l!==a.length)throw new Error("Transaction has unexpected data");return m},f.fromHex=function(a){return f.fromBuffer(Buffer.from(a,"hex"))},f.isCoinbaseHash=function(a){l(m.Hash256bit,a);for(var b=0;b<32;++b)if(0!==a[b])return!1;return!0},f.prototype.isCoinbase=function(){return 1===this.ins.length&&f.isCoinbaseHash(this.ins[0].hash)},f.prototype.addInput=function(a,b,c,d){return l(m.tuple(m.Hash256bit,m.UInt32,m.maybe(m.UInt32),m.maybe(m.Buffer)),arguments),m.Null(c)&&(c=f.DEFAULT_SEQUENCE),this.ins.push({hash:a,index:b,script:d||o,sequence:c,witness:p})-1},f.prototype.addOutput=function(a,b){return l(m.tuple(m.Buffer,m.Satoshi),arguments),this.outs.push({script:a,value:b})-1},f.prototype.hasWitnesses=function(){return this.ins.some(function(a){return 0!==a.witness.length})},f.prototype.weight=function(){var a=this.__byteLength(!1),b=this.__byteLength(!0);return 3*a+b},f.prototype.virtualSize=function(){return Math.ceil(this.weight()/4)},f.prototype.byteLength=function(){return this.__byteLength(!0)},f.prototype.__byteLength=function(a){var b=a&&this.hasWitnesses();return(b?10:8)+n.encodingLength(this.ins.length)+n.encodingLength(this.outs.length)+this.ins.reduce(function(a,b){return a+40+d(b.script)},0)+this.outs.reduce(function(a,b){return a+8+d(b.script)},0)+(b?this.ins.reduce(function(a,b){return a+e(b.witness)},0):0)},f.prototype.clone=function(){var a=new f;return a.version=this.version,a.locktime=this.locktime,a.ins=this.ins.map(function(a){return{hash:a.hash,index:a.index,script:a.script,sequence:a.sequence,witness:a.witness}}),a.outs=this.outs.map(function(a){return{script:a.script,value:a.value}}),a},f.prototype.hashForSignature=function(a,b,c){if(l(m.tuple(m.UInt32,m.Buffer,m.Number),arguments),a>=this.ins.length)return r;var d=i.compile(i.decompile(b).filter(function(a){return a!==k.OP_CODESEPARATOR})),e=this.clone();if((31&c)===f.SIGHASH_NONE)e.outs=[],e.ins.forEach(function(b,c){c!==a&&(b.sequence=0)});else if((31&c)===f.SIGHASH_SINGLE){if(a>=this.outs.length)return r;e.outs.length=a+1;for(var g=0;g<a;g++)e.outs[g]=t;e.ins.forEach(function(b,c){c!==a&&(b.sequence=0)})}c&f.SIGHASH_ANYONECANPAY?(e.ins=[e.ins[a]],e.ins[0].script=d):(e.ins.forEach(function(a){a.script=o}),e.ins[a].script=d);var j=Buffer.allocUnsafe(e.__byteLength(!1)+4);return j.writeInt32LE(c,j.length-4),e.__toBuffer(j,0,!1),h.hash256(j)},f.prototype.hashForWitnessV0=function(a,b,c,e){function g(a){s+=a.copy(r,s)}function i(a){s=r.writeUInt32LE(a,s)}function k(a){s=j.writeUInt64LE(r,a,s)}function o(a){n.encode(a,r,s),s+=n.encode.bytes}function p(a){o(a.length),g(a)}l(m.tuple(m.UInt32,m.Buffer,m.Satoshi,m.UInt32),arguments);var r,s,t=q,u=q,v=q;if(e&f.SIGHASH_ANYONECANPAY||(r=Buffer.allocUnsafe(36*this.ins.length),s=0,this.ins.forEach(function(a){g(a.hash),i(a.index)}),u=h.hash256(r)),e&f.SIGHASH_ANYONECANPAY||(31&e)===f.SIGHASH_SINGLE||(31&e)===f.SIGHASH_NONE||(r=Buffer.allocUnsafe(4*this.ins.length),s=0,this.ins.forEach(function(a){i(a.sequence)}),v=h.hash256(r)),(31&e)!==f.SIGHASH_SINGLE&&(31&e)!==f.SIGHASH_NONE){var w=this.outs.reduce(function(a,b){return a+8+d(b.script)},0);r=Buffer.allocUnsafe(w),s=0,this.outs.forEach(function(a){k(a.value),p(a.script)}),t=h.hash256(r)}else if((31&e)===f.SIGHASH_SINGLE&&a<this.outs.length){var x=this.outs[a];r=Buffer.allocUnsafe(8+d(x.script)),s=0,k(x.value),p(x.script),t=h.hash256(r)}r=Buffer.allocUnsafe(156+d(b)),s=0;var y=this.ins[a];return i(this.version),g(u),g(v),g(y.hash),i(y.index),p(b),k(c),i(y.sequence),g(t),i(this.locktime),i(e),h.hash256(r)},f.prototype.hashForCashSignature=function(a,b,c,d){if(l(m.tuple(m.UInt32,m.Buffer,m.Number,m.maybe(m.UInt53)),arguments),d&f.SIGHASH_BITCOINCASHBIP143){if(m.Null(c))throw new Error("Bitcoin Cash sighash requires value of input to be signed.");return this.hashForWitnessV0(a,b,c,d)}return this.hashForSignature(a,b,d)},f.prototype.getHash=function(){return h.hash256(this.__toBuffer(void 0,void 0,!1))},f.prototype.getId=function(){return g(this.getHash()).toString("hex")},f.prototype.toBuffer=function(a,b){return this.__toBuffer(a,b,!0)},f.prototype.__toBuffer=function(a,b,c){function d(b){o+=b.copy(a,o)}function e(b){o=a.writeUInt8(b,o)}function g(b){o=a.writeUInt32LE(b,o)}function h(b){o=a.writeInt32LE(b,o)}function i(b){o=j.writeUInt64LE(a,b,o)}function k(b){n.encode(b,a,o),o+=n.encode.bytes}function l(a){k(a.length),d(a)}function m(a){k(a.length),a.forEach(l)}a||(a=Buffer.allocUnsafe(this.__byteLength(c)));var o=b||0;h(this.version);var p=c&&this.hasWitnesses();return p&&(e(f.ADVANCED_TRANSACTION_MARKER),e(f.ADVANCED_TRANSACTION_FLAG)),k(this.ins.length),this.ins.forEach(function(a){d(a.hash),g(a.index),l(a.script),g(a.sequence)}),k(this.outs.length),this.outs.forEach(function(a){a.valueBuffer?d(a.valueBuffer):i(a.value),l(a.script)}),p&&this.ins.forEach(function(a){m(a.witness)}),g(this.locktime),void 0!==b?a.slice(b,o):a},f.prototype.toHex=function(){return this.toBuffer().toString("hex")},f.prototype.setInputScript=function(a,b){l(m.tuple(m.Number,m.Buffer),arguments),this.ins[a].script=b},f.prototype.setWitness=function(a,b){l(m.tuple(m.Number,[m.Buffer]),arguments),this.ins[a].witness=b},b.exports=f},{"./bufferutils":36,"./crypto":37,"./script":44,"./types":70,"bitcoin-ops":32,"buffer-reverse":102,"safe-buffer":288,typeforce:312,"varuint-bitcoin":321}],69:[function(a,b,c){function d(a){return A.indexOf(a)!==-1}function e(a){return B.indexOf(a)!==-1}function f(a,b,c){var d=[],e=[];switch(a){case z.P2PKH:d=b.slice(1),e=b.slice(0,1);break;case z.P2PK:d[0]=c?u.pubKey.output.decode(c):void 0,e=b.slice(0,1);break;case z.MULTISIG:if(c){var f=u.multisig.output.decode(c);d=f.pubKeys}e=b.slice(1).map(function(a){return 0===a.length?void 0:a})}return{pubKeys:d,signatures:e}}function g(a,b){if(0===a.length&&0===b.length)return{};var c,g,h,i,j,k,l,m,n,o,p=!1,q=!1,r=!1,s=u.decompile(a),v=u.classifyInput(s,!0);v===z.P2SH&&(r=!0,j=s[s.length-1],m=u.classifyOutput(j),c=u.scriptHash.output.encode(t.hash160(j)),g=z.P2SH,i=j);var w=u.classifyWitness(b,!0);if(w===z.P2WSH){if(k=b[b.length-1],l=u.classifyOutput(k),q=!0,p=!0,0===a.length){if(c=u.witnessScriptHash.output.encode(t.sha256(k)),g=z.P2WSH,void 0!==j)throw new Error("Redeem script given when unnecessary")}else{if(!j)throw new Error("No redeemScript provided for P2WSH, but scriptSig non-empty");if(n=u.witnessScriptHash.output.encode(t.sha256(k)),!j.equals(n))throw new Error("Redeem script didn't match witnessScript")}if(!d(u.classifyOutput(k)))throw new Error("unsupported witness script");i=k,h=l,o=b.slice(0,-1)}else if(w===z.P2WPKH){p=!0;var x=b[b.length-1],y=t.hash160(x);if(0===a.length){if(c=u.witnessPubKeyHash.output.encode(y),g=z.P2WPKH,"undefined"!=typeof j)throw new Error("Redeem script given when unnecessary")}else{if(!j)throw new Error("No redeemScript provided for P2WPKH, but scriptSig wasn't empty");if(n=u.witnessPubKeyHash.output.encode(y),!j.equals(n))throw new Error("Redeem script did not have the right witness program")}h=z.P2PKH,o=b}else if(j){if(!e(m))throw new Error("Bad redeemscript!");i=j,h=m,o=s.slice(0,-1)}else g=h=u.classifyInput(a),o=s;var A=f(h,o,i),B={pubKeys:A.pubKeys,signatures:A.signatures,prevOutScript:c,prevOutType:g,signType:h,signScript:i,witness:Boolean(p)};return r&&(B.redeemScript=j,B.redeemScriptType=m),q&&(B.witnessScript=k,B.witnessScriptType=l),B}function h(a,b,c,d){if(a.signType===z.MULTISIG&&a.signScript&&a.pubKeys.length!==a.signatures.length){var e=a.signatures.concat();a.signatures=a.pubKeys.map(function(f){var g,h=ECPair.fromPublicKeyBuffer(f);return e.some(function(f,i){if(!f)return!1;var j,k=C.parseScriptSignature(f);return j=d?b.hashForCashSignature(c,a.signScript,a.value,k.hashType):a.witness?b.hashForWitnessV0(c,a.signScript,a.value,k.hashType):b.hashForSignature(c,a.signScript,k.hashType),!!h.verify(j,k.signature)&&(e[i]=void 0,g=f,!0)}),g})}}function i(a,b,c){x(y.Buffer,a);var d=u.decompile(a);b||(b=u.classifyOutput(a));var e=[];switch(b){case z.P2PKH:if(!c)break;var f=d[2],g=t.hash160(c);f.equals(g)&&(e=[c]);break;case z.P2WPKH:if(!c)break;var h=d[1],i=t.hash160(c);h.equals(i)&&(e=[c]);break;case z.P2PK:e=d.slice(0,1);break;case z.MULTISIG:e=d.slice(1,-2);break;default:return{scriptType:b}}return{pubKeys:e,scriptType:b,signatures:e.map(function(){})}}function j(a,b){if(a.prevOutType){if(a.prevOutType!==z.P2SH)throw new Error("PrevOutScript must be P2SH");var c=u.decompile(a.prevOutScript)[1];if(!c.equals(b))throw new Error("Inconsistent hash160(RedeemScript)")}}function k(a,b){if(a.prevOutType){if(a.prevOutType!==z.P2WSH)throw new Error("PrevOutScript must be P2WSH");var c=u.decompile(a.prevOutScript)[1];if(!c.equals(b))throw new Error("Inconsistent sha25(WitnessScript)")}}function l(a,b,c,d,e){var f,g,h,l,m,n,o,p,q,r=!1,s=!1,v=!1;if(c&&e){if(m=t.hash160(c),o=t.sha256(e),j(a,m),!c.equals(u.witnessScriptHash.output.encode(o)))throw new Error("Witness script inconsistent with redeem script");if(f=i(e,void 0,b),!f.pubKeys)throw new Error('WitnessScript not supported "'+u.toASM(c)+'"');g=u.types.P2SH,h=u.scriptHash.output.encode(m),r=s=v=!0,l=u.types.P2WSH,p=n=f.scriptType,q=e}else if(c){if(m=t.hash160(c),j(a,m),f=i(c,void 0,b),!f.pubKeys)throw new Error('RedeemScript not supported "'+u.toASM(c)+'"');g=u.types.P2SH,h=u.scriptHash.output.encode(m),r=!0,p=l=f.scriptType,q=c,s=p===u.types.P2WPKH}else if(e){if(o=t.sha256(e),k(a,o),f=i(e,void 0,b),!f.pubKeys)throw new Error('WitnessScript not supported "'+u.toASM(c)+'"');g=u.types.P2WSH,h=u.witnessScriptHash.output.encode(o),s=v=!0,p=n=f.scriptType,q=e}else if(a.prevOutType){if(a.prevOutType===z.P2SH||a.prevOutType===z.P2WSH)throw new Error("PrevOutScript is "+a.prevOutType+", requires redeemScript");if(g=a.prevOutType,h=a.prevOutScript,f=i(a.prevOutScript,a.prevOutType,b),!f.pubKeys)return;s=a.prevOutType===z.P2WPKH,p=g,q=h}else h=u.pubKeyHash.output.encode(t.hash160(b)),f=i(h,z.P2PKH,b),g=z.P2PKH,s=!1,p=g,q=h;if(void 0!==d||s){if(x(y.Satoshi,d),void 0!==a.value&&a.value!==d)throw new Error("Input didn't match witnessValue");a.value=d}p===z.P2WPKH&&(q=u.pubKeyHash.output.encode(u.witnessPubKeyHash.output.decode(q))),r&&(a.redeemScript=c,a.redeemScriptType=l),v&&(a.witnessScript=e,a.witnessScriptType=n),a.pubKeys=f.pubKeys,a.signatures=f.signatures,a.signScript=q,a.signType=p,a.prevOutScript=h,a.prevOutType=g,a.witness=s}function m(a,b,c,d){if(a===z.P2PKH){if(1===b.length&&Buffer.isBuffer(b[0])&&1===c.length)return u.pubKeyHash.input.encodeStack(b[0],c[0])}else if(a===z.P2PK){if(1===b.length&&Buffer.isBuffer(b[0]))return u.pubKey.input.encodeStack(b[0])}else{if(a!==z.MULTISIG)throw new Error("Not yet supported");if(b.length>0)return b=b.map(function(a){return a||w.OP_0}),d||(b=b.filter(function(a){return a!==w.OP_0})),u.multisig.input.encodeStack(b)}if(!d)throw new Error("Not enough signatures provided");return[]}function n(a,b){var c=a.prevOutType,f=[],g=[];d(c)&&(f=m(c,a.signatures,a.pubKeys,b));var h=!1;if(c===u.types.P2SH){if(!b&&!e(a.redeemScriptType))throw new Error("Impossible to sign this type");d(a.redeemScriptType)&&(f=m(a.redeemScriptType,a.signatures,a.pubKeys,b)),a.redeemScriptType&&(h=!0,c=a.redeemScriptType)}switch(c){case u.types.P2WPKH:g=m(u.types.P2PKH,a.signatures,a.pubKeys,b);break;case u.types.P2WSH:if(!b&&!d(a.witnessScriptType))throw new Error("Impossible to sign this type");d(a.witnessScriptType)&&(g=m(a.witnessScriptType,a.signatures,a.pubKeys,b),g.push(a.witnessScript),c=a.witnessScriptType)}return h&&f.push(a.redeemScript),{type:c,script:u.compile(f),witness:g}}function o(a,b){this.prevTxMap={},this.network=a||v.bitcoin,this.maximumFeeRate=b||1e3,this.inputs=[],this.bitcoinCash=!1,this.tx=new D}function p(a){return void 0!==a.prevOutScript&&void 0!==a.signScript&&void 0!==a.pubKeys&&void 0!==a.signatures&&a.signatures.length===a.pubKeys.length&&a.pubKeys.length>0&&void 0!==a.witness}function q(a){return a.readUInt8(a.length-1)}var Buffer=a("safe-buffer").Buffer,r=a("buffer-reverse"),s=a("./address"),t=a("./crypto"),u=a("./script"),v=a("./networks"),w=a("bitcoin-ops"),x=a("typeforce"),y=a("./types"),z=u.types,A=[u.types.P2PKH,u.types.P2PK,u.types.MULTISIG],B=A.concat([u.types.P2WPKH,u.types.P2WSH]),ECPair=a("./ecpair"),C=a("./ecsignature"),D=a("./transaction");o.prototype.enableBitcoinCash=function(a){"undefined"==typeof a&&(a=!0),this.bitcoinCash=a},o.prototype.setLockTime=function(a){if(x(y.UInt32,a),this.inputs.some(function(a){return!!a.signatures&&a.signatures.some(function(a){return a})}))throw new Error("No, this would invalidate signatures");this.tx.locktime=a},o.prototype.setVersion=function(a){x(y.UInt32,a),this.tx.version=a},o.fromTransaction=function(a,b,c){var d=new o(b);return d.enableBitcoinCash(Boolean(c)),d.setVersion(a.version),d.setLockTime(a.locktime),a.outs.forEach(function(a){d.addOutput(a.script,a.value)}),a.ins.forEach(function(a){d.__addInputUnsafe(a.hash,a.index,{sequence:a.sequence,script:a.script,value:a.value,witness:a.witness})}),d.inputs.forEach(function(b,d){h(b,a,d,c)}),d},o.prototype.addInput=function(a,b,c,d){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");var e;if("string"==typeof a)a=r(Buffer.from(a,"hex"));else if(a instanceof D){var f=a.outs[b];d=f.script,e=f.value,a=a.getHash()}return this.__addInputUnsafe(a,b,{sequence:c,prevOutScript:d,value:e})},o.prototype.__addInputUnsafe=function(a,b,c){if(D.isCoinbaseHash(a))throw new Error("coinbase inputs not supported");var d=a.toString("hex")+":"+b;if(void 0!==this.prevTxMap[d])throw new Error("Duplicate TxOut: "+d);var e={};if(void 0!==c.script&&(e=g(c.script,c.witness||[])),void 0!==c.value&&(e.value=c.value),!e.prevOutScript&&c.prevOutScript){var f;if(!e.pubKeys&&!e.signatures){var h=i(c.prevOutScript);h.pubKeys&&(e.pubKeys=h.pubKeys,e.signatures=h.signatures),f=h.scriptType}e.prevOutScript=c.prevOutScript,e.prevOutType=f||u.classifyOutput(c.prevOutScript)}var j=this.tx.addInput(a,b,c.sequence,c.scriptSig);return this.inputs[j]=e,this.prevTxMap[d]=j,j},o.prototype.addOutput=function(a,b){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof a&&(a=s.toOutputScript(a,this.network)),this.tx.addOutput(a,b)},o.prototype.build=function(){return this.__build(!1)},o.prototype.buildIncomplete=function(){return this.__build(!0)},o.prototype.__build=function(a){if(!a){if(!this.tx.ins.length)throw new Error("Transaction has no inputs");if(!this.tx.outs.length)throw new Error("Transaction has no outputs")}var b=this.tx.clone();if(this.inputs.forEach(function(c,e){var f=c.witnessScriptType||c.redeemScriptType||c.prevOutType;if(!f&&!a)throw new Error("Transaction is not complete");var g=n(c,a);if(!a&&!d(g.type)&&g.type!==u.types.P2WPKH)throw new Error(g.type+" not supported");b.setInputScript(e,g.script),b.setWitness(e,g.witness)}),!a&&this.__overMaximumFees(b.virtualSize()))throw new Error("Transaction has absurd fees");return b},o.prototype.sign=function(a,b,c,d,e,f){if(b.network!==this.network)throw new Error("Inconsistent network");if(!this.inputs[a])throw new Error("No input at index: "+a);d=d||D.SIGHASH_ALL;var g=this.inputs[a];if(void 0!==g.redeemScript&&c&&!g.redeemScript.equals(c))throw new Error("Inconsistent redeemScript");var h=b.getPublicKeyBuffer();if(!p(g)&&(l(g,h,c,e,f),!p(g)))throw Error(g.prevOutType+" not supported");var i;i=this.bitcoinCash?this.tx.hashForCashSignature(a,g.signScript,e,d):g.witness?this.tx.hashForWitnessV0(a,g.signScript,e,d):this.tx.hashForSignature(a,g.signScript,d);var j=g.pubKeys.some(function(a,c){if(!h.equals(a))return!1;if(g.signatures[c])throw new Error("Signature already exists");if(!b.compressed&&g.signType===z.P2WPKH)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");return g.signatures[c]=b.sign(i).toScriptSignature(d),!0});if(!j)throw new Error("Key pair cannot sign for this input")},o.prototype.__canModifyInputs=function(){return this.inputs.every(function(a){return void 0===a.signatures||a.signatures.every(function(a){if(!a)return!0;var b=q(a);return b&D.SIGHASH_ANYONECANPAY})})},o.prototype.__canModifyOutputs=function(){var a=this.tx.ins.length,b=this.tx.outs.length;return this.inputs.every(function(c){return void 0===c.signatures||c.signatures.every(function(c){if(!c)return!0;var d=q(c),e=31&d;return e===D.SIGHASH_NONE||(e===D.SIGHASH_SINGLE?a<=b:void 0)})})},o.prototype.__overMaximumFees=function(a){var b=this.inputs.reduce(function(a,b){return a+(b.value>>>0)},0),c=this.tx.outs.reduce(function(a,b){return a+b.value},0),d=b-c,e=d/a;return e>this.maximumFeeRate},b.exports=o},{"./address":34,"./crypto":37,"./ecpair":39,"./ecsignature":40,"./networks":43,"./script":44,"./transaction":68,"./types":70,"bitcoin-ops":32,"buffer-reverse":102,"safe-buffer":288,typeforce:312}],70:[function(a,b,c){function d(a){return g.UInt32(a)&&a<=h}function e(a){return g.String(a)&&a.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function f(a){return g.UInt53(a)&&a<=i}var g=a("typeforce"),h=Math.pow(2,31)-1;e.toJSON=function(){return"BIP32 derivation path"};var i=21e14,j=g.quacksLike("BigInteger"),k=g.quacksLike("Point"),l=g.compile({r:j,s:j}),m=g.compile({messagePrefix:g.oneOf(g.Buffer,g.String),bip32:{public:g.UInt32,private:g.UInt32},pubKeyHash:g.UInt8,scriptHash:g.UInt8,wif:g.UInt8}),n={BigInt:j,BIP32Path:e,Buffer256bit:g.BufferN(32),ECPoint:k,ECSignature:l,Hash160bit:g.BufferN(20),Hash256bit:g.BufferN(32),Network:m,Satoshi:f,UInt31:d};for(var o in g)n[o]=g[o];b.exports=n},{typeforce:312}],71:[function(a,b,c){(function(Buffer){function c(a){var b=l("sha256").update(a).digest();return l("sha256").update(b).digest()}function d(a){var b=l("sha256").update(a).digest();return l("ripemd160").update(b).digest()}function e(a,b,c){return c&&(b+=4),Buffer.concat([new Buffer([b+27]),a])}function f(a){if(65!==a.length)throw new Error("Invalid signature length");var b=a.readUInt8(0)-27;if(b>7)throw new Error("Invalid signature parameter");return{compressed:!!(4&b),recovery:3&b,signature:a.slice(1)}}function g(a,b){var d=n.encodingLength(a.length),e=new Buffer(b.length+d+a.length);return e.write(b,0),n.encode(a.length,e,b.length),e.write(a,b.length+d),c(e)}function h(a,b,c,d){var f=g(a,b),h=m.sign(f,c);return e(h.signature,h.recovery,d)}function i(a,b,c,e){Buffer.isBuffer(e)||(e=new Buffer(e,"base64"));var h=f(e),i=g(a,b),l=m.recover(i,h.signature,h.recovery,h.compressed),n=d(l),o=j.decode(c).slice(1);return k(n,o)}var j=a("bs58check"),k=a("buffer-equals"),l=a("create-hash"),m=a("secp256k1"),n=a("varuint-bitcoin");b.exports={magicHash:g,sign:h,verify:i}}).call(this,a("buffer").Buffer)},{bs58check:74,buffer:104,"buffer-equals":101,"create-hash":110,secp256k1:289,"varuint-bitcoin":321}],72:[function(a,b,c){b.exports=function(a){function b(b){if(0===b.length)return"";for(var c=[0],d=0;d<b.length;++d){for(var e=0,g=b[d];e<c.length;++e)g+=c[e]<<8,c[e]=g%f,g=g/f|0;for(;g>0;)c.push(g%f),g=g/f|0}for(var h="",i=0;0===b[i]&&i<b.length-1;++i)h+=a[0];for(var j=c.length-1;j>=0;--j)h+=a[c[j]];return h}function c(a){if(0===a.length)return[];for(var b=[0],c=0;c<a.length;c++){var d=e[a[c]];if(void 0===d)return;for(var h=0,i=d;h<b.length;++h)i+=b[h]*f,b[h]=255&i,i>>=8;for(;i>0;)b.push(255&i),i>>=8}for(var j=0;a[j]===g&&j<a.length-1;++j)b.push(0);return b.reverse()}function d(a){var b=c(a);if(b)return b;throw new Error("Non-base"+f+" character")}for(var e={},f=a.length,g=a.charAt(0),h=0;h<a.length;h++)e[a.charAt(h)]=h;return{encode:b,decodeUnsafe:c,decode:d}}},{}],73:[function(a,b,c){var d=a("base-x"),e="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";b.exports=d(e)},{"base-x":72}],74:[function(a,b,c){(function(Buffer){"use strict";function c(a){var b=i("sha256").update(a).digest();return i("sha256").update(b).digest()}function d(a){var b=c(a);return h.encode(Buffer.concat([a,b],a.length+4))}function e(a){var b=a.slice(0,-4),d=a.slice(-4),e=c(b);if(!(d[0]^e[0]|d[1]^e[1]|d[2]^e[2]|d[3]^e[3]))return b}function f(a){var b=h.decodeUnsafe(a);if(b){var c=new Buffer(b);return e(c)}}function g(a){var b=h.decode(a),c=new Buffer(b),d=e(c);if(!d)throw new Error("Invalid checksum");return d}var h=a("bs58"),i=a("create-hash");b.exports={encode:d,decode:g,decodeUnsafe:f,decodeRaw:f}}).call(this,a("buffer").Buffer)},{bs58:73,buffer:104,"create-hash":110}],75:[function(a,b,c){!function(b,c){"use strict";function d(a,b){if(!a)throw new Error(b||"Assertion failed")}function e(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}function f(a,b,c){return f.isBN(a)?a:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==a&&("le"!==b&&"be"!==b||(c=b,b=10),this._init(a||0,b||10,c||"be"))))}function g(a,b,c){for(var d=0,e=Math.min(a.length,c),f=b;f<e;f++){var g=a.charCodeAt(f)-48;d<<=4,d|=g>=49&&g<=54?g-49+10:g>=17&&g<=22?g-17+10:15&g}return d}function h(a,b,c,d){for(var e=0,f=Math.min(a.length,c),g=b;g<f;g++){var h=a.charCodeAt(g)-48;e*=d,e+=h>=49?h-49+10:h>=17?h-17+10:h}return e}function i(a){for(var b=new Array(a.bitLength()),c=0;c<b.length;c++){var d=c/26|0,e=c%26;b[c]=(a.words[d]&1<<e)>>>e}return b}function j(a,b,c){c.negative=b.negative^a.negative;var d=a.length+b.length|0;c.length=d,d=d-1|0;var e=0|a.words[0],f=0|b.words[0],g=e*f,h=67108863&g,i=g/67108864|0;c.words[0]=h;for(var j=1;j<d;j++){for(var k=i>>>26,l=67108863&i,m=Math.min(j,b.length-1),n=Math.max(0,j-a.length+1);n<=m;n++){var o=j-n|0;e=0|a.words[o],f=0|b.words[n],g=e*f+l,k+=g/67108864|0,l=67108863&g}c.words[j]=0|l,i=0|k}return 0!==i?c.words[j]=0|i:c.length--,c.strip()}function k(a,b,c){c.negative=b.negative^a.negative,c.length=a.length+b.length;for(var d=0,e=0,f=0;f<c.length-1;f++){var g=e;e=0;for(var h=67108863&d,i=Math.min(f,b.length-1),j=Math.max(0,f-a.length+1);j<=i;j++){var k=f-j,l=0|a.words[k],m=0|b.words[j],n=l*m,o=67108863&n;g=g+(n/67108864|0)|0,o=o+h|0,h=67108863&o,g=g+(o>>>26)|0,e+=g>>>26,g&=67108863}c.words[f]=h,d=g,g=e}return 0!==d?c.words[f]=d:c.length--,c.strip()}function l(a,b,c){var d=new m;return d.mulp(a,b,c)}function m(a,b){this.x=a,this.y=b}function n(a,b){this.name=a,this.p=new f(b,16),this.n=this.p.bitLength(),this.k=new f(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function o(){n.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){n.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function q(){n.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function r(){n.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function s(a){if("string"==typeof a){var b=f._prime(a);this.m=b.p,this.prime=b}else d(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}function t(a){s.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new f(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof b?b.exports=f:c.BN=f,f.BN=f,f.wordSize=26;var Buffer;try{Buffer=a("buffer").Buffer}catch(a){}f.isBN=function(a){return a instanceof f||null!==a&&"object"==typeof a&&a.constructor.wordSize===f.wordSize&&Array.isArray(a.words)},f.max=function(a,b){return a.cmp(b)>0?a:b},f.min=function(a,b){return a.cmp(b)<0?a:b},f.prototype._init=function(a,b,c){if("number"==typeof a)return this._initNumber(a,b,c);if("object"==typeof a)return this._initArray(a,b,c);"hex"===b&&(b=16),d(b===(0|b)&&b>=2&&b<=36),a=a.toString().replace(/\s+/g,"");var e=0;"-"===a[0]&&e++,16===b?this._parseHex(a,e):this._parseBase(a,b,e),"-"===a[0]&&(this.negative=1),this.strip(),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initNumber=function(a,b,c){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[67108863&a],this.length=1):a<4503599627370496?(this.words=[67108863&a,a/67108864&67108863],this.length=2):(d(a<9007199254740992),this.words=[67108863&a,a/67108864&67108863,1],this.length=3),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initArray=function(a,b,c){if(d("number"==typeof a.length),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;var f,g,h=0;if("be"===c)for(e=a.length-1,f=0;e>=0;e-=3)g=a[e]|a[e-1]<<8|a[e-2]<<16,this.words[f]|=g<<h&67108863,this.words[f+1]=g>>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);else if("le"===c)for(e=0,f=0;e<a.length;e+=3)g=a[e]|a[e+1]<<8|a[e+2]<<16,this.words[f]|=g<<h&67108863,this.words[f+1]=g>>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);return this.strip()},f.prototype._parseHex=function(a,b){this.length=Math.ceil((a.length-b)/6),this.words=new Array(this.length);for(var c=0;c<this.length;c++)this.words[c]=0;var d,e,f=0;for(c=a.length-6,d=0;c>=b;c-=6)e=g(a,c,c+6),this.words[d]|=e<<f&67108863,this.words[d+1]|=e>>>26-f&4194303,f+=24,f>=26&&(f-=26,d++);c+6!==b&&(e=g(a,b,c+6),this.words[d]|=e<<f&67108863,this.words[d+1]|=e>>>26-f&4194303),this.strip()},f.prototype._parseBase=function(a,b,c){this.words=[0],this.length=1;for(var d=0,e=1;e<=67108863;e*=b)d++;d--,e=e/b|0;for(var f=a.length-c,g=f%d,i=Math.min(f,f-g)+c,j=0,k=c;k<i;k+=d)j=h(a,k,k+d,b),this.imuln(e),this.words[0]+j<67108864?this.words[0]+=j:this._iaddn(j);if(0!==g){var l=1;for(j=h(a,k,a.length,b),k=0;k<g;k++)l*=b;this.imuln(l),this.words[0]+j<67108864?this.words[0]+=j:this._iaddn(j)}},f.prototype.copy=function(a){a.words=new Array(this.length);for(var b=0;b<this.length;b++)a.words[b]=this.words[b];a.length=this.length,a.negative=this.negative,a.red=this.red},f.prototype.clone=function(){var a=new f(null);return this.copy(a),a},f.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},f.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},f.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},f.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];f.prototype.toString=function(a,b){a=a||10,b=0|b||1;var c;if(16===a||"hex"===a){c="";for(var e=0,f=0,g=0;g<this.length;g++){var h=this.words[g],i=(16777215&(h<<e|f)).toString(16);f=h>>>24-e&16777215,c=0!==f||g!==this.length-1?u[6-i.length]+i+c:i+c,e+=2,e>=26&&(e-=26,g--)}for(0!==f&&(c=f.toString(16)+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(a===(0|a)&&a>=2&&a<=36){var j=v[a],k=w[a];c="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modn(k).toString(a);l=l.idivn(k),c=l.isZero()?m+c:u[j-m.length]+m+c}for(this.isZero()&&(c="0"+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}d(!1,"Base should be between 2 and 36")},f.prototype.toNumber=function(){var a=this.words[0];return 2===this.length?a+=67108864*this.words[1]:3===this.length&&1===this.words[2]?a+=4503599627370496+67108864*this.words[1]:this.length>2&&d(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-a:a},f.prototype.toJSON=function(){return this.toString(16)},f.prototype.toBuffer=function(a,b){return d("undefined"!=typeof Buffer),this.toArrayLike(Buffer,a,b)},f.prototype.toArray=function(a,b){return this.toArrayLike(Array,a,b)},f.prototype.toArrayLike=function(a,b,c){var e=this.byteLength(),f=c||Math.max(1,e);d(e<=f,"byte array longer than desired length"),d(f>0,"Requested array length <= 0"),this.strip();var g,h,i="le"===b,j=new a(f),k=this.clone();if(i){for(h=0;!k.isZero();h++)g=k.andln(255),
8
k.iushrn(8),j[h]=g;for(;h<f;h++)j[h]=0}else{for(h=0;h<f-e;h++)j[h]=0;for(h=0;!k.isZero();h++)g=k.andln(255),k.iushrn(8),j[f-h-1]=g}return j},Math.clz32?f.prototype._countBits=function(a){return 32-Math.clz32(a)}:f.prototype._countBits=function(a){var b=a,c=0;return b>=4096&&(c+=13,b>>>=13),b>=64&&(c+=7,b>>>=7),b>=8&&(c+=4,b>>>=4),b>=2&&(c+=2,b>>>=2),c+b},f.prototype._zeroBits=function(a){if(0===a)return 26;var b=a,c=0;return 0===(8191&b)&&(c+=13,b>>>=13),0===(127&b)&&(c+=7,b>>>=7),0===(15&b)&&(c+=4,b>>>=4),0===(3&b)&&(c+=2,b>>>=2),0===(1&b)&&c++,c},f.prototype.bitLength=function(){var a=this.words[this.length-1],b=this._countBits(a);return 26*(this.length-1)+b},f.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,b=0;b<this.length;b++){var c=this._zeroBits(this.words[b]);if(a+=c,26!==c)break}return a},f.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},f.prototype.toTwos=function(a){return 0!==this.negative?this.abs().inotn(a).iaddn(1):this.clone()},f.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},f.prototype.isNeg=function(){return 0!==this.negative},f.prototype.neg=function(){return this.clone().ineg()},f.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},f.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var b=0;b<a.length;b++)this.words[b]=this.words[b]|a.words[b];return this.strip()},f.prototype.ior=function(a){return d(0===(this.negative|a.negative)),this.iuor(a)},f.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},f.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},f.prototype.iuand=function(a){var b;b=this.length>a.length?a:this;for(var c=0;c<b.length;c++)this.words[c]=this.words[c]&a.words[c];return this.length=b.length,this.strip()},f.prototype.iand=function(a){return d(0===(this.negative|a.negative)),this.iuand(a)},f.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},f.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},f.prototype.iuxor=function(a){var b,c;this.length>a.length?(b=this,c=a):(b=a,c=this);for(var d=0;d<c.length;d++)this.words[d]=b.words[d]^c.words[d];if(this!==b)for(;d<b.length;d++)this.words[d]=b.words[d];return this.length=b.length,this.strip()},f.prototype.ixor=function(a){return d(0===(this.negative|a.negative)),this.iuxor(a)},f.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},f.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},f.prototype.inotn=function(a){d("number"==typeof a&&a>=0);var b=0|Math.ceil(a/26),c=a%26;this._expand(b),c>0&&b--;for(var e=0;e<b;e++)this.words[e]=67108863&~this.words[e];return c>0&&(this.words[e]=~this.words[e]&67108863>>26-c),this.strip()},f.prototype.notn=function(a){return this.clone().inotn(a)},f.prototype.setn=function(a,b){d("number"==typeof a&&a>=0);var c=a/26|0,e=a%26;return this._expand(c+1),b?this.words[c]=this.words[c]|1<<e:this.words[c]=this.words[c]&~(1<<e),this.strip()},f.prototype.iadd=function(a){var b;if(0!==this.negative&&0===a.negative)return this.negative=0,b=this.isub(a),this.negative^=1,this._normSign();if(0===this.negative&&0!==a.negative)return a.negative=0,b=this.isub(a),a.negative=1,b._normSign();var c,d;this.length>a.length?(c=this,d=a):(c=a,d=this);for(var e=0,f=0;f<d.length;f++)b=(0|c.words[f])+(0|d.words[f])+e,this.words[f]=67108863&b,e=b>>>26;for(;0!==e&&f<c.length;f++)b=(0|c.words[f])+e,this.words[f]=67108863&b,e=b>>>26;if(this.length=c.length,0!==e)this.words[this.length]=e,this.length++;else if(c!==this)for(;f<c.length;f++)this.words[f]=c.words[f];return this},f.prototype.add=function(a){var b;return 0!==a.negative&&0===this.negative?(a.negative=0,b=this.sub(a),a.negative^=1,b):0===a.negative&&0!==this.negative?(this.negative=0,b=a.sub(this),this.negative=1,b):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},f.prototype.isub=function(a){if(0!==a.negative){a.negative=0;var b=this.iadd(a);return a.negative=1,b._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var c=this.cmp(a);if(0===c)return this.negative=0,this.length=1,this.words[0]=0,this;var d,e;c>0?(d=this,e=a):(d=a,e=this);for(var f=0,g=0;g<e.length;g++)b=(0|d.words[g])-(0|e.words[g])+f,f=b>>26,this.words[g]=67108863&b;for(;0!==f&&g<d.length;g++)b=(0|d.words[g])+f,f=b>>26,this.words[g]=67108863&b;if(0===f&&g<d.length&&d!==this)for(;g<d.length;g++)this.words[g]=d.words[g];return this.length=Math.max(this.length,g),d!==this&&(this.negative=1),this.strip()},f.prototype.sub=function(a){return this.clone().isub(a)};var x=function(a,b,c){var d,e,f,g=a.words,h=b.words,i=c.words,j=0,k=0|g[0],l=8191&k,m=k>>>13,n=0|g[1],o=8191&n,p=n>>>13,q=0|g[2],r=8191&q,s=q>>>13,t=0|g[3],u=8191&t,v=t>>>13,w=0|g[4],x=8191&w,y=w>>>13,z=0|g[5],A=8191&z,B=z>>>13,C=0|g[6],D=8191&C,E=C>>>13,F=0|g[7],G=8191&F,H=F>>>13,I=0|g[8],J=8191&I,K=I>>>13,L=0|g[9],M=8191&L,N=L>>>13,O=0|h[0],P=8191&O,Q=O>>>13,R=0|h[1],S=8191&R,T=R>>>13,U=0|h[2],V=8191&U,W=U>>>13,X=0|h[3],Y=8191&X,Z=X>>>13,$=0|h[4],_=8191&$,aa=$>>>13,ba=0|h[5],ca=8191&ba,da=ba>>>13,ea=0|h[6],fa=8191&ea,ga=ea>>>13,ha=0|h[7],ia=8191&ha,ja=ha>>>13,ka=0|h[8],la=8191&ka,ma=ka>>>13,na=0|h[9],oa=8191&na,pa=na>>>13;c.negative=a.negative^b.negative,c.length=19,d=Math.imul(l,P),e=Math.imul(l,Q),e=e+Math.imul(m,P)|0,f=Math.imul(m,Q);var qa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(qa>>>26)|0,qa&=67108863,d=Math.imul(o,P),e=Math.imul(o,Q),e=e+Math.imul(p,P)|0,f=Math.imul(p,Q),d=d+Math.imul(l,S)|0,e=e+Math.imul(l,T)|0,e=e+Math.imul(m,S)|0,f=f+Math.imul(m,T)|0;var ra=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ra>>>26)|0,ra&=67108863,d=Math.imul(r,P),e=Math.imul(r,Q),e=e+Math.imul(s,P)|0,f=Math.imul(s,Q),d=d+Math.imul(o,S)|0,e=e+Math.imul(o,T)|0,e=e+Math.imul(p,S)|0,f=f+Math.imul(p,T)|0,d=d+Math.imul(l,V)|0,e=e+Math.imul(l,W)|0,e=e+Math.imul(m,V)|0,f=f+Math.imul(m,W)|0;var sa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(sa>>>26)|0,sa&=67108863,d=Math.imul(u,P),e=Math.imul(u,Q),e=e+Math.imul(v,P)|0,f=Math.imul(v,Q),d=d+Math.imul(r,S)|0,e=e+Math.imul(r,T)|0,e=e+Math.imul(s,S)|0,f=f+Math.imul(s,T)|0,d=d+Math.imul(o,V)|0,e=e+Math.imul(o,W)|0,e=e+Math.imul(p,V)|0,f=f+Math.imul(p,W)|0,d=d+Math.imul(l,Y)|0,e=e+Math.imul(l,Z)|0,e=e+Math.imul(m,Y)|0,f=f+Math.imul(m,Z)|0;var ta=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ta>>>26)|0,ta&=67108863,d=Math.imul(x,P),e=Math.imul(x,Q),e=e+Math.imul(y,P)|0,f=Math.imul(y,Q),d=d+Math.imul(u,S)|0,e=e+Math.imul(u,T)|0,e=e+Math.imul(v,S)|0,f=f+Math.imul(v,T)|0,d=d+Math.imul(r,V)|0,e=e+Math.imul(r,W)|0,e=e+Math.imul(s,V)|0,f=f+Math.imul(s,W)|0,d=d+Math.imul(o,Y)|0,e=e+Math.imul(o,Z)|0,e=e+Math.imul(p,Y)|0,f=f+Math.imul(p,Z)|0,d=d+Math.imul(l,_)|0,e=e+Math.imul(l,aa)|0,e=e+Math.imul(m,_)|0,f=f+Math.imul(m,aa)|0;var ua=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ua>>>26)|0,ua&=67108863,d=Math.imul(A,P),e=Math.imul(A,Q),e=e+Math.imul(B,P)|0,f=Math.imul(B,Q),d=d+Math.imul(x,S)|0,e=e+Math.imul(x,T)|0,e=e+Math.imul(y,S)|0,f=f+Math.imul(y,T)|0,d=d+Math.imul(u,V)|0,e=e+Math.imul(u,W)|0,e=e+Math.imul(v,V)|0,f=f+Math.imul(v,W)|0,d=d+Math.imul(r,Y)|0,e=e+Math.imul(r,Z)|0,e=e+Math.imul(s,Y)|0,f=f+Math.imul(s,Z)|0,d=d+Math.imul(o,_)|0,e=e+Math.imul(o,aa)|0,e=e+Math.imul(p,_)|0,f=f+Math.imul(p,aa)|0,d=d+Math.imul(l,ca)|0,e=e+Math.imul(l,da)|0,e=e+Math.imul(m,ca)|0,f=f+Math.imul(m,da)|0;var va=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(va>>>26)|0,va&=67108863,d=Math.imul(D,P),e=Math.imul(D,Q),e=e+Math.imul(E,P)|0,f=Math.imul(E,Q),d=d+Math.imul(A,S)|0,e=e+Math.imul(A,T)|0,e=e+Math.imul(B,S)|0,f=f+Math.imul(B,T)|0,d=d+Math.imul(x,V)|0,e=e+Math.imul(x,W)|0,e=e+Math.imul(y,V)|0,f=f+Math.imul(y,W)|0,d=d+Math.imul(u,Y)|0,e=e+Math.imul(u,Z)|0,e=e+Math.imul(v,Y)|0,f=f+Math.imul(v,Z)|0,d=d+Math.imul(r,_)|0,e=e+Math.imul(r,aa)|0,e=e+Math.imul(s,_)|0,f=f+Math.imul(s,aa)|0,d=d+Math.imul(o,ca)|0,e=e+Math.imul(o,da)|0,e=e+Math.imul(p,ca)|0,f=f+Math.imul(p,da)|0,d=d+Math.imul(l,fa)|0,e=e+Math.imul(l,ga)|0,e=e+Math.imul(m,fa)|0,f=f+Math.imul(m,ga)|0;var wa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(wa>>>26)|0,wa&=67108863,d=Math.imul(G,P),e=Math.imul(G,Q),e=e+Math.imul(H,P)|0,f=Math.imul(H,Q),d=d+Math.imul(D,S)|0,e=e+Math.imul(D,T)|0,e=e+Math.imul(E,S)|0,f=f+Math.imul(E,T)|0,d=d+Math.imul(A,V)|0,e=e+Math.imul(A,W)|0,e=e+Math.imul(B,V)|0,f=f+Math.imul(B,W)|0,d=d+Math.imul(x,Y)|0,e=e+Math.imul(x,Z)|0,e=e+Math.imul(y,Y)|0,f=f+Math.imul(y,Z)|0,d=d+Math.imul(u,_)|0,e=e+Math.imul(u,aa)|0,e=e+Math.imul(v,_)|0,f=f+Math.imul(v,aa)|0,d=d+Math.imul(r,ca)|0,e=e+Math.imul(r,da)|0,e=e+Math.imul(s,ca)|0,f=f+Math.imul(s,da)|0,d=d+Math.imul(o,fa)|0,e=e+Math.imul(o,ga)|0,e=e+Math.imul(p,fa)|0,f=f+Math.imul(p,ga)|0,d=d+Math.imul(l,ia)|0,e=e+Math.imul(l,ja)|0,e=e+Math.imul(m,ia)|0,f=f+Math.imul(m,ja)|0;var xa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(xa>>>26)|0,xa&=67108863,d=Math.imul(J,P),e=Math.imul(J,Q),e=e+Math.imul(K,P)|0,f=Math.imul(K,Q),d=d+Math.imul(G,S)|0,e=e+Math.imul(G,T)|0,e=e+Math.imul(H,S)|0,f=f+Math.imul(H,T)|0,d=d+Math.imul(D,V)|0,e=e+Math.imul(D,W)|0,e=e+Math.imul(E,V)|0,f=f+Math.imul(E,W)|0,d=d+Math.imul(A,Y)|0,e=e+Math.imul(A,Z)|0,e=e+Math.imul(B,Y)|0,f=f+Math.imul(B,Z)|0,d=d+Math.imul(x,_)|0,e=e+Math.imul(x,aa)|0,e=e+Math.imul(y,_)|0,f=f+Math.imul(y,aa)|0,d=d+Math.imul(u,ca)|0,e=e+Math.imul(u,da)|0,e=e+Math.imul(v,ca)|0,f=f+Math.imul(v,da)|0,d=d+Math.imul(r,fa)|0,e=e+Math.imul(r,ga)|0,e=e+Math.imul(s,fa)|0,f=f+Math.imul(s,ga)|0,d=d+Math.imul(o,ia)|0,e=e+Math.imul(o,ja)|0,e=e+Math.imul(p,ia)|0,f=f+Math.imul(p,ja)|0,d=d+Math.imul(l,la)|0,e=e+Math.imul(l,ma)|0,e=e+Math.imul(m,la)|0,f=f+Math.imul(m,ma)|0;var ya=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ya>>>26)|0,ya&=67108863,d=Math.imul(M,P),e=Math.imul(M,Q),e=e+Math.imul(N,P)|0,f=Math.imul(N,Q),d=d+Math.imul(J,S)|0,e=e+Math.imul(J,T)|0,e=e+Math.imul(K,S)|0,f=f+Math.imul(K,T)|0,d=d+Math.imul(G,V)|0,e=e+Math.imul(G,W)|0,e=e+Math.imul(H,V)|0,f=f+Math.imul(H,W)|0,d=d+Math.imul(D,Y)|0,e=e+Math.imul(D,Z)|0,e=e+Math.imul(E,Y)|0,f=f+Math.imul(E,Z)|0,d=d+Math.imul(A,_)|0,e=e+Math.imul(A,aa)|0,e=e+Math.imul(B,_)|0,f=f+Math.imul(B,aa)|0,d=d+Math.imul(x,ca)|0,e=e+Math.imul(x,da)|0,e=e+Math.imul(y,ca)|0,f=f+Math.imul(y,da)|0,d=d+Math.imul(u,fa)|0,e=e+Math.imul(u,ga)|0,e=e+Math.imul(v,fa)|0,f=f+Math.imul(v,ga)|0,d=d+Math.imul(r,ia)|0,e=e+Math.imul(r,ja)|0,e=e+Math.imul(s,ia)|0,f=f+Math.imul(s,ja)|0,d=d+Math.imul(o,la)|0,e=e+Math.imul(o,ma)|0,e=e+Math.imul(p,la)|0,f=f+Math.imul(p,ma)|0,d=d+Math.imul(l,oa)|0,e=e+Math.imul(l,pa)|0,e=e+Math.imul(m,oa)|0,f=f+Math.imul(m,pa)|0;var za=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(za>>>26)|0,za&=67108863,d=Math.imul(M,S),e=Math.imul(M,T),e=e+Math.imul(N,S)|0,f=Math.imul(N,T),d=d+Math.imul(J,V)|0,e=e+Math.imul(J,W)|0,e=e+Math.imul(K,V)|0,f=f+Math.imul(K,W)|0,d=d+Math.imul(G,Y)|0,e=e+Math.imul(G,Z)|0,e=e+Math.imul(H,Y)|0,f=f+Math.imul(H,Z)|0,d=d+Math.imul(D,_)|0,e=e+Math.imul(D,aa)|0,e=e+Math.imul(E,_)|0,f=f+Math.imul(E,aa)|0,d=d+Math.imul(A,ca)|0,e=e+Math.imul(A,da)|0,e=e+Math.imul(B,ca)|0,f=f+Math.imul(B,da)|0,d=d+Math.imul(x,fa)|0,e=e+Math.imul(x,ga)|0,e=e+Math.imul(y,fa)|0,f=f+Math.imul(y,ga)|0,d=d+Math.imul(u,ia)|0,e=e+Math.imul(u,ja)|0,e=e+Math.imul(v,ia)|0,f=f+Math.imul(v,ja)|0,d=d+Math.imul(r,la)|0,e=e+Math.imul(r,ma)|0,e=e+Math.imul(s,la)|0,f=f+Math.imul(s,ma)|0,d=d+Math.imul(o,oa)|0,e=e+Math.imul(o,pa)|0,e=e+Math.imul(p,oa)|0,f=f+Math.imul(p,pa)|0;var Aa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Aa>>>26)|0,Aa&=67108863,d=Math.imul(M,V),e=Math.imul(M,W),e=e+Math.imul(N,V)|0,f=Math.imul(N,W),d=d+Math.imul(J,Y)|0,e=e+Math.imul(J,Z)|0,e=e+Math.imul(K,Y)|0,f=f+Math.imul(K,Z)|0,d=d+Math.imul(G,_)|0,e=e+Math.imul(G,aa)|0,e=e+Math.imul(H,_)|0,f=f+Math.imul(H,aa)|0,d=d+Math.imul(D,ca)|0,e=e+Math.imul(D,da)|0,e=e+Math.imul(E,ca)|0,f=f+Math.imul(E,da)|0,d=d+Math.imul(A,fa)|0,e=e+Math.imul(A,ga)|0,e=e+Math.imul(B,fa)|0,f=f+Math.imul(B,ga)|0,d=d+Math.imul(x,ia)|0,e=e+Math.imul(x,ja)|0,e=e+Math.imul(y,ia)|0,f=f+Math.imul(y,ja)|0,d=d+Math.imul(u,la)|0,e=e+Math.imul(u,ma)|0,e=e+Math.imul(v,la)|0,f=f+Math.imul(v,ma)|0,d=d+Math.imul(r,oa)|0,e=e+Math.imul(r,pa)|0,e=e+Math.imul(s,oa)|0,f=f+Math.imul(s,pa)|0;var Ba=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ba>>>26)|0,Ba&=67108863,d=Math.imul(M,Y),e=Math.imul(M,Z),e=e+Math.imul(N,Y)|0,f=Math.imul(N,Z),d=d+Math.imul(J,_)|0,e=e+Math.imul(J,aa)|0,e=e+Math.imul(K,_)|0,f=f+Math.imul(K,aa)|0,d=d+Math.imul(G,ca)|0,e=e+Math.imul(G,da)|0,e=e+Math.imul(H,ca)|0,f=f+Math.imul(H,da)|0,d=d+Math.imul(D,fa)|0,e=e+Math.imul(D,ga)|0,e=e+Math.imul(E,fa)|0,f=f+Math.imul(E,ga)|0,d=d+Math.imul(A,ia)|0,e=e+Math.imul(A,ja)|0,e=e+Math.imul(B,ia)|0,f=f+Math.imul(B,ja)|0,d=d+Math.imul(x,la)|0,e=e+Math.imul(x,ma)|0,e=e+Math.imul(y,la)|0,f=f+Math.imul(y,ma)|0,d=d+Math.imul(u,oa)|0,e=e+Math.imul(u,pa)|0,e=e+Math.imul(v,oa)|0,f=f+Math.imul(v,pa)|0;var Ca=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,d=Math.imul(M,_),e=Math.imul(M,aa),e=e+Math.imul(N,_)|0,f=Math.imul(N,aa),d=d+Math.imul(J,ca)|0,e=e+Math.imul(J,da)|0,e=e+Math.imul(K,ca)|0,f=f+Math.imul(K,da)|0,d=d+Math.imul(G,fa)|0,e=e+Math.imul(G,ga)|0,e=e+Math.imul(H,fa)|0,f=f+Math.imul(H,ga)|0,d=d+Math.imul(D,ia)|0,e=e+Math.imul(D,ja)|0,e=e+Math.imul(E,ia)|0,f=f+Math.imul(E,ja)|0,d=d+Math.imul(A,la)|0,e=e+Math.imul(A,ma)|0,e=e+Math.imul(B,la)|0,f=f+Math.imul(B,ma)|0,d=d+Math.imul(x,oa)|0,e=e+Math.imul(x,pa)|0,e=e+Math.imul(y,oa)|0,f=f+Math.imul(y,pa)|0;var Da=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Da>>>26)|0,Da&=67108863,d=Math.imul(M,ca),e=Math.imul(M,da),e=e+Math.imul(N,ca)|0,f=Math.imul(N,da),d=d+Math.imul(J,fa)|0,e=e+Math.imul(J,ga)|0,e=e+Math.imul(K,fa)|0,f=f+Math.imul(K,ga)|0,d=d+Math.imul(G,ia)|0,e=e+Math.imul(G,ja)|0,e=e+Math.imul(H,ia)|0,f=f+Math.imul(H,ja)|0,d=d+Math.imul(D,la)|0,e=e+Math.imul(D,ma)|0,e=e+Math.imul(E,la)|0,f=f+Math.imul(E,ma)|0,d=d+Math.imul(A,oa)|0,e=e+Math.imul(A,pa)|0,e=e+Math.imul(B,oa)|0,f=f+Math.imul(B,pa)|0;var Ea=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ea>>>26)|0,Ea&=67108863,d=Math.imul(M,fa),e=Math.imul(M,ga),e=e+Math.imul(N,fa)|0,f=Math.imul(N,ga),d=d+Math.imul(J,ia)|0,e=e+Math.imul(J,ja)|0,e=e+Math.imul(K,ia)|0,f=f+Math.imul(K,ja)|0,d=d+Math.imul(G,la)|0,e=e+Math.imul(G,ma)|0,e=e+Math.imul(H,la)|0,f=f+Math.imul(H,ma)|0,d=d+Math.imul(D,oa)|0,e=e+Math.imul(D,pa)|0,e=e+Math.imul(E,oa)|0,f=f+Math.imul(E,pa)|0;var Fa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Fa>>>26)|0,Fa&=67108863,d=Math.imul(M,ia),e=Math.imul(M,ja),e=e+Math.imul(N,ia)|0,f=Math.imul(N,ja),d=d+Math.imul(J,la)|0,e=e+Math.imul(J,ma)|0,e=e+Math.imul(K,la)|0,f=f+Math.imul(K,ma)|0,d=d+Math.imul(G,oa)|0,e=e+Math.imul(G,pa)|0,e=e+Math.imul(H,oa)|0,f=f+Math.imul(H,pa)|0;var Ga=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ga>>>26)|0,Ga&=67108863,d=Math.imul(M,la),e=Math.imul(M,ma),e=e+Math.imul(N,la)|0,f=Math.imul(N,ma),d=d+Math.imul(J,oa)|0,e=e+Math.imul(J,pa)|0,e=e+Math.imul(K,oa)|0,f=f+Math.imul(K,pa)|0;var Ha=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ha>>>26)|0,Ha&=67108863,d=Math.imul(M,oa),e=Math.imul(M,pa),e=e+Math.imul(N,oa)|0,f=Math.imul(N,pa);var Ia=(j+d|0)+((8191&e)<<13)|0;return j=(f+(e>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,i[0]=qa,i[1]=ra,i[2]=sa,i[3]=ta,i[4]=ua,i[5]=va,i[6]=wa,i[7]=xa,i[8]=ya,i[9]=za,i[10]=Aa,i[11]=Ba,i[12]=Ca,i[13]=Da,i[14]=Ea,i[15]=Fa,i[16]=Ga,i[17]=Ha,i[18]=Ia,0!==j&&(i[19]=j,c.length++),c};Math.imul||(x=j),f.prototype.mulTo=function(a,b){var c,d=this.length+a.length;return c=10===this.length&&10===a.length?x(this,a,b):d<63?j(this,a,b):d<1024?k(this,a,b):l(this,a,b)},m.prototype.makeRBT=function(a){for(var b=new Array(a),c=f.prototype._countBits(a)-1,d=0;d<a;d++)b[d]=this.revBin(d,c,a);return b},m.prototype.revBin=function(a,b,c){if(0===a||a===c-1)return a;for(var d=0,e=0;e<b;e++)d|=(1&a)<<b-e-1,a>>=1;return d},m.prototype.permute=function(a,b,c,d,e,f){for(var g=0;g<f;g++)d[g]=b[a[g]],e[g]=c[a[g]]},m.prototype.transform=function(a,b,c,d,e,f){this.permute(f,a,b,c,d,e);for(var g=1;g<e;g<<=1)for(var h=g<<1,i=Math.cos(2*Math.PI/h),j=Math.sin(2*Math.PI/h),k=0;k<e;k+=h)for(var l=i,m=j,n=0;n<g;n++){var o=c[k+n],p=d[k+n],q=c[k+n+g],r=d[k+n+g],s=l*q-m*r;r=l*r+m*q,q=s,c[k+n]=o+q,d[k+n]=p+r,c[k+n+g]=o-q,d[k+n+g]=p-r,n!==h&&(s=i*l-j*m,m=i*m+j*l,l=s)}},m.prototype.guessLen13b=function(a,b){var c=1|Math.max(b,a),d=1&c,e=0;for(c=c/2|0;c;c>>>=1)e++;return 1<<e+1+d},m.prototype.conjugate=function(a,b,c){if(!(c<=1))for(var d=0;d<c/2;d++){var e=a[d];a[d]=a[c-d-1],a[c-d-1]=e,e=b[d],b[d]=-b[c-d-1],b[c-d-1]=-e}},m.prototype.normalize13b=function(a,b){for(var c=0,d=0;d<b/2;d++){var e=8192*Math.round(a[2*d+1]/b)+Math.round(a[2*d]/b)+c;a[d]=67108863&e,c=e<67108864?0:e/67108864|0}return a},m.prototype.convert13b=function(a,b,c,e){for(var f=0,g=0;g<b;g++)f+=0|a[g],c[2*g]=8191&f,f>>>=13,c[2*g+1]=8191&f,f>>>=13;for(g=2*b;g<e;++g)c[g]=0;d(0===f),d(0===(f&-8192))},m.prototype.stub=function(a){for(var b=new Array(a),c=0;c<a;c++)b[c]=0;return b},m.prototype.mulp=function(a,b,c){var d=2*this.guessLen13b(a.length,b.length),e=this.makeRBT(d),f=this.stub(d),g=new Array(d),h=new Array(d),i=new Array(d),j=new Array(d),k=new Array(d),l=new Array(d),m=c.words;m.length=d,this.convert13b(a.words,a.length,g,d),this.convert13b(b.words,b.length,j,d),this.transform(g,f,h,i,d,e),this.transform(j,f,k,l,d,e);for(var n=0;n<d;n++){var o=h[n]*k[n]-i[n]*l[n];i[n]=h[n]*l[n]+i[n]*k[n],h[n]=o}return this.conjugate(h,i,d),this.transform(h,i,m,f,d,e),this.conjugate(m,f,d),this.normalize13b(m,d),c.negative=a.negative^b.negative,c.length=a.length+b.length,c.strip()},f.prototype.mul=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),this.mulTo(a,b)},f.prototype.mulf=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),l(this,a,b)},f.prototype.imul=function(a){return this.clone().mulTo(a,this)},f.prototype.imuln=function(a){d("number"==typeof a),d(a<67108864);for(var b=0,c=0;c<this.length;c++){var e=(0|this.words[c])*a,f=(67108863&e)+(67108863&b);b>>=26,b+=e/67108864|0,b+=f>>>26,this.words[c]=67108863&f}return 0!==b&&(this.words[c]=b,this.length++),this},f.prototype.muln=function(a){return this.clone().imuln(a)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(a){var b=i(a);if(0===b.length)return new f(1);for(var c=this,d=0;d<b.length&&0===b[d];d++,c=c.sqr());if(++d<b.length)for(var e=c.sqr();d<b.length;d++,e=e.sqr())0!==b[d]&&(c=c.mul(e));return c},f.prototype.iushln=function(a){d("number"==typeof a&&a>=0);var b,c=a%26,e=(a-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){var g=0;for(b=0;b<this.length;b++){var h=this.words[b]&f,i=(0|this.words[b])-h<<c;this.words[b]=i|g,g=h>>>26-c}g&&(this.words[b]=g,this.length++)}if(0!==e){for(b=this.length-1;b>=0;b--)this.words[b+e]=this.words[b];for(b=0;b<e;b++)this.words[b]=0;this.length+=e}return this.strip()},f.prototype.ishln=function(a){return d(0===this.negative),this.iushln(a)},f.prototype.iushrn=function(a,b,c){d("number"==typeof a&&a>=0);var e;e=b?(b-b%26)/26:0;var f=a%26,g=Math.min((a-f)/26,this.length),h=67108863^67108863>>>f<<f,i=c;if(e-=g,e=Math.max(0,e),i){for(var j=0;j<g;j++)i.words[j]=this.words[j];i.length=g}if(0===g);else if(this.length>g)for(this.length-=g,j=0;j<this.length;j++)this.words[j]=this.words[j+g];else this.words[0]=0,this.length=1;var k=0;for(j=this.length-1;j>=0&&(0!==k||j>=e);j--){var l=0|this.words[j];this.words[j]=k<<26-f|l>>>f,k=l&h}return i&&0!==k&&(i.words[i.length++]=k),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(a,b,c){return d(0===this.negative),this.iushrn(a,b,c)},f.prototype.shln=function(a){return this.clone().ishln(a)},f.prototype.ushln=function(a){return this.clone().iushln(a)},f.prototype.shrn=function(a){return this.clone().ishrn(a)},f.prototype.ushrn=function(a){return this.clone().iushrn(a)},f.prototype.testn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26,e=1<<b;if(this.length<=c)return!1;var f=this.words[c];return!!(f&e)},f.prototype.imaskn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26;if(d(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)return this;if(0!==b&&c++,this.length=Math.min(c,this.length),0!==b){var e=67108863^67108863>>>b<<b;this.words[this.length-1]&=e}return this.strip()},f.prototype.maskn=function(a){return this.clone().imaskn(a)},f.prototype.iaddn=function(a){return d("number"==typeof a),d(a<67108864),a<0?this.isubn(-a):0!==this.negative?1===this.length&&(0|this.words[0])<a?(this.words[0]=a-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},f.prototype._iaddn=function(a){this.words[0]+=a;for(var b=0;b<this.length&&this.words[b]>=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},f.prototype.isubn=function(a){if(d("number"==typeof a),d(a<67108864),a<0)return this.iaddn(-a);if(0!==this.negative)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b<this.length&&this.words[b]<0;b++)this.words[b]+=67108864,this.words[b+1]-=1;return this.strip()},f.prototype.addn=function(a){return this.clone().iaddn(a)},f.prototype.subn=function(a){return this.clone().isubn(a)},f.prototype.iabs=function(){return this.negative=0,this},f.prototype.abs=function(){return this.clone().iabs()},f.prototype._ishlnsubmul=function(a,b,c){var e,f=a.length+c;this._expand(f);var g,h=0;for(e=0;e<a.length;e++){g=(0|this.words[e+c])+h;var i=(0|a.words[e])*b;g-=67108863&i,h=(g>>26)-(i/67108864|0),this.words[e+c]=67108863&g}for(;e<this.length-c;e++)g=(0|this.words[e+c])+h,h=g>>26,this.words[e+c]=67108863&g;if(0===h)return this.strip();for(d(h===-1),h=0,e=0;e<this.length;e++)g=-(0|this.words[e])+h,h=g>>26,this.words[e]=67108863&g;return this.negative=1,this.strip()},f.prototype._wordDiv=function(a,b){var c=this.length-a.length,d=this.clone(),e=a,g=0|e.words[e.length-1],h=this._countBits(g);c=26-h,0!==c&&(e=e.ushln(c),d.iushln(c),g=0|e.words[e.length-1]);var i,j=d.length-e.length;if("mod"!==b){i=new f(null),i.length=j+1,i.words=new Array(i.length);for(var k=0;k<i.length;k++)i.words[k]=0}var l=d.clone()._ishlnsubmul(e,1,j);0===l.negative&&(d=l,i&&(i.words[j]=1));for(var m=j-1;m>=0;m--){var n=67108864*(0|d.words[e.length+m])+(0|d.words[e.length+m-1]);for(n=Math.min(n/g|0,67108863),d._ishlnsubmul(e,n,m);0!==d.negative;)n--,d.negative=0,d._ishlnsubmul(e,1,m),d.isZero()||(d.negative^=1);i&&(i.words[m]=n)}return i&&i.strip(),d.strip(),"div"!==b&&0!==c&&d.iushrn(c),{div:i||null,mod:d}},f.prototype.divmod=function(a,b,c){if(d(!a.isZero()),this.isZero())return{div:new f(0),mod:new f(0)};var e,g,h;return 0!==this.negative&&0===a.negative?(h=this.neg().divmod(a,b),"mod"!==b&&(e=h.div.neg()),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.iadd(a)),{div:e,mod:g}):0===this.negative&&0!==a.negative?(h=this.divmod(a.neg(),b),"mod"!==b&&(e=h.div.neg()),{div:e,mod:h.mod}):0!==(this.negative&a.negative)?(h=this.neg().divmod(a.neg(),b),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.isub(a)),{div:h.div,mod:g}):a.length>this.length||this.cmp(a)<0?{div:new f(0),mod:this}:1===a.length?"div"===b?{div:this.divn(a.words[0]),mod:null}:"mod"===b?{div:null,mod:new f(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new f(this.modn(a.words[0]))}:this._wordDiv(a,b)},f.prototype.div=function(a){return this.divmod(a,"div",!1).div},f.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},f.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},f.prototype.divRound=function(a){var b=this.divmod(a);if(b.mod.isZero())return b.div;var c=0!==b.div.negative?b.mod.isub(a):b.mod,d=a.ushrn(1),e=a.andln(1),f=c.cmp(d);return f<0||1===e&&0===f?b.div:0!==b.div.negative?b.div.isubn(1):b.div.iaddn(1)},f.prototype.modn=function(a){d(a<=67108863);for(var b=(1<<26)%a,c=0,e=this.length-1;e>=0;e--)c=(b*c+(0|this.words[e]))%a;return c},f.prototype.idivn=function(a){d(a<=67108863);for(var b=0,c=this.length-1;c>=0;c--){var e=(0|this.words[c])+67108864*b;this.words[c]=e/a|0,b=e%a}return this.strip()},f.prototype.divn=function(a){return this.clone().idivn(a)},f.prototype.egcd=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=new f(0),i=new f(1),j=0;b.isEven()&&c.isEven();)b.iushrn(1),c.iushrn(1),++j;for(var k=c.clone(),l=b.clone();!b.isZero();){for(var m=0,n=1;0===(b.words[0]&n)&&m<26;++m,n<<=1);if(m>0)for(b.iushrn(m);m-- >0;)(e.isOdd()||g.isOdd())&&(e.iadd(k),g.isub(l)),e.iushrn(1),g.iushrn(1);for(var o=0,p=1;0===(c.words[0]&p)&&o<26;++o,p<<=1);if(o>0)for(c.iushrn(o);o-- >0;)(h.isOdd()||i.isOdd())&&(h.iadd(k),i.isub(l)),h.iushrn(1),i.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(h),g.isub(i)):(c.isub(b),h.isub(e),i.isub(g))}return{a:h,b:i,gcd:c.iushln(j)}},f.prototype._invmp=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=c.clone();b.cmpn(1)>0&&c.cmpn(1)>0;){for(var i=0,j=1;0===(b.words[0]&j)&&i<26;++i,j<<=1);if(i>0)for(b.iushrn(i);i-- >0;)e.isOdd()&&e.iadd(h),e.iushrn(1);for(var k=0,l=1;0===(c.words[0]&l)&&k<26;++k,l<<=1);if(k>0)for(c.iushrn(k);k-- >0;)g.isOdd()&&g.iadd(h),g.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(g)):(c.isub(b),g.isub(e))}var m;return m=0===b.cmpn(1)?e:g,m.cmpn(0)<0&&m.iadd(a),m},f.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var b=this.clone(),c=a.clone();b.negative=0,c.negative=0;for(var d=0;b.isEven()&&c.isEven();d++)b.iushrn(1),c.iushrn(1);for(;;){for(;b.isEven();)b.iushrn(1);for(;c.isEven();)c.iushrn(1);var e=b.cmp(c);if(e<0){var f=b;b=c,c=f}else if(0===e||0===c.cmpn(1))break;b.isub(c)}return c.iushln(d)},f.prototype.invm=function(a){return this.egcd(a).a.umod(a)},f.prototype.isEven=function(){return 0===(1&this.words[0])},f.prototype.isOdd=function(){return 1===(1&this.words[0])},f.prototype.andln=function(a){return this.words[0]&a},f.prototype.bincn=function(a){d("number"==typeof a);var b=a%26,c=(a-b)/26,e=1<<b;if(this.length<=c)return this._expand(c+1),this.words[c]|=e,this;for(var f=e,g=c;0!==f&&g<this.length;g++){var h=0|this.words[g];h+=f,f=h>>>26,h&=67108863,this.words[g]=h}return 0!==f&&(this.words[g]=f,this.length++),this},f.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},f.prototype.cmpn=function(a){var b=a<0;if(0!==this.negative&&!b)return-1;if(0===this.negative&&b)return 1;this.strip();var c;if(this.length>1)c=1;else{b&&(a=-a),d(a<=67108863,"Number is too big");var e=0|this.words[0];c=e===a?0:e<a?-1:1}return 0!==this.negative?0|-c:c},f.prototype.cmp=function(a){if(0!==this.negative&&0===a.negative)return-1;if(0===this.negative&&0!==a.negative)return 1;var b=this.ucmp(a);return 0!==this.negative?0|-b:b},f.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var b=0,c=this.length-1;c>=0;c--){var d=0|this.words[c],e=0|a.words[c];if(d!==e){d<e?b=-1:d>e&&(b=1);break}}return b},f.prototype.gtn=function(a){return 1===this.cmpn(a)},f.prototype.gt=function(a){return 1===this.cmp(a)},f.prototype.gten=function(a){return this.cmpn(a)>=0},f.prototype.gte=function(a){return this.cmp(a)>=0},f.prototype.ltn=function(a){return this.cmpn(a)===-1},f.prototype.lt=function(a){return this.cmp(a)===-1},f.prototype.lten=function(a){return this.cmpn(a)<=0},f.prototype.lte=function(a){return this.cmp(a)<=0},f.prototype.eqn=function(a){return 0===this.cmpn(a)},f.prototype.eq=function(a){return 0===this.cmp(a)},f.red=function(a){return new s(a)},f.prototype.toRed=function(a){return d(!this.red,"Already a number in reduction context"),d(0===this.negative,"red works only with positives"),a.convertTo(this)._forceRed(a)},f.prototype.fromRed=function(){return d(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},f.prototype._forceRed=function(a){return this.red=a,this},f.prototype.forceRed=function(a){return d(!this.red,"Already a number in reduction context"),this._forceRed(a)},f.prototype.redAdd=function(a){return d(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},f.prototype.redIAdd=function(a){return d(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},f.prototype.redSub=function(a){return d(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},f.prototype.redISub=function(a){return d(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},f.prototype.redShl=function(a){return d(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},f.prototype.redMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},f.prototype.redIMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},f.prototype.redSqr=function(){return d(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},f.prototype.redISqr=function(){return d(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},f.prototype.redSqrt=function(){return d(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},f.prototype.redInvm=function(){return d(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},f.prototype.redNeg=function(){return d(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},f.prototype.redPow=function(a){return d(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var y={k256:null,p224:null,p192:null,p25519:null};n.prototype._tmp=function(){var a=new f(null);return a.words=new Array(Math.ceil(this.n/13)),a},n.prototype.ireduce=function(a){var b,c=a;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),b=c.bitLength();while(b>this.n);var d=b<this.n?-1:c.ucmp(this.p);return 0===d?(c.words[0]=0,c.length=1):d>0?c.isub(this.p):c.strip(),c},n.prototype.split=function(a,b){a.iushrn(this.n,0,b)},n.prototype.imulK=function(a){return a.imul(this.k)},e(o,n),o.prototype.split=function(a,b){for(var c=4194303,d=Math.min(a.length,9),e=0;e<d;e++)b.words[e]=a.words[e];if(b.length=d,a.length<=9)return a.words[0]=0,void(a.length=1);var f=a.words[9];for(b.words[b.length++]=f&c,e=10;e<a.length;e++){var g=0|a.words[e];a.words[e-10]=(g&c)<<4|f>>>22,f=g}f>>>=22,a.words[e-10]=f,0===f&&a.length>10?a.length-=10:a.length-=9},o.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var b=0,c=0;c<a.length;c++){var d=0|a.words[c];b+=977*d,a.words[c]=67108863&b,b=64*d+(b/67108864|0)}return 0===a.words[a.length-1]&&(a.length--,0===a.words[a.length-1]&&a.length--),a},e(p,n),e(q,n),e(r,n),r.prototype.imulK=function(a){for(var b=0,c=0;c<a.length;c++){var d=19*(0|a.words[c])+b,e=67108863&d;d>>>=26,a.words[c]=e,b=d}return 0!==b&&(a.words[a.length++]=b),a},f._prime=function a(b){if(y[b])return y[b];var a;if("k256"===b)a=new o;else if("p224"===b)a=new p;else if("p192"===b)a=new q;else{if("p25519"!==b)throw new Error("Unknown prime "+b);a=new r}return y[b]=a,a},s.prototype._verify1=function(a){d(0===a.negative,"red works only with positives"),d(a.red,"red works only with red numbers")},s.prototype._verify2=function(a,b){d(0===(a.negative|b.negative),"red works only with positives"),d(a.red&&a.red===b.red,"red works only with red numbers")},s.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},s.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},s.prototype.add=function(a,b){this._verify2(a,b);var c=a.add(b);return c.cmp(this.m)>=0&&c.isub(this.m),
9
c._forceRed(this)},s.prototype.iadd=function(a,b){this._verify2(a,b);var c=a.iadd(b);return c.cmp(this.m)>=0&&c.isub(this.m),c},s.prototype.sub=function(a,b){this._verify2(a,b);var c=a.sub(b);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},s.prototype.isub=function(a,b){this._verify2(a,b);var c=a.isub(b);return c.cmpn(0)<0&&c.iadd(this.m),c},s.prototype.shl=function(a,b){return this._verify1(a),this.imod(a.ushln(b))},s.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},s.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},s.prototype.isqr=function(a){return this.imul(a,a.clone())},s.prototype.sqr=function(a){return this.mul(a,a)},s.prototype.sqrt=function(a){if(a.isZero())return a.clone();var b=this.m.andln(3);if(d(b%2===1),3===b){var c=this.m.add(new f(1)).iushrn(2);return this.pow(a,c)}for(var e=this.m.subn(1),g=0;!e.isZero()&&0===e.andln(1);)g++,e.iushrn(1);d(!e.isZero());var h=new f(1).toRed(this),i=h.redNeg(),j=this.m.subn(1).iushrn(1),k=this.m.bitLength();for(k=new f(2*k*k).toRed(this);0!==this.pow(k,j).cmp(i);)k.redIAdd(i);for(var l=this.pow(k,e),m=this.pow(a,e.addn(1).iushrn(1)),n=this.pow(a,e),o=g;0!==n.cmp(h);){for(var p=n,q=0;0!==p.cmp(h);q++)p=p.redSqr();d(q<o);var r=this.pow(l,new f(1).iushln(o-q-1));m=m.redMul(r),l=r.redSqr(),n=n.redMul(l),o=q}return m},s.prototype.invm=function(a){var b=a._invmp(this.m);return 0!==b.negative?(b.negative=0,this.imod(b).redNeg()):this.imod(b)},s.prototype.pow=function(a,b){if(b.isZero())return new f(1).toRed(this);if(0===b.cmpn(1))return a.clone();var c=4,d=new Array(1<<c);d[0]=new f(1).toRed(this),d[1]=a;for(var e=2;e<d.length;e++)d[e]=this.mul(d[e-1],a);var g=d[0],h=0,i=0,j=b.bitLength()%26;for(0===j&&(j=26),e=b.length-1;e>=0;e--){for(var k=b.words[e],l=j-1;l>=0;l--){var m=k>>l&1;g!==d[0]&&(g=this.sqr(g)),0!==m||0!==h?(h<<=1,h|=m,i++,(i===c||0===e&&0===l)&&(g=this.mul(g,d[h]),i=0,h=0)):i=0}j=26}return g},s.prototype.convertTo=function(a){var b=a.umod(this.m);return b===a?b.clone():b},s.prototype.convertFrom=function(a){var b=a.clone();return b.red=null,b},f.mont=function(a){return new t(a)},e(t,s),t.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},t.prototype.convertFrom=function(a){var b=this.imod(a.mul(this.rinv));return b.red=null,b},t.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var c=a.imul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),f=e;return e.cmp(this.m)>=0?f=e.isub(this.m):e.cmpn(0)<0&&(f=e.iadd(this.m)),f._forceRed(this)},t.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new f(0)._forceRed(this);var c=a.mul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),g=e;return e.cmp(this.m)>=0?g=e.isub(this.m):e.cmpn(0)<0&&(g=e.iadd(this.m)),g._forceRed(this)},t.prototype.invm=function(a){var b=this.imod(a._invmp(this.m).mul(this.r2));return b._forceRed(this)}}("undefined"==typeof b||b,this)},{buffer:77}],76:[function(a,b,c){function d(a){this.rand=a}var e;if(b.exports=function(a){return e||(e=new d(null)),e.generate(a)},b.exports.Rand=d,d.prototype.generate=function(a){return this._rand(a)},d.prototype._rand=function(a){if(this.rand.getBytes)return this.rand.getBytes(a);for(var b=new Uint8Array(a),c=0;c<b.length;c++)b[c]=this.rand.getByte();return b},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?d.prototype._rand=function(a){var b=new Uint8Array(a);return self.crypto.getRandomValues(b),b}:self.msCrypto&&self.msCrypto.getRandomValues?d.prototype._rand=function(a){var b=new Uint8Array(a);return self.msCrypto.getRandomValues(b),b}:"object"==typeof window&&(d.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var f=a("crypto");if("function"!=typeof f.randomBytes)throw new Error("Not supported");d.prototype._rand=function(a){return f.randomBytes(a)}}catch(a){}},{crypto:77}],77:[function(a,b,c){},{}],78:[function(a,b,c){function d(a){Buffer.isBuffer(a)||(a=Buffer.from(a));for(var b=a.length/4|0,c=new Array(b),d=0;d<b;d++)c[d]=a.readUInt32BE(4*d);return c}function e(a){for(var b=0;b<a.length;a++)a[b]=0}function f(a,b,c,d,e){for(var f,g,h,i,j=c[0],k=c[1],l=c[2],m=c[3],n=a[0]^b[0],o=a[1]^b[1],p=a[2]^b[2],q=a[3]^b[3],r=4,s=1;s<e;s++)f=j[n>>>24]^k[o>>>16&255]^l[p>>>8&255]^m[255&q]^b[r++],g=j[o>>>24]^k[p>>>16&255]^l[q>>>8&255]^m[255&n]^b[r++],h=j[p>>>24]^k[q>>>16&255]^l[n>>>8&255]^m[255&o]^b[r++],i=j[q>>>24]^k[n>>>16&255]^l[o>>>8&255]^m[255&p]^b[r++],n=f,o=g,p=h,q=i;return f=(d[n>>>24]<<24|d[o>>>16&255]<<16|d[p>>>8&255]<<8|d[255&q])^b[r++],g=(d[o>>>24]<<24|d[p>>>16&255]<<16|d[q>>>8&255]<<8|d[255&n])^b[r++],h=(d[p>>>24]<<24|d[q>>>16&255]<<16|d[n>>>8&255]<<8|d[255&o])^b[r++],i=(d[q>>>24]<<24|d[n>>>16&255]<<16|d[o>>>8&255]<<8|d[255&p])^b[r++],f>>>=0,g>>>=0,h>>>=0,i>>>=0,[f,g,h,i]}function g(a){this._key=d(a),this._reset()}var Buffer=a("safe-buffer").Buffer,h=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var a=new Array(256),b=0;b<256;b++)b<128?a[b]=b<<1:a[b]=b<<1^283;for(var c=[],d=[],e=[[],[],[],[]],f=[[],[],[],[]],g=0,h=0,i=0;i<256;++i){var j=h^h<<1^h<<2^h<<3^h<<4;j=j>>>8^255&j^99,c[g]=j,d[j]=g;var k=a[g],l=a[k],m=a[l],n=257*a[j]^16843008*j;e[0][g]=n<<24|n>>>8,e[1][g]=n<<16|n>>>16,e[2][g]=n<<8|n>>>24,e[3][g]=n,n=16843009*m^65537*l^257*k^16843008*g,f[0][j]=n<<24|n>>>8,f[1][j]=n<<16|n>>>16,f[2][j]=n<<8|n>>>24,f[3][j]=n,0===g?g=h=1:(g=k^a[a[a[m^k]]],h^=a[a[h]])}return{SBOX:c,INV_SBOX:d,SUB_MIX:e,INV_SUB_MIX:f}}();g.blockSize=16,g.keySize=32,g.prototype.blockSize=g.blockSize,g.prototype.keySize=g.keySize,g.prototype._reset=function(){for(var a=this._key,b=a.length,c=b+6,d=4*(c+1),e=[],f=0;f<b;f++)e[f]=a[f];for(f=b;f<d;f++){var g=e[f-1];f%b===0?(g=g<<8|g>>>24,g=i.SBOX[g>>>24]<<24|i.SBOX[g>>>16&255]<<16|i.SBOX[g>>>8&255]<<8|i.SBOX[255&g],g^=h[f/b|0]<<24):b>6&&f%b===4&&(g=i.SBOX[g>>>24]<<24|i.SBOX[g>>>16&255]<<16|i.SBOX[g>>>8&255]<<8|i.SBOX[255&g]),e[f]=e[f-b]^g}for(var j=[],k=0;k<d;k++){var l=d-k,m=e[l-(k%4?0:4)];k<4||l<=4?j[k]=m:j[k]=i.INV_SUB_MIX[0][i.SBOX[m>>>24]]^i.INV_SUB_MIX[1][i.SBOX[m>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[m>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&m]]}this._nRounds=c,this._keySchedule=e,this._invKeySchedule=j},g.prototype.encryptBlockRaw=function(a){return a=d(a),f(a,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},g.prototype.encryptBlock=function(a){var b=this.encryptBlockRaw(a),c=Buffer.allocUnsafe(16);return c.writeUInt32BE(b[0],0),c.writeUInt32BE(b[1],4),c.writeUInt32BE(b[2],8),c.writeUInt32BE(b[3],12),c},g.prototype.decryptBlock=function(a){a=d(a);var b=a[1];a[1]=a[3],a[3]=b;var c=f(a,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),e=Buffer.allocUnsafe(16);return e.writeUInt32BE(c[0],0),e.writeUInt32BE(c[3],4),e.writeUInt32BE(c[2],8),e.writeUInt32BE(c[1],12),e},g.prototype.scrub=function(){e(this._keySchedule),e(this._invKeySchedule),e(this._key)},b.exports.AES=g},{"safe-buffer":288}],79:[function(a,b,c){function d(a,b){var c=0;a.length!==b.length&&c++;for(var d=Math.min(a.length,b.length),e=0;e<d;++e)c+=a[e]^b[e];return c}function e(a,b,c){if(12===b.length)return a._finID=Buffer.concat([b,Buffer.from([0,0,0,1])]),Buffer.concat([b,Buffer.from([0,0,0,2])]);var d=new j(c),e=b.length,f=e%16;d.update(b),f&&(f=16-f,d.update(Buffer.alloc(f,0))),d.update(Buffer.alloc(8,0));var g=8*e,h=Buffer.alloc(8);h.writeUIntBE(g,0,8),d.update(h),a._finID=d.state;var i=Buffer.from(a._finID);return l(i),i}function f(a,b,c,d){h.call(this);var f=Buffer.alloc(4,0);this._cipher=new g.AES(b);var i=this._cipher.encryptBlock(f);this._ghash=new j(i),c=e(this,c,i),this._prev=Buffer.from(c),this._cache=Buffer.allocUnsafe(0),this._secCache=Buffer.allocUnsafe(0),this._decrypt=d,this._alen=0,this._len=0,this._mode=a,this._authTag=null,this._called=!1}var g=a("./aes"),Buffer=a("safe-buffer").Buffer,h=a("cipher-base"),i=a("inherits"),j=a("./ghash"),k=a("buffer-xor"),l=a("./incr32");i(f,h),f.prototype._update=function(a){if(!this._called&&this._alen){var b=16-this._alen%16;b<16&&(b=Buffer.alloc(b,0),this._ghash.update(b))}this._called=!0;var c=this._mode.encrypt(this,a);return this._decrypt?this._ghash.update(a):this._ghash.update(c),this._len+=a.length,c},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var a=k(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&d(a,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=a,this._cipher.scrub()},f.prototype.getAuthTag=function(){if(this._decrypt||!Buffer.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},f.prototype.setAuthTag=function(a){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=a},f.prototype.setAAD=function(a){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(a),this._alen+=a.length},b.exports=f},{"./aes":78,"./ghash":83,"./incr32":84,"buffer-xor":103,"cipher-base":106,inherits:226,"safe-buffer":288}],80:[function(a,b,c){function d(){return Object.keys(g)}var e=a("./encrypter"),f=a("./decrypter"),g=a("./modes/list.json");c.createCipher=c.Cipher=e.createCipher,c.createCipheriv=c.Cipheriv=e.createCipheriv,c.createDecipher=c.Decipher=f.createDecipher,c.createDecipheriv=c.Decipheriv=f.createDecipheriv,c.listCiphers=c.getCiphers=d},{"./decrypter":81,"./encrypter":82,"./modes/list.json":92}],81:[function(a,b,c){function d(a,b,c){l.call(this),this._cache=new e,this._last=void 0,this._cipher=new m.AES(b),this._prev=Buffer.from(c),this._mode=a,this._autopadding=!0}function e(){this.cache=Buffer.allocUnsafe(0)}function f(a){for(var b=a[15],c=-1;++c<b;)if(a[c+(16-b)]!==b)throw new Error("unable to decrypt data");if(16!==b)return a.slice(0,16-b)}function g(a,b,c){var e=j[a.toLowerCase()];if(!e)throw new TypeError("invalid suite type");if("string"==typeof c&&(c=Buffer.from(c)),"GCM"!==e.mode&&c.length!==e.iv)throw new TypeError("invalid iv length "+c.length);if("string"==typeof b&&(b=Buffer.from(b)),b.length!==e.key/8)throw new TypeError("invalid key length "+b.length);return"stream"===e.type?new k(e.module,b,c,!0):"auth"===e.type?new i(e.module,b,c,!0):new d(e.module,b,c)}function h(a,b){var c=j[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=n(b,!1,c.key,c.iv);return g(a,d.key,d.iv)}var i=a("./authCipher"),Buffer=a("safe-buffer").Buffer,j=a("./modes"),k=a("./streamCipher"),l=a("cipher-base"),m=a("./aes"),n=a("evp_bytestokey"),o=a("inherits");o(d,l),d.prototype._update=function(a){this._cache.add(a);for(var b,c,d=[];b=this._cache.get(this._autopadding);)c=this._mode.decrypt(this,b),d.push(c);return Buffer.concat(d)},d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return f(this._mode.decrypt(this,a));if(a)throw new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=Buffer.concat([this.cache,a])},e.prototype.get=function(a){var b;if(a){if(this.cache.length>16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b}else if(this.cache.length>=16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b;return null},e.prototype.flush=function(){if(this.cache.length)return this.cache},c.createDecipher=h,c.createDecipheriv=g},{"./aes":78,"./authCipher":79,"./modes":91,"./streamCipher":94,"cipher-base":106,evp_bytestokey:209,inherits:226,"safe-buffer":288}],82:[function(a,b,c){function d(a,b,c){k.call(this),this._cache=new e,this._cipher=new l.AES(b),this._prev=Buffer.from(c),this._mode=a,this._autopadding=!0}function e(){this.cache=Buffer.allocUnsafe(0)}function f(a,b,c){var e=h[a.toLowerCase()];if(!e)throw new TypeError("invalid suite type");if("string"==typeof b&&(b=Buffer.from(b)),b.length!==e.key/8)throw new TypeError("invalid key length "+b.length);if("string"==typeof c&&(c=Buffer.from(c)),"GCM"!==e.mode&&c.length!==e.iv)throw new TypeError("invalid iv length "+c.length);return"stream"===e.type?new j(e.module,b,c):"auth"===e.type?new i(e.module,b,c):new d(e.module,b,c)}function g(a,b){var c=h[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=m(b,!1,c.key,c.iv);return f(a,d.key,d.iv)}var h=a("./modes"),i=a("./authCipher"),Buffer=a("safe-buffer").Buffer,j=a("./streamCipher"),k=a("cipher-base"),l=a("./aes"),m=a("evp_bytestokey"),n=a("inherits");n(d,k),d.prototype._update=function(a){this._cache.add(a);for(var b,c,d=[];b=this._cache.get();)c=this._mode.encrypt(this,b),d.push(c);return Buffer.concat(d)};var o=Buffer.alloc(16,16);d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return a=this._mode.encrypt(this,a),this._cipher.scrub(),a;if(!a.equals(o))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=Buffer.concat([this.cache,a])},e.prototype.get=function(){if(this.cache.length>15){var a=this.cache.slice(0,16);return this.cache=this.cache.slice(16),a}return null},e.prototype.flush=function(){for(var a=16-this.cache.length,b=Buffer.allocUnsafe(a),c=-1;++c<a;)b.writeUInt8(a,c);return Buffer.concat([this.cache,b])},c.createCipheriv=f,c.createCipher=g},{"./aes":78,"./authCipher":79,"./modes":91,"./streamCipher":94,"cipher-base":106,evp_bytestokey:209,inherits:226,"safe-buffer":288}],83:[function(a,b,c){function d(a){return[a.readUInt32BE(0),a.readUInt32BE(4),a.readUInt32BE(8),a.readUInt32BE(12)]}function e(a){var b=Buffer.allocUnsafe(16);return b.writeUInt32BE(a[0]>>>0,0),b.writeUInt32BE(a[1]>>>0,4),b.writeUInt32BE(a[2]>>>0,8),b.writeUInt32BE(a[3]>>>0,12),b}function f(a){this.h=a,this.state=Buffer.alloc(16,0),this.cache=Buffer.allocUnsafe(0)}var Buffer=a("safe-buffer").Buffer,g=Buffer.alloc(16,0);f.prototype.ghash=function(a){for(var b=-1;++b<a.length;)this.state[b]^=a[b];this._multiply()},f.prototype._multiply=function(){for(var a,b,c,f=d(this.h),g=[0,0,0,0],h=-1;++h<128;){for(b=0!==(this.state[~~(h/8)]&1<<7-h%8),b&&(g[0]^=f[0],g[1]^=f[1],g[2]^=f[2],g[3]^=f[3]),c=0!==(1&f[3]),a=3;a>0;a--)f[a]=f[a]>>>1|(1&f[a-1])<<31;f[0]=f[0]>>>1,c&&(f[0]=f[0]^225<<24)}this.state=e(g)},f.prototype.update=function(a){this.cache=Buffer.concat([this.cache,a]);for(var b;this.cache.length>=16;)b=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(b)},f.prototype.final=function(a,b){return this.cache.length&&this.ghash(Buffer.concat([this.cache,g],16)),this.ghash(e([0,a,0,b])),this.state},b.exports=f},{"safe-buffer":288}],84:[function(a,b,c){function d(a){for(var b,c=a.length;c--;){if(b=a.readUInt8(c),255!==b){b++,a.writeUInt8(b,c);break}a.writeUInt8(0,c)}}b.exports=d},{}],85:[function(a,b,c){var d=a("buffer-xor");c.encrypt=function(a,b){var c=d(b,a._prev);return a._prev=a._cipher.encryptBlock(c),a._prev},c.decrypt=function(a,b){var c=a._prev;a._prev=b;var e=a._cipher.decryptBlock(b);return d(e,c)}},{"buffer-xor":103}],86:[function(a,b,c){function d(a,b,c){var d=b.length,f=e(b,a._cache);return a._cache=a._cache.slice(d),a._prev=Buffer.concat([a._prev,c?b:f]),f}var Buffer=a("safe-buffer").Buffer,e=a("buffer-xor");c.encrypt=function(a,b,c){for(var e,f=Buffer.allocUnsafe(0);b.length;){if(0===a._cache.length&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=Buffer.allocUnsafe(0)),!(a._cache.length<=b.length)){f=Buffer.concat([f,d(a,b,c)]);break}e=a._cache.length,f=Buffer.concat([f,d(a,b.slice(0,e),c)]),b=b.slice(e)}return f}},{"buffer-xor":103,"safe-buffer":288}],87:[function(a,b,c){function d(a,b,c){for(var d,f,g,h=-1,i=8,j=0;++h<i;)d=a._cipher.encryptBlock(a._prev),f=b&1<<7-h?128:0,g=d[0]^f,j+=(128&g)>>h%8,a._prev=e(a._prev,c?f:g);return j}function e(a,b){var c=a.length,d=-1,e=Buffer.allocUnsafe(a.length);for(a=Buffer.concat([a,Buffer.from([b])]);++d<c;)e[d]=a[d]<<1|a[d+1]>>7;return e}var Buffer=a("safe-buffer").Buffer;c.encrypt=function(a,b,c){for(var e=b.length,f=Buffer.allocUnsafe(e),g=-1;++g<e;)f[g]=d(a,b[g],c);return f}},{"safe-buffer":288}],88:[function(a,b,c){function d(a,b,c){var d=a._cipher.encryptBlock(a._prev),e=d[0]^b;return a._prev=Buffer.concat([a._prev.slice(1),Buffer.from([c?b:e])]),e}var Buffer=a("safe-buffer").Buffer;c.encrypt=function(a,b,c){for(var e=b.length,f=Buffer.allocUnsafe(e),g=-1;++g<e;)f[g]=d(a,b[g],c);return f}},{"safe-buffer":288}],89:[function(a,b,c){function d(a){var b=a._cipher.encryptBlockRaw(a._prev);return f(a._prev),b}var e=a("buffer-xor"),Buffer=a("safe-buffer").Buffer,f=a("../incr32"),g=16;c.encrypt=function(a,b){var c=Math.ceil(b.length/g),f=a._cache.length;a._cache=Buffer.concat([a._cache,Buffer.allocUnsafe(c*g)]);for(var h=0;h<c;h++){var i=d(a),j=f+h*g;a._cache.writeUInt32BE(i[0],j+0),a._cache.writeUInt32BE(i[1],j+4),a._cache.writeUInt32BE(i[2],j+8),a._cache.writeUInt32BE(i[3],j+12)}var k=a._cache.slice(0,b.length);return a._cache=a._cache.slice(b.length),e(b,k)}},{"../incr32":84,"buffer-xor":103,"safe-buffer":288}],90:[function(a,b,c){c.encrypt=function(a,b){return a._cipher.encryptBlock(b)},c.decrypt=function(a,b){return a._cipher.decryptBlock(b)}},{}],91:[function(a,b,c){var d={ECB:a("./ecb"),CBC:a("./cbc"),CFB:a("./cfb"),CFB8:a("./cfb8"),CFB1:a("./cfb1"),OFB:a("./ofb"),CTR:a("./ctr"),GCM:a("./ctr")},e=a("./list.json");for(var f in e)e[f].module=d[e[f].mode];b.exports=e},{"./cbc":85,"./cfb":86,"./cfb1":87,"./cfb8":88,"./ctr":89,"./ecb":90,"./list.json":92,"./ofb":93}],92:[function(a,b,c){b.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},{}],93:[function(a,b,c){(function(Buffer){function b(a){return a._prev=a._cipher.encryptBlock(a._prev),a._prev}var d=a("buffer-xor");c.encrypt=function(a,c){for(;a._cache.length<c.length;)a._cache=Buffer.concat([a._cache,b(a)]);var e=a._cache.slice(0,c.length);return a._cache=a._cache.slice(c.length),d(c,e)}}).call(this,a("buffer").Buffer)},{buffer:104,"buffer-xor":103}],94:[function(a,b,c){function d(a,b,c,d){f.call(this),this._cipher=new e.AES(b),this._prev=Buffer.from(c),this._cache=Buffer.allocUnsafe(0),this._secCache=Buffer.allocUnsafe(0),this._decrypt=d,this._mode=a}var e=a("./aes"),Buffer=a("safe-buffer").Buffer,f=a("cipher-base"),g=a("inherits");g(d,f),d.prototype._update=function(a){return this._mode.encrypt(this,a,this._decrypt)},d.prototype._final=function(){this._cipher.scrub()},b.exports=d},{"./aes":78,"cipher-base":106,inherits:226,"safe-buffer":288}],95:[function(a,b,c){function d(a,b){var c,d;if(a=a.toLowerCase(),m[a])c=m[a].key,d=m[a].iv;else{if(!l[a])throw new TypeError("invalid suite type");c=8*l[a].key,d=l[a].iv}var e=i(b,!1,c,d);return f(a,e.key,e.iv)}function e(a,b){var c,d;if(a=a.toLowerCase(),m[a])c=m[a].key,d=m[a].iv;else{if(!l[a])throw new TypeError("invalid suite type");c=8*l[a].key,d=l[a].iv}var e=i(b,!1,c,d);return g(a,e.key,e.iv)}function f(a,b,c){if(a=a.toLowerCase(),m[a])return j.createCipheriv(a,b,c);if(l[a])return new k({key:b,iv:c,mode:a});throw new TypeError("invalid suite type")}function g(a,b,c){if(a=a.toLowerCase(),m[a])return j.createDecipheriv(a,b,c);if(l[a])return new k({key:b,iv:c,mode:a,decrypt:!0});throw new TypeError("invalid suite type")}function h(){return Object.keys(l).concat(j.getCiphers())}var i=a("evp_bytestokey"),j=a("browserify-aes/browser"),k=a("browserify-des"),l=a("browserify-des/modes"),m=a("browserify-aes/modes");c.createCipher=c.Cipher=d,c.createCipheriv=c.Cipheriv=f,c.createDecipher=c.Decipher=e,c.createDecipheriv=c.Decipheriv=g,c.listCiphers=c.getCiphers=h},{"browserify-aes/browser":80,"browserify-aes/modes":91,"browserify-des":96,"browserify-des/modes":97,evp_bytestokey:209}],96:[function(a,b,c){(function(Buffer){function c(a){d.call(this);var b,c=a.mode.toLowerCase(),e=g[c];b=a.decrypt?"decrypt":"encrypt";var f=a.key;"des-ede"!==c&&"des-ede-cbc"!==c||(f=Buffer.concat([f,f.slice(0,8)]));var h=a.iv;this._des=e.create({key:f,iv:h,type:b})}var d=a("cipher-base"),e=a("des.js"),f=a("inherits"),g={"des-ede3-cbc":e.CBC.instantiate(e.EDE),"des-ede3":e.EDE,"des-ede-cbc":e.CBC.instantiate(e.EDE),"des-ede":e.EDE,"des-cbc":e.CBC.instantiate(e.DES),"des-ecb":e.DES};g.des=g["des-cbc"],g.des3=g["des-ede3-cbc"],b.exports=c,f(c,d),c.prototype._update=function(a){return new Buffer(this._des.update(a))},c.prototype._final=function(){return new Buffer(this._des.final())}}).call(this,a("buffer").Buffer)},{buffer:104,"cipher-base":106,"des.js":177,inherits:226}],97:[function(a,b,c){c["des-ecb"]={key:8,iv:0},c["des-cbc"]=c.des={key:8,iv:8},c["des-ede3-cbc"]=c.des3={key:24,iv:8},c["des-ede3"]={key:24,iv:0},c["des-ede-cbc"]={key:16,iv:8},c["des-ede"]={key:16,iv:0}},{}],98:[function(a,b,c){arguments[4][73][0].apply(c,arguments)},{"base-x":21,dup:73}],99:[function(a,b,c){(function(Buffer){"use strict";var c=a("bs58");b.exports=function(a){function b(b){var d=a(b);return c.encode(Buffer.concat([b,d],b.length+4))}function d(b){var c=b.slice(0,-4),d=b.slice(-4),e=a(c);if(!(d[0]^e[0]|d[1]^e[1]|d[2]^e[2]|d[3]^e[3]))return c}function e(a){var b=c.decodeUnsafe(a);if(b)return d(b)}function f(b){var e=c.decode(b),f=d(e,a);if(!f)throw new Error("Invalid checksum");return f}return{encode:b,decode:f,decodeUnsafe:e}}}).call(this,a("buffer").Buffer)},{bs58:98,buffer:104}],100:[function(a,b,c){"use strict";function d(a){var b=e("sha256").update(a).digest();return e("sha256").update(b).digest()}var e=a("create-hash"),f=a("./base");b.exports=f(d)},{"./base":99,"create-hash":110}],101:[function(a,b,c){(function(Buffer){"use strict";b.exports=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return!0;if("function"==typeof a.equals)return a.equals(b);if(a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}}).call(this,{isBuffer:a("../is-buffer/index.js")})},{"../is-buffer/index.js":227}],102:[function(a,b,c){(function(Buffer){b.exports=function(a){for(var b=new Buffer(a.length),c=0,d=a.length-1;c<=d;++c,--d)b[c]=a[d],b[d]=a[c];return b}}).call(this,a("buffer").Buffer)},{buffer:104}],103:[function(a,b,c){(function(Buffer){b.exports=function(a,b){for(var c=Math.min(a.length,b.length),d=new Buffer(c),e=0;e<c;++e)d[e]=a[e]^b[e];return d}}).call(this,a("buffer").Buffer)},{buffer:104}],104:[function(a,b,c){"use strict";function d(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===a.foo()}catch(a){return!1}}function e(a){if(a>Y)throw new RangeError("Invalid typed array length");var b=new Uint8Array(a);return b.__proto__=Buffer.prototype,b}function Buffer(a,b,c){if("number"==typeof a){if("string"==typeof b)throw new Error("If encoding is specified then the first argument must be a string");return i(a)}return f(a,b,c)}function f(a,b,c){if("number"==typeof a)throw new TypeError('"value" argument must not be a number');return T(a)?l(a,b,c):"string"==typeof a?j(a,b):m(a)}function g(a){if("number"!=typeof a)throw new TypeError('"size" argument must be a number');if(a<0)throw new RangeError('"size" argument must not be negative')}function h(a,b,c){return g(a),a<=0?e(a):void 0!==b?"string"==typeof c?e(a).fill(b,c):e(a).fill(b):e(a)}function i(a){return g(a),e(a<0?0:0|n(a))}function j(a,b){if("string"==typeof b&&""!==b||(b="utf8"),!Buffer.isEncoding(b))throw new TypeError('"encoding" must be a valid string encoding');var c=0|p(a,b),d=e(c),f=d.write(a,b);return f!==c&&(d=d.slice(0,f)),d}function k(a){for(var b=a.length<0?0:0|n(a.length),c=e(b),d=0;d<b;d+=1)c[d]=255&a[d];return c}function l(a,b,c){if(b<0||a.byteLength<b)throw new RangeError("'offset' is out of bounds");if(a.byteLength<b+(c||0))throw new RangeError("'length' is out of bounds");var d;return d=void 0===b&&void 0===c?new Uint8Array(a):void 0===c?new Uint8Array(a,b):new Uint8Array(a,b,c),d.__proto__=Buffer.prototype,d}function m(a){if(Buffer.isBuffer(a)){var b=0|n(a.length),c=e(b);return 0===c.length?c:(a.copy(c,0,0,b),c)}if(a){if(U(a)||"length"in a)return"number"!=typeof a.length||V(a.length)?e(0):k(a);if("Buffer"===a.type&&Array.isArray(a.data))return k(a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function n(a){if(a>=Y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y.toString(16)+" bytes");return 0|a}function o(a){return+a!=a&&(a=0),Buffer.alloc(+a)}function p(a,b){if(Buffer.isBuffer(a))return a.length;if(U(a)||T(a))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return O(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return R(a).length;default:if(d)return O(a).length;b=(""+b).toLowerCase(),d=!0}}function q(a,b,c){var d=!1;if((void 0===b||b<0)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,b>>>=0,c<=b)return"";for(a||(a="utf8");;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"latin1":case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function r(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function s(a,b,c,d,e){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,V(c)&&(c=e?0:a.length-1),c<0&&(c=a.length+c),c>=a.length){if(e)return-1;c=a.length-1}else if(c<0){if(!e)return-1;c=0}if("string"==typeof b&&(b=Buffer.from(b,d)),Buffer.isBuffer(b))return 0===b.length?-1:t(a,b,c,d,e);if("number"==typeof b)return b&=255,"function"==typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):t(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer")}function t(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,i=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;g=2,h/=2,i/=2,c/=2}var j;if(e){var k=-1;for(j=c;j<h;j++)if(f(a,j)===f(b,k===-1?0:j-k)){if(k===-1&&(k=j),j-k+1===i)return k*g}else k!==-1&&(j-=j-k),k=-1}else for(c+i>h&&(c=h-i),j=c;j>=0;j--){for(var l=!0,m=0;m<i;m++)if(f(a,j+m)!==f(b,m)){l=!1;break}if(l)return j}return-1}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new TypeError("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g<d;++g){var h=parseInt(b.substr(2*g,2),16);if(V(h))return g;a[c+g]=h}return g}function v(a,b,c,d){return S(O(b,a.length-c),a,c,d)}function w(a,b,c,d){return S(P(b),a,c,d)}function x(a,b,c,d){return w(a,b,c,d)}function y(a,b,c,d){return S(R(b),a,c,d)}function z(a,b,c,d){return S(Q(b,a.length-c),a,c,d)}function A(a,b,c){return 0===b&&c===a.length?W.fromByteArray(a):W.fromByteArray(a.slice(b,c))}function B(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;e<c;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(l<55296||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&l<1114112&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(b<=Z)return String.fromCharCode.apply(String,a);for(var c="",d=0;d<b;)c+=String.fromCharCode.apply(String,a.slice(d,d+=Z));return c}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;++e)d+=String.fromCharCode(127&a[e]);return d}function E(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;++e)d+=String.fromCharCode(a[e]);return d}function F(a,b,c){var d=a.length;(!b||b<0)&&(b=0),(!c||c<0||c>d)&&(c=d);for(var e="",f=b;f<c;++f)e+=N(a[f]);return e}function G(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function H(a,b,c){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,f){if(!Buffer.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||b<f)throw new RangeError('"value" argument is out of bounds');if(c+d>a.length)throw new RangeError("Index out of range")}function J(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function K(a,b,c,d,e){return b=+b,c>>>=0,e||J(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(a,b,c,d,23,4),c+4}function L(a,b,c,d,e){return b=+b,c>>>=0,e||J(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(a,b,c,d,52,8),c+8}function M(a){if(a=a.trim().replace($,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function N(a){return a<16?"0"+a.toString(16):a.toString(16)}function O(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g<d;++g){if(c=a.charCodeAt(g),c>55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function P(a){for(var b=[],c=0;c<a.length;++c)b.push(255&a.charCodeAt(c));return b}function Q(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);++g)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);
10
return f}function R(a){return W.toByteArray(M(a))}function S(a,b,c,d){for(var e=0;e<d&&!(e+c>=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function T(a){return a instanceof ArrayBuffer||null!=a&&null!=a.constructor&&"ArrayBuffer"===a.constructor.name&&"number"==typeof a.byteLength}function U(a){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(a)}function V(a){return a!==a}var W=a("base64-js"),X=a("ieee754");c.Buffer=Buffer,c.SlowBuffer=o,c.INSPECT_MAX_BYTES=50;var Y=2147483647;c.kMaxLength=Y,Buffer.TYPED_ARRAY_SUPPORT=d(),Buffer.TYPED_ARRAY_SUPPORT||"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(a,b,c){return f(a,b,c)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(a,b,c){return h(a,b,c)},Buffer.allocUnsafe=function(a){return i(a)},Buffer.allocUnsafeSlow=function(a){return i(a)},Buffer.isBuffer=function(a){return null!=a&&a._isBuffer===!0},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 c=a.length,d=b.length,e=0,f=Math.min(c,d);e<f;++e)if(a[e]!==b[e]){c=a[e],d=b[e];break}return c<d?-1:d<c?1:0},Buffer.isEncoding=function(a){switch(String(a).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(a,b){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(0===a.length)return Buffer.alloc(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;++c)b+=a[c].length;var d=Buffer.allocUnsafe(b),e=0;for(c=0;c<a.length;++c){var f=a[c];if(!Buffer.isBuffer(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(d,e),e+=f.length}return d},Buffer.byteLength=p,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var b=0;b<a;b+=2)r(this,b,b+1);return this},Buffer.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var b=0;b<a;b+=4)r(this,b,b+3),r(this,b+1,b+2);return this},Buffer.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var b=0;b<a;b+=8)r(this,b,b+7),r(this,b+1,b+6),r(this,b+2,b+5),r(this,b+3,b+4);return this},Buffer.prototype.toString=function(){var a=this.length;return 0===a?"":0===arguments.length?B(this,0,a):q.apply(this,arguments)},Buffer.prototype.equals=function(a){if(!Buffer.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a||0===Buffer.compare(this,a)},Buffer.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},Buffer.prototype.compare=function(a,b,c,d,e){if(!Buffer.isBuffer(a))throw new TypeError("Argument must be a Buffer");if(void 0===b&&(b=0),void 0===c&&(c=a?a.length:0),void 0===d&&(d=0),void 0===e&&(e=this.length),b<0||c>a.length||d<0||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return-1;if(b>=c)return 1;if(b>>>=0,c>>>=0,d>>>=0,e>>>=0,this===a)return 0;for(var f=e-d,g=c-b,h=Math.min(f,g),i=this.slice(d,e),j=a.slice(b,c),k=0;k<h;++k)if(i[k]!==j[k]){f=i[k],g=j[k];break}return f<g?-1:g<f?1:0},Buffer.prototype.includes=function(a,b,c){return this.indexOf(a,b,c)!==-1},Buffer.prototype.indexOf=function(a,b,c){return s(this,a,b,c,!0)},Buffer.prototype.lastIndexOf=function(a,b,c){return s(this,a,b,c,!1)},Buffer.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else{if(!isFinite(b))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");b>>>=0,isFinite(c)?(c>>>=0,void 0===d&&(d="utf8")):(d=c,c=void 0)}var e=this.length-b;if((void 0===c||c>e)&&(c=e),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(var f=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"latin1":case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(f)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),f=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;Buffer.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c,a<0&&(a=0)):a>c&&(a=c),b<0?(b+=c,b<0&&(b=0)):b>c&&(b=c),b<a&&(b=a);var d=this.subarray(a,b);return d.__proto__=Buffer.prototype,d},Buffer.prototype.readUIntLE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},Buffer.prototype.readUIntBE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},Buffer.prototype.readUInt8=function(a,b){return a>>>=0,b||H(a,1,this.length),this[a]},Buffer.prototype.readUInt16LE=function(a,b){return a>>>=0,b||H(a,2,this.length),this[a]|this[a+1]<<8},Buffer.prototype.readUInt16BE=function(a,b){return a>>>=0,b||H(a,2,this.length),this[a]<<8|this[a+1]},Buffer.prototype.readUInt32LE=function(a,b){return a>>>=0,b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},Buffer.prototype.readUInt32BE=function(a,b){return a>>>=0,b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},Buffer.prototype.readIntLE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},Buffer.prototype.readIntBE=function(a,b,c){a>>>=0,b>>>=0,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},Buffer.prototype.readInt8=function(a,b){return a>>>=0,b||H(a,1,this.length),128&this[a]?(255-this[a]+1)*-1:this[a]},Buffer.prototype.readInt16LE=function(a,b){a>>>=0,b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},Buffer.prototype.readInt16BE=function(a,b){a>>>=0,b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},Buffer.prototype.readInt32LE=function(a,b){return a>>>=0,b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},Buffer.prototype.readInt32BE=function(a,b){return a>>>=0,b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},Buffer.prototype.readFloatLE=function(a,b){return a>>>=0,b||H(a,4,this.length),X.read(this,a,!0,23,4)},Buffer.prototype.readFloatBE=function(a,b){return a>>>=0,b||H(a,4,this.length),X.read(this,a,!1,23,4)},Buffer.prototype.readDoubleLE=function(a,b){return a>>>=0,b||H(a,8,this.length),X.read(this,a,!0,52,8)},Buffer.prototype.readDoubleBE=function(a,b){return a>>>=0,b||H(a,8,this.length),X.read(this,a,!1,52,8)},Buffer.prototype.writeUIntLE=function(a,b,c,d){if(a=+a,b>>>=0,c>>>=0,!d){var e=Math.pow(2,8*c)-1;I(this,a,b,c,e,0)}var f=1,g=0;for(this[b]=255&a;++g<c&&(f*=256);)this[b+g]=a/f&255;return b+c},Buffer.prototype.writeUIntBE=function(a,b,c,d){if(a=+a,b>>>=0,c>>>=0,!d){var e=Math.pow(2,8*c)-1;I(this,a,b,c,e,0)}var f=c-1,g=1;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=a/g&255;return b+c},Buffer.prototype.writeUInt8=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,1,255,0),this[b]=255&a,b+1},Buffer.prototype.writeUInt16LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,65535,0),this[b]=255&a,this[b+1]=a>>>8,b+2},Buffer.prototype.writeUInt16BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,65535,0),this[b]=a>>>8,this[b+1]=255&a,b+2},Buffer.prototype.writeUInt32LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,4294967295,0),this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a,b+4},Buffer.prototype.writeUInt32BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,4294967295,0),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},Buffer.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=0;for(this[b]=255&a;++f<c&&(g*=256);)a<0&&0===h&&0!==this[b+f-1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},Buffer.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0;for(this[b+f]=255&a;--f>=0&&(g*=256);)a<0&&0===h&&0!==this[b+f+1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},Buffer.prototype.writeInt8=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,1,127,-128),a<0&&(a=255+a+1),this[b]=255&a,b+1},Buffer.prototype.writeInt16LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,32767,-32768),this[b]=255&a,this[b+1]=a>>>8,b+2},Buffer.prototype.writeInt16BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,2,32767,-32768),this[b]=a>>>8,this[b+1]=255&a,b+2},Buffer.prototype.writeInt32LE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,2147483647,-2147483648),this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24,b+4},Buffer.prototype.writeInt32BE=function(a,b,c){return a=+a,b>>>=0,c||I(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},Buffer.prototype.writeFloatLE=function(a,b,c){return K(this,a,b,!0,c)},Buffer.prototype.writeFloatBE=function(a,b,c){return K(this,a,b,!1,c)},Buffer.prototype.writeDoubleLE=function(a,b,c){return L(this,a,b,!0,c)},Buffer.prototype.writeDoubleBE=function(a,b,c){return L(this,a,b,!1,c)},Buffer.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d<c&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var e,f=d-c;if(this===a&&c<b&&b<d)for(e=f-1;e>=0;--e)a[e+b]=this[e+c];else if(f<1e3)for(e=0;e<f;++e)a[e+b]=this[e+c];else Uint8Array.prototype.set.call(a,this.subarray(c,c+f),b);return f},Buffer.prototype.fill=function(a,b,c,d){if("string"==typeof a){if("string"==typeof b?(d=b,b=0,c=this.length):"string"==typeof c&&(d=c,c=this.length),1===a.length){var e=a.charCodeAt(0);e<256&&(a=e)}if(void 0!==d&&"string"!=typeof d)throw new TypeError("encoding must be a string");if("string"==typeof d&&!Buffer.isEncoding(d))throw new TypeError("Unknown encoding: "+d)}else"number"==typeof a&&(a&=255);if(b<0||this.length<b||this.length<c)throw new RangeError("Out of range index");if(c<=b)return this;b>>>=0,c=void 0===c?this.length:c>>>0,a||(a=0);var f;if("number"==typeof a)for(f=b;f<c;++f)this[f]=a;else{var g=Buffer.isBuffer(a)?a:new Buffer(a,d),h=g.length;for(f=0;f<c-b;++f)this[f+b]=g[f%h]}return this};var $=/[^+\/0-9A-Za-z-_]/g},{"base64-js":105,ieee754:224}],105:[function(a,b,c){"use strict";function d(a){var b=a.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h=a.length;f=d(a),g=new l(3*h/4-f),c=f>0?h-4:h;var i=0;for(b=0;b<c;b+=4)e=k[a.charCodeAt(b)]<<18|k[a.charCodeAt(b+1)]<<12|k[a.charCodeAt(b+2)]<<6|k[a.charCodeAt(b+3)],g[i++]=e>>16&255,g[i++]=e>>8&255,g[i++]=255&e;return 2===f?(e=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,g[i++]=255&e):1===f&&(e=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,g[i++]=e>>8&255,g[i++]=255&e),g}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;f<c;f+=3)d=(a[f]<<16)+(a[f+1]<<8)+a[f+2],e.push(g(d));return e.join("")}function i(a){for(var b,c=a.length,d=c%3,e="",f=[],g=16383,i=0,k=c-d;i<k;i+=g)f.push(h(a,i,i+g>k?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;n<o;++n)j[n]=m[n],k[m.charCodeAt(n)]=n;k["-".charCodeAt(0)]=62,k["_".charCodeAt(0)]=63},{}],106:[function(a,b,c){function d(a){e.call(this),this.hashMode="string"==typeof a,this.hashMode?this[a]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}var Buffer=a("safe-buffer").Buffer,e=a("stream").Transform,f=a("string_decoder").StringDecoder,g=a("inherits");g(d,e),d.prototype.update=function(a,b,c){"string"==typeof a&&(a=Buffer.from(a,b));var d=this._update(a);return this.hashMode?this:(c&&(d=this._toString(d,c)),d)},d.prototype.setAutoPadding=function(){},d.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},d.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},d.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},d.prototype._transform=function(a,b,c){var d;try{this.hashMode?this._update(a):this.push(this._update(a))}catch(a){d=a}finally{c(d)}},d.prototype._flush=function(a){var b;try{this.push(this.__final())}catch(a){b=a}a(b)},d.prototype._finalOrDigest=function(a){var b=this.__final()||Buffer.alloc(0);return a&&(b=this._toString(b,a,!0)),b},d.prototype._toString=function(a,b,c){if(this._decoder||(this._decoder=new f(b),this._encoding=b),this._encoding!==b)throw new Error("can't switch encodings");var d=this._decoder.write(a);return c&&(d+=this._decoder.end()),d},b.exports=d},{inherits:226,"safe-buffer":288,stream:304,string_decoder:305}],107:[function(a,b,c){function d(a){if(a)return e(a)}function e(a){for(var b in d.prototype)a[b]=d.prototype[b];return a}b.exports=d,d.prototype.on=d.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks[a]=this._callbacks[a]||[]).push(b),this},d.prototype.once=function(a,b){function c(){d.off(a,c),b.apply(this,arguments)}var d=this;return this._callbacks=this._callbacks||{},c.fn=b,this.on(a,c),this},d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks[a];if(!c)return this;if(1==arguments.length)return delete this._callbacks[a],this;for(var d,e=0;e<c.length;e++)if(d=c[e],d===b||d.fn===b){c.splice(e,1);break}return this},d.prototype.emit=function(a){this._callbacks=this._callbacks||{};var b=[].slice.call(arguments,1),c=this._callbacks[a];if(c){c=c.slice(0);for(var d=0,e=c.length;d<e;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks[a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],108:[function(a,b,c){(function(Buffer){function a(a){return Array.isArray?Array.isArray(a):"[object Array]"===p(a)}function b(a){return"boolean"==typeof a}function d(a){return null===a}function e(a){return null==a}function f(a){return"number"==typeof a}function g(a){return"string"==typeof a}function h(a){return"symbol"==typeof a}function i(a){return void 0===a}function j(a){return"[object RegExp]"===p(a)}function k(a){return"object"==typeof a&&null!==a}function l(a){return"[object Date]"===p(a)}function m(a){return"[object Error]"===p(a)||a instanceof Error}function n(a){return"function"==typeof a}function o(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function p(a){return Object.prototype.toString.call(a)}c.isArray=a,c.isBoolean=b,c.isNull=d,c.isNullOrUndefined=e,c.isNumber=f,c.isString=g,c.isSymbol=h,c.isUndefined=i,c.isRegExp=j,c.isObject=k,c.isDate=l,c.isError=m,c.isFunction=n,c.isPrimitive=o,c.isBuffer=Buffer.isBuffer}).call(this,{isBuffer:a("../../is-buffer/index.js")})},{"../../is-buffer/index.js":227}],109:[function(a,b,c){(function(Buffer){function c(a){this.curveType=g[a],this.curveType||(this.curveType={name:a}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function d(a,b,c){Array.isArray(a)||(a=a.toArray());var d=new Buffer(a);if(c&&d.length<c){var e=new Buffer(c-d.length);e.fill(0),d=Buffer.concat([e,d])}return b?d.toString(b):d}var e=a("elliptic"),f=a("bn.js");b.exports=function(a){return new c(a)};var g={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};g.p224=g.secp224r1,g.p256=g.secp256r1=g.prime256v1,g.p192=g.secp192r1=g.prime192v1,g.p384=g.secp384r1,g.p521=g.secp521r1,c.prototype.generateKeys=function(a,b){return this.keys=this.curve.genKeyPair(),this.getPublicKey(a,b)},c.prototype.computeSecret=function(a,b,c){b=b||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,b));var e=this.curve.keyFromPublic(a).getPublic(),f=e.mul(this.keys.getPrivate()).getX();return d(f,c,this.curveType.byteLength)},c.prototype.getPublicKey=function(a,b){var c=this.keys.getPublic("compressed"===b,!0);return"hybrid"===b&&(c[c.length-1]%2?c[0]=7:c[0]=6),d(c,a)},c.prototype.getPrivateKey=function(a){return d(this.keys.getPrivate(),a)},c.prototype.setPublicKey=function(a,b){return b=b||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,b)),this.keys._importPublic(a),this},c.prototype.setPrivateKey=function(a,b){b=b||"utf8",Buffer.isBuffer(a)||(a=new Buffer(a,b));var c=new f(a);return c=c.toString(16),this.keys._importPrivate(c),this}}).call(this,a("buffer").Buffer)},{"bn.js":75,buffer:104,elliptic:192}],110:[function(a,b,c){(function(Buffer){"use strict";function c(a){i.call(this,"digest"),this._hash=a,this.buffers=[]}function d(a){i.call(this,"digest"),this._hash=a}var e=a("inherits"),f=a("./md5"),g=a("ripemd160"),h=a("sha.js"),i=a("cipher-base");e(c,i),c.prototype._update=function(a){this.buffers.push(a)},c.prototype._final=function(){var a=Buffer.concat(this.buffers),b=this._hash(a);return this.buffers=null,b},e(d,i),d.prototype._update=function(a){this._hash.update(a)},d.prototype._final=function(){return this._hash.digest()},b.exports=function(a){return a=a.toLowerCase(),"md5"===a?new c(f):new d("rmd160"===a||"ripemd160"===a?new g:h(a))}}).call(this,a("buffer").Buffer)},{"./md5":112,buffer:104,"cipher-base":106,inherits:226,ripemd160:287,"sha.js":296}],111:[function(a,b,c){(function(Buffer){"use strict";function a(a){if(a.length%c!==0){var b=a.length+(c-a.length%c);a=Buffer.concat([a,d],b)}for(var e=new Array(a.length>>>2),f=0,g=0;f<a.length;f+=c,g++)e[g]=a.readInt32LE(f);return e}var c=4,d=new Buffer(c);d.fill(0);var e=8,f=16;b.exports=function(b,c){var d=c(a(b),b.length*e);b=new Buffer(f);for(var g=0;g<d.length;g++)b.writeInt32LE(d[g],g<<2,!0);return b}}).call(this,a("buffer").Buffer)},{buffer:104}],112:[function(a,b,c){"use strict";function d(a,b){a[b>>5]|=128<<b%32,a[(b+64>>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,k=271733878,l=0;l<a.length;l+=16){var m=c,n=d,o=e,p=k;c=f(c,d,e,k,a[l+0],7,-680876936),k=f(k,c,d,e,a[l+1],12,-389564586),e=f(e,k,c,d,a[l+2],17,606105819),d=f(d,e,k,c,a[l+3],22,-1044525330),c=f(c,d,e,k,a[l+4],7,-176418897),k=f(k,c,d,e,a[l+5],12,1200080426),e=f(e,k,c,d,a[l+6],17,-1473231341),d=f(d,e,k,c,a[l+7],22,-45705983),c=f(c,d,e,k,a[l+8],7,1770035416),k=f(k,c,d,e,a[l+9],12,-1958414417),e=f(e,k,c,d,a[l+10],17,-42063),d=f(d,e,k,c,a[l+11],22,-1990404162),c=f(c,d,e,k,a[l+12],7,1804603682),k=f(k,c,d,e,a[l+13],12,-40341101),e=f(e,k,c,d,a[l+14],17,-1502002290),d=f(d,e,k,c,a[l+15],22,1236535329),c=g(c,d,e,k,a[l+1],5,-165796510),k=g(k,c,d,e,a[l+6],9,-1069501632),e=g(e,k,c,d,a[l+11],14,643717713),d=g(d,e,k,c,a[l+0],20,-373897302),c=g(c,d,e,k,a[l+5],5,-701558691),k=g(k,c,d,e,a[l+10],9,38016083),e=g(e,k,c,d,a[l+15],14,-660478335),d=g(d,e,k,c,a[l+4],20,-405537848),c=g(c,d,e,k,a[l+9],5,568446438),k=g(k,c,d,e,a[l+14],9,-1019803690),e=g(e,k,c,d,a[l+3],14,-187363961),d=g(d,e,k,c,a[l+8],20,1163531501),c=g(c,d,e,k,a[l+13],5,-1444681467),k=g(k,c,d,e,a[l+2],9,-51403784),e=g(e,k,c,d,a[l+7],14,1735328473),d=g(d,e,k,c,a[l+12],20,-1926607734),c=h(c,d,e,k,a[l+5],4,-378558),k=h(k,c,d,e,a[l+8],11,-2022574463),e=h(e,k,c,d,a[l+11],16,1839030562),d=h(d,e,k,c,a[l+14],23,-35309556),c=h(c,d,e,k,a[l+1],4,-1530992060),k=h(k,c,d,e,a[l+4],11,1272893353),e=h(e,k,c,d,a[l+7],16,-155497632),d=h(d,e,k,c,a[l+10],23,-1094730640),c=h(c,d,e,k,a[l+13],4,681279174),k=h(k,c,d,e,a[l+0],11,-358537222),e=h(e,k,c,d,a[l+3],16,-722521979),d=h(d,e,k,c,a[l+6],23,76029189),c=h(c,d,e,k,a[l+9],4,-640364487),k=h(k,c,d,e,a[l+12],11,-421815835),e=h(e,k,c,d,a[l+15],16,530742520),d=h(d,e,k,c,a[l+2],23,-995338651),c=i(c,d,e,k,a[l+0],6,-198630844),k=i(k,c,d,e,a[l+7],10,1126891415),e=i(e,k,c,d,a[l+14],15,-1416354905),d=i(d,e,k,c,a[l+5],21,-57434055),c=i(c,d,e,k,a[l+12],6,1700485571),k=i(k,c,d,e,a[l+3],10,-1894986606),e=i(e,k,c,d,a[l+10],15,-1051523),d=i(d,e,k,c,a[l+1],21,-2054922799),c=i(c,d,e,k,a[l+8],6,1873313359),k=i(k,c,d,e,a[l+15],10,-30611744),e=i(e,k,c,d,a[l+6],15,-1560198380),d=i(d,e,k,c,a[l+13],21,1309151649),c=i(c,d,e,k,a[l+4],6,-145523070),k=i(k,c,d,e,a[l+11],10,-1120210379),e=i(e,k,c,d,a[l+2],15,718787259),d=i(d,e,k,c,a[l+9],21,-343485551),c=j(c,m),d=j(d,n),e=j(e,o),k=j(k,p)}return[c,d,e,k]}function e(a,b,c,d,e,f){return j(k(j(j(b,a),j(d,f)),e),c)}function f(a,b,c,d,f,g,h){return e(b&c|~b&d,a,b,f,g,h)}function g(a,b,c,d,f,g,h){return e(b&d|c&~d,a,b,f,g,h)}function h(a,b,c,d,f,g,h){return e(b^c^d,a,b,f,g,h)}function i(a,b,c,d,f,g,h){return e(c^(b|~d),a,b,f,g,h)}function j(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function k(a,b){return a<<b|a>>>32-b}var l=a("./make-hash");b.exports=function(a){return l(a,d)}},{"./make-hash":111}],113:[function(a,b,c){"use strict";function d(a,b){g.call(this,"digest"),"string"==typeof b&&(b=Buffer.from(b));var c="sha512"===a||"sha384"===a?128:64;if(this._alg=a,this._key=b,b.length>c){var d="rmd160"===a?new i:j(a);b=d.update(b).digest()}else b.length<c&&(b=Buffer.concat([b,k],c));for(var e=this._ipad=Buffer.allocUnsafe(c),f=this._opad=Buffer.allocUnsafe(c),h=0;h<c;h++)e[h]=54^b[h],f[h]=92^b[h];this._hash="rmd160"===a?new i:j(a),this._hash.update(e)}var e=a("inherits"),f=a("./legacy"),g=a("cipher-base"),Buffer=a("safe-buffer").Buffer,h=a("create-hash/md5"),i=a("ripemd160"),j=a("sha.js"),k=Buffer.alloc(128);e(d,g),d.prototype._update=function(a){this._hash.update(a)},d.prototype._final=function(){var a=this._hash.digest(),b="rmd160"===this._alg?new i:j(this._alg);return b.update(this._opad).update(a).digest()},b.exports=function(a,b){return a=a.toLowerCase(),"rmd160"===a||"ripemd160"===a?new d("rmd160",b):"md5"===a?new f(h,b):new d(a,b)}},{"./legacy":114,"cipher-base":106,"create-hash/md5":112,inherits:226,ripemd160:287,"safe-buffer":288,"sha.js":296}],114:[function(a,b,c){"use strict";function d(a,b){f.call(this,"digest"),"string"==typeof b&&(b=Buffer.from(b)),this._alg=a,this._key=b,b.length>h?b=a(b):b.length<h&&(b=Buffer.concat([b,g],h));for(var c=this._ipad=Buffer.allocUnsafe(h),d=this._opad=Buffer.allocUnsafe(h),e=0;e<h;e++)c[e]=54^b[e],d[e]=92^b[e];this._hash=[c]}var e=a("inherits"),Buffer=a("safe-buffer").Buffer,f=a("cipher-base"),g=Buffer.alloc(128),h=64;e(d,f),d.prototype._update=function(a){this._hash.push(a)},d.prototype._final=function(){var a=this._alg(Buffer.concat(this._hash));return this._alg(Buffer.concat([this._opad,a]))},b.exports=d},{"cipher-base":106,inherits:226,"safe-buffer":288}],115:[function(a,b,c){"use strict";c.randomBytes=c.rng=c.pseudoRandomBytes=c.prng=a("randombytes"),c.createHash=c.Hash=a("create-hash"),c.createHmac=c.Hmac=a("create-hmac");var d=a("browserify-sign/algos"),e=Object.keys(d),f=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(e);c.getHashes=function(){return f};var g=a("pbkdf2");c.pbkdf2=g.pbkdf2,c.pbkdf2Sync=g.pbkdf2Sync;var h=a("browserify-cipher");c.Cipher=h.Cipher,c.createCipher=h.createCipher,c.Cipheriv=h.Cipheriv,c.createCipheriv=h.createCipheriv,c.Decipher=h.Decipher,c.createDecipher=h.createDecipher,c.Decipheriv=h.Decipheriv,c.createDecipheriv=h.createDecipheriv,c.getCiphers=h.getCiphers,c.listCiphers=h.listCiphers;var i=a("diffie-hellman");c.DiffieHellmanGroup=i.DiffieHellmanGroup,c.createDiffieHellmanGroup=i.createDiffieHellmanGroup,c.getDiffieHellman=i.getDiffieHellman,c.createDiffieHellman=i.createDiffieHellman,c.DiffieHellman=i.DiffieHellman;var j=a("browserify-sign");c.createSign=j.createSign,c.Sign=j.Sign,c.createVerify=j.createVerify,c.Verify=j.Verify,c.createECDH=a("create-ecdh");var k=a("public-encrypt");c.publicEncrypt=k.publicEncrypt,c.privateEncrypt=k.privateEncrypt,c.publicDecrypt=k.publicDecrypt,c.privateDecrypt=k.privateDecrypt;var l=a("randomfill");c.randomFill=l.randomFill,c.randomFillSync=l.randomFillSync,c.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},c.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},{"browserify-cipher":95,"browserify-sign":134,"browserify-sign/algos":131,"create-ecdh":109,"create-hash":110,"create-hmac":113,"diffie-hellman":183,pbkdf2:236,"public-encrypt":239,randombytes:271,randomfill:272}],116:[function(a,b,c){var d=c;d.bignum=a("bn.js"),d.define=a("./asn1/api").define,d.base=a("./asn1/base"),d.constants=a("./asn1/constants"),d.decoders=a("./asn1/decoders"),d.encoders=a("./asn1/encoders")},{"./asn1/api":117,"./asn1/base":119,"./asn1/constants":123,"./asn1/decoders":125,"./asn1/encoders":128,"bn.js":75}],117:[function(a,b,c){function d(a,b){this.name=a,this.body=b,this.decoders={},this.encoders={}}var e=a("../asn1"),f=a("inherits"),g=c;g.define=function(a,b){return new d(a,b)},d.prototype._createNamed=function(b){var c;try{c=a("vm").runInThisContext("(function "+this.name+"(entity) {\n  this._initNamed(entity);\n})")}catch(a){c=function(a){this._initNamed(a)}}return f(c,b),c.prototype._initNamed=function(a){b.call(this,a)},new c(this)},d.prototype._getDecoder=function(a){return a=a||"der",this.decoders.hasOwnProperty(a)||(this.decoders[a]=this._createNamed(e.decoders[a])),this.decoders[a]},d.prototype.decode=function(a,b,c){return this._getDecoder(b).decode(a,c)},d.prototype._getEncoder=function(a){return a=a||"der",this.encoders.hasOwnProperty(a)||(this.encoders[a]=this._createNamed(e.encoders[a])),this.encoders[a]},d.prototype.encode=function(a,b,c){return this._getEncoder(b).encode(a,c)}},{"../asn1":116,inherits:226,vm:322}],118:[function(a,b,c){function d(a,b){return g.call(this,b),Buffer.isBuffer(a)?(this.base=a,this.offset=0,void(this.length=a.length)):void this.error("Input not Buffer")}function e(a,b){if(Array.isArray(a))this.length=0,this.value=a.map(function(a){return a instanceof e||(a=new e(a,b)),this.length+=a.length,a},this);else if("number"==typeof a){if(!(0<=a&&a<=255))return b.error("non-byte EncoderBuffer value");this.value=a,this.length=1}else if("string"==typeof a)this.value=a,this.length=Buffer.byteLength(a);else{if(!Buffer.isBuffer(a))return b.error("Unsupported type: "+typeof a);this.value=a,this.length=a.length}}var f=a("inherits"),g=a("../base").Reporter,Buffer=a("buffer").Buffer;f(d,g),c.DecoderBuffer=d,d.prototype.save=function(){return{offset:this.offset,reporter:g.prototype.save.call(this)}},d.prototype.restore=function(a){var b=new d(this.base);return b.offset=a.offset,b.length=this.offset,this.offset=a.offset,g.prototype.restore.call(this,a.reporter),b},d.prototype.isEmpty=function(){return this.offset===this.length},d.prototype.readUInt8=function(a){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(a||"DecoderBuffer overrun")},d.prototype.skip=function(a,b){if(!(this.offset+a<=this.length))return this.error(b||"DecoderBuffer overrun");var c=new d(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+a,this.offset+=a,c},d.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)},c.EncoderBuffer=e,e.prototype.join=function(a,b){return a||(a=new Buffer(this.length)),b||(b=0),0===this.length?a:(Array.isArray(this.value)?this.value.forEach(function(c){c.join(a,b),b+=c.length}):("number"==typeof this.value?a[b]=this.value:"string"==typeof this.value?a.write(this.value,b):Buffer.isBuffer(this.value)&&this.value.copy(a,b),b+=this.length),a)}},{"../base":119,buffer:104,inherits:226}],119:[function(a,b,c){var d=c;d.Reporter=a("./reporter").Reporter,d.DecoderBuffer=a("./buffer").DecoderBuffer,d.EncoderBuffer=a("./buffer").EncoderBuffer,d.Node=a("./node")},{"./buffer":118,"./node":120,"./reporter":121}],120:[function(a,b,c){function d(a,b){var c={};this._baseState=c,c.enc=a,c.parent=b||null,c.children=null,c.tag=null,c.args=null,c.reverseArgs=null,c.choice=null,c.optional=!1,c.any=!1,c.obj=!1,c.use=null,c.useDecoder=null,c.key=null,c.default=null,c.explicit=null,c.implicit=null,c.contains=null,c.parent||(c.children=[],this._wrap())}var e=a("../base").Reporter,f=a("../base").EncoderBuffer,g=a("../base").DecoderBuffer,h=a("minimalistic-assert"),i=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],j=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i),k=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];b.exports=d;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var a=this._baseState,b={};l.forEach(function(c){b[c]=a[c]});var c=new this.constructor(b.parent);return c._baseState=b,c},d.prototype._wrap=function(){var a=this._baseState;j.forEach(function(b){this[b]=function(){var c=new this.constructor(this);return a.children.push(c),c[b].apply(c,arguments)}},this)},d.prototype._init=function(a){var b=this._baseState;h(null===b.parent),a.call(this),b.children=b.children.filter(function(a){return a._baseState.parent===this},this),h.equal(b.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(a){var b=this._baseState,c=a.filter(function(a){return a instanceof this.constructor},this);a=a.filter(function(a){return!(a instanceof this.constructor)},this),0!==c.length&&(h(null===b.children),b.children=c,c.forEach(function(a){a._baseState.parent=this},this)),0!==a.length&&(h(null===b.args),b.args=a,b.reverseArgs=a.map(function(a){if("object"!=typeof a||a.constructor!==Object)return a;var b={};
11
return Object.keys(a).forEach(function(c){c==(0|c)&&(c|=0);var d=a[c];b[d]=c}),b}))},k.forEach(function(a){d.prototype[a]=function(){var b=this._baseState;throw new Error(a+" not implemented for encoding: "+b.enc)}}),i.forEach(function(a){d.prototype[a]=function(){var b=this._baseState,c=Array.prototype.slice.call(arguments);return h(null===b.tag),b.tag=a,this._useArgs(c),this}}),d.prototype.use=function(a){h(a);var b=this._baseState;return h(null===b.use),b.use=a,this},d.prototype.optional=function(){var a=this._baseState;return a.optional=!0,this},d.prototype.def=function(a){var b=this._baseState;return h(null===b.default),b.default=a,b.optional=!0,this},d.prototype.explicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.explicit=a,this},d.prototype.implicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.implicit=a,this},d.prototype.obj=function(){var a=this._baseState,b=Array.prototype.slice.call(arguments);return a.obj=!0,0!==b.length&&this._useArgs(b),this},d.prototype.key=function(a){var b=this._baseState;return h(null===b.key),b.key=a,this},d.prototype.any=function(){var a=this._baseState;return a.any=!0,this},d.prototype.choice=function(a){var b=this._baseState;return h(null===b.choice),b.choice=a,this._useArgs(Object.keys(a).map(function(b){return a[b]})),this},d.prototype.contains=function(a){var b=this._baseState;return h(null===b.use),b.contains=a,this},d.prototype._decode=function(a,b){var c=this._baseState;if(null===c.parent)return a.wrapResult(c.children[0]._decode(a,b));var d=c.default,e=!0,f=null;if(null!==c.key&&(f=a.enterKey(c.key)),c.optional){var h=null;if(null!==c.explicit?h=c.explicit:null!==c.implicit?h=c.implicit:null!==c.tag&&(h=c.tag),null!==h||c.any){if(e=this._peekTag(a,h,c.any),a.isError(e))return e}else{var i=a.save();try{null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),e=!0}catch(a){e=!1}a.restore(i)}}var j;if(c.obj&&e&&(j=a.enterObject()),e){if(null!==c.explicit){var k=this._decodeTag(a,c.explicit);if(a.isError(k))return k;a=k}var l=a.offset;if(null===c.use&&null===c.choice){if(c.any)var i=a.save();var m=this._decodeTag(a,null!==c.implicit?c.implicit:c.tag,c.any);if(a.isError(m))return m;c.any?d=a.raw(i):a=m}if(b&&b.track&&null!==c.tag&&b.track(a.path(),l,a.length,"tagged"),b&&b.track&&null!==c.tag&&b.track(a.path(),a.offset,a.length,"content"),d=c.any?d:null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),a.isError(d))return d;if(c.any||null!==c.choice||null===c.children||c.children.forEach(function(c){c._decode(a,b)}),c.contains&&("octstr"===c.tag||"bitstr"===c.tag)){var n=new g(d);d=this._getUse(c.contains,a._reporterState.obj)._decode(n,b)}}return c.obj&&e&&(d=a.leaveObject(j)),null===c.key||null===d&&e!==!0?null!==f&&a.exitKey(f):a.leaveKey(f,c.key,d),d},d.prototype._decodeGeneric=function(a,b,c){var d=this._baseState;return"seq"===a||"set"===a?null:"seqof"===a||"setof"===a?this._decodeList(b,a,d.args[0],c):/str$/.test(a)?this._decodeStr(b,a,c):"objid"===a&&d.args?this._decodeObjid(b,d.args[0],d.args[1],c):"objid"===a?this._decodeObjid(b,null,null,c):"gentime"===a||"utctime"===a?this._decodeTime(b,a,c):"null_"===a?this._decodeNull(b,c):"bool"===a?this._decodeBool(b,c):"objDesc"===a?this._decodeStr(b,a,c):"int"===a||"enum"===a?this._decodeInt(b,d.args&&d.args[0],c):null!==d.use?this._getUse(d.use,b._reporterState.obj)._decode(b,c):b.error("unknown tag: "+a)},d.prototype._getUse=function(a,b){var c=this._baseState;return c.useDecoder=this._use(a,b),h(null===c.useDecoder._baseState.parent),c.useDecoder=c.useDecoder._baseState.children[0],c.implicit!==c.useDecoder._baseState.implicit&&(c.useDecoder=c.useDecoder.clone(),c.useDecoder._baseState.implicit=c.implicit),c.useDecoder},d.prototype._decodeChoice=function(a,b){var c=this._baseState,d=null,e=!1;return Object.keys(c.choice).some(function(f){var g=a.save(),h=c.choice[f];try{var i=h._decode(a,b);if(a.isError(i))return!1;d={type:f,value:i},e=!0}catch(b){return a.restore(g),!1}return!0},this),e?d:a.error("Choice not matched")},d.prototype._createEncoderBuffer=function(a){return new f(a,this.reporter)},d.prototype._encode=function(a,b,c){var d=this._baseState;if(null===d.default||d.default!==a){var e=this._encodeValue(a,b,c);if(void 0!==e&&!this._skipDefault(e,b,c))return e}},d.prototype._encodeValue=function(a,b,c){var d=this._baseState;if(null===d.parent)return d.children[0]._encode(a,b||new e);var f=null;if(this.reporter=b,d.optional&&void 0===a){if(null===d.default)return;a=d.default}var g=null,h=!1;if(d.any)f=this._createEncoderBuffer(a);else if(d.choice)f=this._encodeChoice(a,b);else if(d.contains)g=this._getUse(d.contains,c)._encode(a,b),h=!0;else if(d.children)g=d.children.map(function(c){if("null_"===c._baseState.tag)return c._encode(null,b,a);if(null===c._baseState.key)return b.error("Child should have a key");var d=b.enterKey(c._baseState.key);if("object"!=typeof a)return b.error("Child expected, but input is not object");var e=c._encode(a[c._baseState.key],b,a);return b.leaveKey(d),e},this).filter(function(a){return a}),g=this._createEncoderBuffer(g);else if("seqof"===d.tag||"setof"===d.tag){if(!d.args||1!==d.args.length)return b.error("Too many args for : "+d.tag);if(!Array.isArray(a))return b.error("seqof/setof, but data is not Array");var i=this.clone();i._baseState.implicit=null,g=this._createEncoderBuffer(a.map(function(c){var d=this._baseState;return this._getUse(d.args[0],a)._encode(c,b)},i))}else null!==d.use?f=this._getUse(d.use,c)._encode(a,b):(g=this._encodePrimitive(d.tag,a),h=!0);var f;if(!d.any&&null===d.choice){var j=null!==d.implicit?d.implicit:d.tag,k=null===d.implicit?"universal":"context";null===j?null===d.use&&b.error("Tag could be omitted only for .use()"):null===d.use&&(f=this._encodeComposite(j,h,k,g))}return null!==d.explicit&&(f=this._encodeComposite(d.explicit,!1,"context",f)),f},d.prototype._encodeChoice=function(a,b){var c=this._baseState,d=c.choice[a.type];return d||h(!1,a.type+" not found in "+JSON.stringify(Object.keys(c.choice))),d._encode(a.value,b)},d.prototype._encodePrimitive=function(a,b){var c=this._baseState;if(/str$/.test(a))return this._encodeStr(b,a);if("objid"===a&&c.args)return this._encodeObjid(b,c.reverseArgs[0],c.args[1]);if("objid"===a)return this._encodeObjid(b,null,null);if("gentime"===a||"utctime"===a)return this._encodeTime(b,a);if("null_"===a)return this._encodeNull();if("int"===a||"enum"===a)return this._encodeInt(b,c.args&&c.reverseArgs[0]);if("bool"===a)return this._encodeBool(b);if("objDesc"===a)return this._encodeStr(b,a);throw new Error("Unsupported tag: "+a)},d.prototype._isNumstr=function(a){return/^[0-9 ]*$/.test(a)},d.prototype._isPrintstr=function(a){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(a)}},{"../base":119,"minimalistic-assert":234}],121:[function(a,b,c){function d(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}function e(a,b){this.path=a,this.rethrow(b)}var f=a("inherits");c.Reporter=d,d.prototype.isError=function(a){return a instanceof e},d.prototype.save=function(){var a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},d.prototype.restore=function(a){var b=this._reporterState;b.obj=a.obj,b.path=b.path.slice(0,a.pathLen)},d.prototype.enterKey=function(a){return this._reporterState.path.push(a)},d.prototype.exitKey=function(a){var b=this._reporterState;b.path=b.path.slice(0,a-1)},d.prototype.leaveKey=function(a,b,c){var d=this._reporterState;this.exitKey(a),null!==d.obj&&(d.obj[b]=c)},d.prototype.path=function(){return this._reporterState.path.join("/")},d.prototype.enterObject=function(){var a=this._reporterState,b=a.obj;return a.obj={},b},d.prototype.leaveObject=function(a){var b=this._reporterState,c=b.obj;return b.obj=a,c},d.prototype.error=function(a){var b,c=this._reporterState,d=a instanceof e;if(b=d?a:new e(c.path.map(function(a){return"["+JSON.stringify(a)+"]"}).join(""),a.message||a,a.stack),!c.options.partial)throw b;return d||c.errors.push(b),b},d.prototype.wrapResult=function(a){var b=this._reporterState;return b.options.partial?{result:this.isError(a)?null:a,errors:b.errors}:a},f(e,Error),e.prototype.rethrow=function(a){if(this.message=a+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(a){this.stack=a.stack}return this}},{inherits:226}],122:[function(a,b,c){var d=a("../constants");c.tagClass={0:"universal",1:"application",2:"context",3:"private"},c.tagClassByName=d._reverse(c.tagClass),c.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},c.tagByName=d._reverse(c.tag)},{"../constants":123}],123:[function(a,b,c){var d=c;d._reverse=function(a){var b={};return Object.keys(a).forEach(function(c){(0|c)==c&&(c|=0);var d=a[c];b[d]=c}),b},d.der=a("./der")},{"./der":122}],124:[function(a,b,c){function d(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new e,this.tree._init(a.body)}function e(a){j.Node.call(this,"der",a)}function f(a,b){var c=a.readUInt8(b);if(a.isError(c))return c;var d=l.tagClass[c>>6],e=0===(32&c);if(31===(31&c)){var f=c;for(c=0;128===(128&f);){if(f=a.readUInt8(b),a.isError(f))return f;c<<=7,c|=127&f}}else c&=31;var g=l.tag[c];return{cls:d,primitive:e,tag:c,tagStr:g}}function g(a,b,c){var d=a.readUInt8(c);if(a.isError(d))return d;if(!b&&128===d)return null;if(0===(128&d))return d;var e=127&d;if(e>4)return a.error("length octect is too long");d=0;for(var f=0;f<e;f++){d<<=8;var g=a.readUInt8(c);if(a.isError(g))return g;d|=g}return d}var h=a("inherits"),i=a("../../asn1"),j=i.base,k=i.bignum,l=i.constants.der;b.exports=d,d.prototype.decode=function(a,b){return a instanceof j.DecoderBuffer||(a=new j.DecoderBuffer(a,b)),this.tree._decode(a,b)},h(e,j.Node),e.prototype._peekTag=function(a,b,c){if(a.isEmpty())return!1;var d=a.save(),e=f(a,'Failed to peek tag: "'+b+'"');return a.isError(e)?e:(a.restore(d),e.tag===b||e.tagStr===b||e.tagStr+"of"===b||c)},e.prototype._decodeTag=function(a,b,c){var d=f(a,'Failed to decode tag of "'+b+'"');if(a.isError(d))return d;var e=g(a,d.primitive,'Failed to get length of "'+b+'"');if(a.isError(e))return e;if(!c&&d.tag!==b&&d.tagStr!==b&&d.tagStr+"of"!==b)return a.error('Failed to match tag: "'+b+'"');if(d.primitive||null!==e)return a.skip(e,'Failed to match body of: "'+b+'"');var h=a.save(),i=this._skipUntilEnd(a,'Failed to skip indefinite length body: "'+this.tag+'"');return a.isError(i)?i:(e=a.offset-h.offset,a.restore(h),a.skip(e,'Failed to match body of: "'+b+'"'))},e.prototype._skipUntilEnd=function(a,b){for(;;){var c=f(a,b);if(a.isError(c))return c;var d=g(a,c.primitive,b);if(a.isError(d))return d;var e;if(e=c.primitive||null!==d?a.skip(d):this._skipUntilEnd(a,b),a.isError(e))return e;if("end"===c.tagStr)break}},e.prototype._decodeList=function(a,b,c,d){for(var e=[];!a.isEmpty();){var f=this._peekTag(a,"end");if(a.isError(f))return f;var g=c.decode(a,"der",d);if(a.isError(g)&&f)break;e.push(g)}return e},e.prototype._decodeStr=function(a,b){if("bitstr"===b){var c=a.readUInt8();return a.isError(c)?c:{unused:c,data:a.raw()}}if("bmpstr"===b){var d=a.raw();if(d.length%2===1)return a.error("Decoding of string type: bmpstr length mismatch");for(var e="",f=0;f<d.length/2;f++)e+=String.fromCharCode(d.readUInt16BE(2*f));return e}if("numstr"===b){var g=a.raw().toString("ascii");return this._isNumstr(g)?g:a.error("Decoding of string type: numstr unsupported characters")}if("octstr"===b)return a.raw();if("objDesc"===b)return a.raw();if("printstr"===b){var h=a.raw().toString("ascii");return this._isPrintstr(h)?h:a.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(b)?a.raw().toString():a.error("Decoding of string type: "+b+" unsupported")},e.prototype._decodeObjid=function(a,b,c){for(var d,e=[],f=0;!a.isEmpty();){var g=a.readUInt8();f<<=7,f|=127&g,0===(128&g)&&(e.push(f),f=0)}128&g&&e.push(f);var h=e[0]/40|0,i=e[0]%40;if(d=c?e:[h,i].concat(e.slice(1)),b){var j=b[d.join(" ")];void 0===j&&(j=b[d.join(".")]),void 0!==j&&(d=j)}return d},e.prototype._decodeTime=function(a,b){var c=a.raw().toString();if("gentime"===b)var d=0|c.slice(0,4),e=0|c.slice(4,6),f=0|c.slice(6,8),g=0|c.slice(8,10),h=0|c.slice(10,12),i=0|c.slice(12,14);else{if("utctime"!==b)return a.error("Decoding "+b+" time is not supported yet");var d=0|c.slice(0,2),e=0|c.slice(2,4),f=0|c.slice(4,6),g=0|c.slice(6,8),h=0|c.slice(8,10),i=0|c.slice(10,12);d=d<70?2e3+d:1900+d}return Date.UTC(d,e-1,f,g,h,i,0)},e.prototype._decodeNull=function(a){return null},e.prototype._decodeBool=function(a){var b=a.readUInt8();return a.isError(b)?b:0!==b},e.prototype._decodeInt=function(a,b){var c=a.raw(),d=new k(c);return b&&(d=b[d.toString(10)]||d),d},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getDecoder("der").tree}},{"../../asn1":116,inherits:226}],125:[function(a,b,c){var d=c;d.der=a("./der"),d.pem=a("./pem")},{"./der":124,"./pem":126}],126:[function(a,b,c){function d(a){f.call(this,a),this.enc="pem"}var e=a("inherits"),Buffer=a("buffer").Buffer,f=a("./der");e(d,f),b.exports=d,d.prototype.decode=function(a,b){for(var c=a.toString().split(/[\r\n]+/g),d=b.label.toUpperCase(),e=/^-----(BEGIN|END) ([^-]+)-----$/,g=-1,h=-1,i=0;i<c.length;i++){var j=c[i].match(e);if(null!==j&&j[2]===d){if(g!==-1){if("END"!==j[1])break;h=i;break}if("BEGIN"!==j[1])break;g=i}}if(g===-1||h===-1)throw new Error("PEM section not found for: "+d);var k=c.slice(g+1,h).join("");k.replace(/[^a-z0-9\+\/=]+/gi,"");var l=new Buffer(k,"base64");return f.prototype.decode.call(this,l,b)}},{"./der":124,buffer:104,inherits:226}],127:[function(a,b,c){function d(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new e,this.tree._init(a.body)}function e(a){j.Node.call(this,"der",a)}function f(a){return a<10?"0"+a:a}function g(a,b,c,d){var e;if("seqof"===a?a="seq":"setof"===a&&(a="set"),k.tagByName.hasOwnProperty(a))e=k.tagByName[a];else{if("number"!=typeof a||(0|a)!==a)return d.error("Unknown tag: "+a);e=a}return e>=31?d.error("Multi-octet tag encoding unsupported"):(b||(e|=32),e|=k.tagClassByName[c||"universal"]<<6)}var h=a("inherits"),Buffer=a("buffer").Buffer,i=a("../../asn1"),j=i.base,k=i.constants.der;b.exports=d,d.prototype.encode=function(a,b){return this.tree._encode(a,b).join()},h(e,j.Node),e.prototype._encodeComposite=function(a,b,c,d){var e=g(a,b,c,this.reporter);if(d.length<128){var f=new Buffer(2);return f[0]=e,f[1]=d.length,this._createEncoderBuffer([f,d])}for(var h=1,i=d.length;i>=256;i>>=8)h++;var f=new Buffer(2+h);f[0]=e,f[1]=128|h;for(var i=1+h,j=d.length;j>0;i--,j>>=8)f[i]=255&j;return this._createEncoderBuffer([f,d])},e.prototype._encodeStr=function(a,b){if("bitstr"===b)return this._createEncoderBuffer([0|a.unused,a.data]);if("bmpstr"===b){for(var c=new Buffer(2*a.length),d=0;d<a.length;d++)c.writeUInt16BE(a.charCodeAt(d),2*d);return this._createEncoderBuffer(c)}return"numstr"===b?this._isNumstr(a)?this._createEncoderBuffer(a):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===b?this._isPrintstr(a)?this._createEncoderBuffer(a):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(b)?this._createEncoderBuffer(a):"objDesc"===b?this._createEncoderBuffer(a):this.reporter.error("Encoding of string type: "+b+" unsupported")},e.prototype._encodeObjid=function(a,b,c){if("string"==typeof a){if(!b)return this.reporter.error("string objid given, but no values map found");if(!b.hasOwnProperty(a))return this.reporter.error("objid not found in values map");a=b[a].split(/[\s\.]+/g);for(var d=0;d<a.length;d++)a[d]|=0}else if(Array.isArray(a)){a=a.slice();for(var d=0;d<a.length;d++)a[d]|=0}if(!Array.isArray(a))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(a));if(!c){if(a[1]>=40)return this.reporter.error("Second objid identifier OOB");a.splice(0,2,40*a[0]+a[1])}for(var e=0,d=0;d<a.length;d++){var f=a[d];for(e++;f>=128;f>>=7)e++}for(var g=new Buffer(e),h=g.length-1,d=a.length-1;d>=0;d--){var f=a[d];for(g[h--]=127&f;(f>>=7)>0;)g[h--]=128|127&f}return this._createEncoderBuffer(g)},e.prototype._encodeTime=function(a,b){var c,d=new Date(a);return"gentime"===b?c=[f(d.getFullYear()),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):"utctime"===b?c=[f(d.getFullYear()%100),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+b+" time is not supported yet"),this._encodeStr(c,"octstr")},e.prototype._encodeNull=function(){return this._createEncoderBuffer("")},e.prototype._encodeInt=function(a,b){if("string"==typeof a){if(!b)return this.reporter.error("String int or enum given, but no values map");if(!b.hasOwnProperty(a))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(a));a=b[a]}if("number"!=typeof a&&!Buffer.isBuffer(a)){var c=a.toArray();!a.sign&&128&c[0]&&c.unshift(0),a=new Buffer(c)}if(Buffer.isBuffer(a)){var d=a.length;0===a.length&&d++;var e=new Buffer(d);return a.copy(e),0===a.length&&(e[0]=0),this._createEncoderBuffer(e)}if(a<128)return this._createEncoderBuffer(a);if(a<256)return this._createEncoderBuffer([0,a]);for(var d=1,f=a;f>=256;f>>=8)d++;for(var e=new Array(d),f=e.length-1;f>=0;f--)e[f]=255&a,a>>=8;return 128&e[0]&&e.unshift(0),this._createEncoderBuffer(new Buffer(e))},e.prototype._encodeBool=function(a){return this._createEncoderBuffer(a?255:0)},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getEncoder("der").tree},e.prototype._skipDefault=function(a,b,c){var d,e=this._baseState;if(null===e.default)return!1;var f=a.join();if(void 0===e.defaultBuffer&&(e.defaultBuffer=this._encodeValue(e.default,b,c).join()),f.length!==e.defaultBuffer.length)return!1;for(d=0;d<f.length;d++)if(f[d]!==e.defaultBuffer[d])return!1;return!0}},{"../../asn1":116,buffer:104,inherits:226}],128:[function(a,b,c){var d=c;d.der=a("./der"),d.pem=a("./pem")},{"./der":127,"./pem":129}],129:[function(a,b,c){function d(a){f.call(this,a),this.enc="pem"}var e=a("inherits"),f=a("./der");e(d,f),b.exports=d,d.prototype.encode=function(a,b){for(var c=f.prototype.encode.call(this,a),d=c.toString("base64"),e=["-----BEGIN "+b.label+"-----"],g=0;g<d.length;g+=64)e.push(d.slice(g,g+64));return e.push("-----END "+b.label+"-----"),e.join("\n")}},{"./der":127,inherits:226}],130:[function(a,b,c){(function(Buffer){function c(a){var b=e(a),c=b.toRed(f.mont(a.modulus)).redPow(new f(a.publicExponent)).fromRed();return{blinder:c,unblinder:b.invm(a.modulus)}}function d(a,b){var d=c(b),e=b.modulus.byteLength(),g=(f.mont(b.modulus),new f(a).mul(d.blinder).umod(b.modulus)),h=g.toRed(f.mont(b.prime1)),i=g.toRed(f.mont(b.prime2)),j=b.coefficient,k=b.prime1,l=b.prime2,m=h.redPow(b.exponent1),n=i.redPow(b.exponent2);m=m.fromRed(),n=n.fromRed();var o=m.isub(n).imul(j).umod(k);return o.imul(l),n.iadd(o),new Buffer(n.imul(d.unblinder).umod(b.modulus).toArray(!1,e))}function e(a){for(var b=a.modulus.byteLength(),c=new f(g(b));c.cmp(a.modulus)>=0||!c.umod(a.prime1)||!c.umod(a.prime2);)c=new f(g(b));return c}var f=a("bn.js"),g=a("randombytes");b.exports=d,d.getr=e}).call(this,a("buffer").Buffer)},{"bn.js":75,buffer:104,randombytes:271}],131:[function(a,b,c){b.exports=a("./browser/algorithms.json")},{"./browser/algorithms.json":132}],132:[function(a,b,c){b.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],133:[function(a,b,c){b.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],134:[function(a,b,c){(function(Buffer){function c(a){h.Writable.call(this);var b=l[a];if(!b)throw new Error("Unknown message digest");this._hashType=b.hash,this._hash=g(b.hash),this._tag=b.id,this._signType=b.sign}function d(a){h.Writable.call(this);var b=l[a];if(!b)throw new Error("Unknown message digest");this._hash=g(b.hash),this._tag=b.id,this._signType=b.sign}function e(a){return new c(a)}function f(a){return new d(a)}var g=a("create-hash"),h=a("stream"),i=a("inherits"),j=a("./sign"),k=a("./verify"),l=a("./algorithms.json");Object.keys(l).forEach(function(a){l[a].id=new Buffer(l[a].id,"hex"),l[a.toLowerCase()]=l[a]}),i(c,h.Writable),c.prototype._write=function(a,b,c){this._hash.update(a),c()},c.prototype.update=function(a,b){return"string"==typeof a&&(a=new Buffer(a,b)),this._hash.update(a),this},c.prototype.sign=function(a,b){this.end();var c=this._hash.digest(),d=j(c,a,this._hashType,this._signType,this._tag);return b?d.toString(b):d},i(d,h.Writable),d.prototype._write=function(a,b,c){this._hash.update(a),c()},d.prototype.update=function(a,b){return"string"==typeof a&&(a=new Buffer(a,b)),this._hash.update(a),this},d.prototype.verify=function(a,b,c){"string"==typeof b&&(b=new Buffer(b,c)),this.end();var d=this._hash.digest();return k(b,d,a,this._signType,this._tag)},b.exports={Sign:e,Verify:f,createSign:e,createVerify:f}}).call(this,a("buffer").Buffer)},{"./algorithms.json":132,"./sign":135,"./verify":136,buffer:104,"create-hash":110,inherits:226,stream:304}],135:[function(a,b,c){(function(Buffer){function c(a,b,c,f,g){var h=p(b);if(h.curve){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong private key type");return d(a,h)}if("dsa"===h.type){if("dsa"!==f)throw new Error("wrong private key type");return e(a,h,c)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong private key type");a=Buffer.concat([g,a]);for(var i=h.modulus.byteLength(),j=[0,1];a.length+j.length+1<i;)j.push(255);j.push(0);for(var k=-1;++k<a.length;)j.push(a[k]);var l=m(j,h);return l}function d(a,b){var c=q[b.curve.join(".")];if(!c)throw new Error("unknown curve "+b.curve.join("."));var d=new n(c),e=d.keyFromPrivate(b.privateKey),f=e.sign(a);return new Buffer(f.toDER())}function e(a,b,c){for(var d,e=b.params.priv_key,i=b.params.p,l=b.params.q,m=b.params.g,n=new o(0),p=h(a,l).mod(l),q=!1,r=g(e,l,a,c);q===!1;)d=j(l,r,c),n=k(m,d,i,l),q=d.invm(l).imul(p.add(e.mul(n))).mod(l),0===q.cmpn(0)&&(q=!1,n=new o(0));return f(n,q)}function f(a,b){a=a.toArray(),b=b.toArray(),128&a[0]&&(a=[0].concat(a)),128&b[0]&&(b=[0].concat(b));var c=a.length+b.length+4,d=[48,c,2,a.length];return d=d.concat(a,[2,b.length],b),new Buffer(d)}function g(a,b,c,d){if(a=new Buffer(a.toArray()),a.length<b.byteLength()){var e=new Buffer(b.byteLength()-a.length);e.fill(0),a=Buffer.concat([e,a])}var f=c.length,g=i(c,b),h=new Buffer(f);h.fill(1);var j=new Buffer(f);return j.fill(0),j=l(d,j).update(h).update(new Buffer([0])).update(a).update(g).digest(),h=l(d,j).update(h).digest(),j=l(d,j).update(h).update(new Buffer([1])).update(a).update(g).digest(),h=l(d,j).update(h).digest(),{k:j,v:h}}function h(a,b){var c=new o(a),d=(a.length<<3)-b.bitLength();return d>0&&c.ishrn(d),c}function i(a,b){a=h(a,b),a=a.mod(b);var c=new Buffer(a.toArray());if(c.length<b.byteLength()){var d=new Buffer(b.byteLength()-c.length);d.fill(0),c=Buffer.concat([d,c])}return c}function j(a,b,c){var d,e;do{for(d=new Buffer(0);8*d.length<a.bitLength();)b.v=l(c,b.k).update(b.v).digest(),d=Buffer.concat([d,b.v]);e=h(d,a),b.k=l(c,b.k).update(b.v).update(new Buffer([0])).digest(),b.v=l(c,b.k).update(b.v).digest()}while(e.cmp(a)!==-1);return e}function k(a,b,c,d){return a.toRed(o.mont(c)).redPow(b).fromRed().mod(d)}var l=a("create-hmac"),m=a("browserify-rsa"),n=a("elliptic").ec,o=a("bn.js"),p=a("parse-asn1"),q=a("./curves.json");b.exports=c,b.exports.getKey=g,b.exports.makeKey=j}).call(this,a("buffer").Buffer)},{"./curves.json":133,"bn.js":75,"browserify-rsa":130,buffer:104,"create-hmac":113,elliptic:192,"parse-asn1":141}],136:[function(a,b,c){(function(Buffer){function c(a,b,c,f,h){var j=i(c);if("ec"===j.type){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");return d(a,b,j)}if("dsa"===j.type){if("dsa"!==f)throw new Error("wrong public key type");return e(a,b,j)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");b=Buffer.concat([h,b]);for(var k=j.modulus.byteLength(),l=[1],m=0;b.length+l.length+2<k;)l.push(255),m++;l.push(0);for(var n=-1;++n<b.length;)l.push(b[n]);l=new Buffer(l);var o=g.mont(j.modulus);a=new g(a).toRed(o),a=a.redPow(new g(j.publicExponent)),a=new Buffer(a.fromRed().toArray());var p=m<8?1:0;for(k=Math.min(a.length,l.length),a.length!==l.length&&(p=1),n=-1;++n<k;)p|=a[n]^l[n];return 0===p}function d(a,b,c){var d=j[c.data.algorithm.curve.join(".")];if(!d)throw new Error("unknown curve "+c.data.algorithm.curve.join("."));var e=new h(d),f=c.data.subjectPrivateKey.data;return e.verify(b,a,f)}function e(a,b,c){var d=c.data.p,e=c.data.q,h=c.data.g,j=c.data.pub_key,k=i.signature.decode(a,"der"),l=k.s,m=k.r;f(l,e),f(m,e);var n=g.mont(d),o=l.invm(e),p=h.toRed(n).redPow(new g(b).mul(o).mod(e)).fromRed().mul(j.toRed(n).redPow(m.mul(o).mod(e)).fromRed()).mod(d).mod(e);return 0===p.cmp(m)}function f(a,b){if(a.cmpn(0)<=0)throw new Error("invalid sig");if(a.cmp(b)>=b)throw new Error("invalid sig")}var g=a("bn.js"),h=a("elliptic").ec,i=a("parse-asn1"),j=a("./curves.json");b.exports=c}).call(this,a("buffer").Buffer)},{"./curves.json":133,"bn.js":75,buffer:104,elliptic:192,"parse-asn1":141}],137:[function(a,b,c){b.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],138:[function(a,b,c){"use strict";var d=a("asn1.js");c.certificate=a("./certificate");var e=d.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});c.RSAPrivateKey=e;var f=d.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});c.RSAPublicKey=f;var g=d.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(h),this.key("subjectPublicKey").bitstr())});c.PublicKey=g;var h=d.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),i=d.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(h),this.key("subjectPrivateKey").octstr())});c.PrivateKey=i;var j=d.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});c.EncryptedPrivateKey=j;var k=d.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});c.DSAPrivateKey=k,c.DSAparam=d.define("DSAparam",function(){this.int()});var l=d.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(m),this.key("publicKey").optional().explicit(1).bitstr())});c.ECPrivateKey=l;var m=d.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});c.signature=d.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":139,"asn1.js":116}],139:[function(a,b,c){"use strict";var d=a("asn1.js"),e=d.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),f=d.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),g=d.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),h=d.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(g),this.key("subjectPublicKey").bitstr())}),i=d.define("RelativeDistinguishedName",function(){this.setof(f)}),j=d.define("RDNSequence",function(){this.seqof(i)}),k=d.define("Name",function(){this.choice({rdnSequence:this.use(j)})}),l=d.define("Validity",function(){this.seq().obj(this.key("notBefore").use(e),this.key("notAfter").use(e))}),m=d.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),n=d.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(g),this.key("issuer").use(k),this.key("validity").use(l),this.key("subject").use(k),this.key("subjectPublicKeyInfo").use(h),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(m).optional())}),o=d.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(n),this.key("signatureAlgorithm").use(g),this.key("signatureValue").bitstr())});b.exports=o},{"asn1.js":116}],140:[function(a,b,c){(function(Buffer){var c=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,d=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,e=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,f=a("evp_bytestokey"),g=a("browserify-aes");