From 844006ed1634f15c6d21b686f12b73217339b4ef Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 12 Apr 2023 18:54:00 +0800 Subject: [PATCH] update sth for pad --- Data/js/jcwallet.js | 2 +- app/build.gradle | 47 ++++++++++++------- .../com/cege/games/release/MainActivity.java | 8 +--- gradle.properties | 4 +- install-time-asset_pack/.gitignore | 1 - install-time-asset_pack/build.gradle | 44 ----------------- install-time-asset_pack/consumer-rules.pro | 0 install-time-asset_pack/proguard-rules.pro | 21 --------- .../mylibrary/ExampleInstrumentedTest.java | 26 ---------- .../src/main/AndroidManifest.xml | 5 -- .../example/mylibrary/ExampleUnitTest.java | 17 ------- settings.gradle | 4 +- 12 files changed, 36 insertions(+), 143 deletions(-) delete mode 100644 install-time-asset_pack/.gitignore delete mode 100644 install-time-asset_pack/build.gradle delete mode 100644 install-time-asset_pack/consumer-rules.pro delete mode 100644 install-time-asset_pack/proguard-rules.pro delete mode 100644 install-time-asset_pack/src/androidTest/java/com/example/mylibrary/ExampleInstrumentedTest.java delete mode 100644 install-time-asset_pack/src/main/AndroidManifest.xml delete mode 100644 install-time-asset_pack/src/test/java/com/example/mylibrary/ExampleUnitTest.java diff --git a/Data/js/jcwallet.js b/Data/js/jcwallet.js index fa35fe2..6fffa1c 100644 --- a/Data/js/jcwallet.js +++ b/Data/js/jcwallet.js @@ -43,7 +43,7 @@ return function(t){var r=e,n=r.lib,a=n.WordArray,i=n.Hasher,o=r.algo,c=a.create( * derived from CryptoJS.mode.CTR * Jan Hruby jhruby.web@gmail.com */ -return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,a=n.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0),function(e){0===(e[0]=r(e[0]))&&(e[1]=r(e[1]))}(o);var c=o.slice(0);n.encryptBlock(c,0);for(var f=0;f>>2]|=a<<24-i%4*8,e.sigBytes+=a},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,a=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(a-1)).concat(e.lib.WordArray.create([a<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){var t,r,n;return r=(t=e).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},e.format.Hex},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,a=[],i=[],o=[],c=[],f=[],d=[],s=[],u=[],b=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var l=n^n<<1^n<<2^n<<3^n<<4;l=l>>>8^255&l^99,a[r]=l,i[l]=r;var p=e[r],m=e[p],x=e[m],y=257*e[l]^16843008*l;o[r]=y<<24|y>>>8,c[r]=y<<16|y>>>16,f[r]=y<<8|y>>>24,d[r]=y,y=16843009*x^65537*m^257*p^16843008*r,s[l]=y<<24|y>>>8,u[l]=y<<16|y>>>16,b[l]=y<<8|y>>>24,h[l]=y,r?(r=p^e[e[e[x^p]]],n^=e[e[n]]):r=n=1}}();var l=[0,1,2,4,8,16,32,64,128,27,54],p=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],o=0;o6&&o%r==4&&(d=a[d>>>24]<<24|a[d>>>16&255]<<16|a[d>>>8&255]<<8|a[255&d]):(d=a[(d=d<<8|d>>>24)>>>24]<<24|a[d>>>16&255]<<16|a[d>>>8&255]<<8|a[255&d],d^=l[o/r|0]<<24),i[o]=i[o-r]^d);for(var c=this._invKeySchedule=[],f=0;f>>24]]^u[a[d>>>16&255]]^b[a[d>>>8&255]]^h[a[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,c,f,d,a)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,s,u,b,h,i),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,a,i,o,c){for(var f=this._nRounds,d=e[t]^r[0],s=e[t+1]^r[1],u=e[t+2]^r[2],b=e[t+3]^r[3],h=4,l=1;l>>24]^a[s>>>16&255]^i[u>>>8&255]^o[255&b]^r[h++],m=n[s>>>24]^a[u>>>16&255]^i[b>>>8&255]^o[255&d]^r[h++],x=n[u>>>24]^a[b>>>16&255]^i[d>>>8&255]^o[255&s]^r[h++],y=n[b>>>24]^a[d>>>16&255]^i[s>>>8&255]^o[255&u]^r[h++];d=p,s=m,u=x,b=y}p=(c[d>>>24]<<24|c[s>>>16&255]<<16|c[u>>>8&255]<<8|c[255&b])^r[h++],m=(c[s>>>24]<<24|c[u>>>16&255]<<16|c[b>>>8&255]<<8|c[255&d])^r[h++],x=(c[u>>>24]<<24|c[b>>>16&255]<<16|c[d>>>8&255]<<8|c[255&s])^r[h++],y=(c[b>>>24]<<24|c[d>>>16&255]<<16|c[s>>>8&255]<<8|c[255&u])^r[h++],e[t]=p,e[t+1]=m,e[t+2]=x,e[t+3]=y},keySize:8});t.AES=r._createHelper(p)}(),e.AES},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,a=r.BlockCipher,i=t.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],f=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],s=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=i.DES=a.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=o[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var a=this._subKeys=[],i=0;i<16;i++){var d=a[i]=[],s=f[i];for(r=0;r<24;r++)d[r/6|0]|=t[(c[r]-1+s)%28]<<31-r%6,d[4+(r/6|0)]|=t[28+(c[r+24]-1+s)%28]<<31-r%6;for(d[0]=d[0]<<1|d[0]>>>31,r=1;r<7;r++)d[r]=d[r]>>>4*(r-1)+3;d[7]=d[7]<<5|d[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=a[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],b.call(this,4,252645135),b.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),b.call(this,1,1431655765);for(var n=0;n<16;n++){for(var a=r[n],i=this._lBlock,o=this._rBlock,c=0,f=0;f<8;f++)c|=d[f][((o^a[f])&s[f])>>>0];this._lBlock=o,this._rBlock=i^c}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,b.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),b.call(this,16,65535),b.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function b(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),a=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(n.create(t)),this._des2=u.createEncryptor(n.create(r)),this._des3=u.createEncryptor(n.create(a))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=a._createHelper(l)}(),e.TripleDES},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,a=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],a=0;a<256;a++)n[a]=a;a=0;for(var i=0;a<256;a++){var o=a%r,c=t[o>>>2]>>>24-o%4*8&255;i=(i+n[a]+c)%256;var f=n[a];n[a]=n[i],n[i]=f}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,r=this._j,n=0,a=0;a<4;a++){r=(r+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[r],e[r]=i,n|=e[(e[t]+e[r])%256]<<24-8*a}return this._i=t,this._j=r,n}t.RC4=r._createHelper(a);var o=n.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=r._createHelper(o)}(),e.RC4},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,a=[],i=[],o=[],c=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],a=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)f.call(this);for(r=0;r<8;r++)a[r]^=n[r+4&7];if(t){var i=t.words,o=i[0],c=i[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),u=d>>>16|4294901760&s,b=s<<16|65535&d;for(a[0]^=d,a[1]^=u,a[2]^=s,a[3]^=b,a[4]^=d,a[5]^=u,a[6]^=s,a[7]^=b,r=0;r<4;r++)f.call(this)}},_doProcessBlock:function(e,t){var r=this._X;f.call(this),a[0]=r[0]^r[5]>>>16^r[3]<<16,a[1]=r[2]^r[7]>>>16^r[5]<<16,a[2]=r[4]^r[1]>>>16^r[7]<<16,a[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),e[t+n]^=a[n]},blockSize:4,ivSize:2});function f(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],a=65535&n,c=n>>>16,f=((a*a>>>17)+a*c>>>15)+c*c,d=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=f^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=r._createHelper(c)}(),e.Rabbit},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,a=[],i=[],o=[],c=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var a=0;a<4;a++)f.call(this);for(a=0;a<8;a++)n[a]^=r[a+4&7];if(t){var i=t.words,o=i[0],c=i[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),u=d>>>16|4294901760&s,b=s<<16|65535&d;for(n[0]^=d,n[1]^=u,n[2]^=s,n[3]^=b,n[4]^=d,n[5]^=u,n[6]^=s,n[7]^=b,a=0;a<4;a++)f.call(this)}},_doProcessBlock:function(e,t){var r=this._X;f.call(this),a[0]=r[0]^r[5]>>>16^r[3]<<16,a[1]=r[2]^r[7]>>>16^r[5]<<16,a[2]=r[4]^r[1]>>>16^r[7]<<16,a[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),e[t+n]^=a[n]},blockSize:4,ivSize:2});function f(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],a=65535&n,c=n>>>16,f=((a*a>>>17)+a*c>>>15)+c*c,d=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=f^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=r._createHelper(c)}(),e.RabbitLegacy},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{f(n.next(e))}catch(e){i(e)}}function c(e){try{f(n.throw(e))}catch(e){i(e)}}function f(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}f((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var i=a(r(14)),o=r(43),c=r(22),f=r(79),d=r(353),s=r(60),u=r(190),b=r(121),h=r(191),l=function(){function e(e,t,r,n){void 0===e&&(e=new o.BN(0)),void 0===t&&(t=new o.BN(0)),void 0===r&&(r=d.KECCAK256_RLP),void 0===n&&(n=d.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=n,this._validate()}return e.fromAccountData=function(t){var r=t.nonce,n=t.balance,a=t.stateRoot,i=t.codeHash;return new e(r?new o.BN((0,s.toBuffer)(r)):void 0,n?new o.BN((0,s.toBuffer)(n)):void 0,a?(0,s.toBuffer)(a):void 0,i?(0,s.toBuffer)(i):void 0)},e.fromRlpSerializedAccount=function(e){var t=o.rlp.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},e.fromValuesArray=function(t){var r=n(t,4),a=r[0],i=r[1],c=r[2],f=r[3];return new e(new o.BN(a),new o.BN(i),c,f)},e.prototype._validate=function(){if(this.nonce.lt(new o.BN(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new o.BN(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},e.prototype.raw=function(){return[(0,h.bnToUnpaddedBuffer)(this.nonce),(0,h.bnToUnpaddedBuffer)(this.balance),this.stateRoot,this.codeHash]},e.prototype.serialize=function(){return o.rlp.encode(this.raw())},e.prototype.isContract=function(){return!this.codeHash.equals(d.KECCAK256_NULL)},e.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(d.KECCAK256_NULL)},e}();t.Account=l;t.isValidAddress=function(e){try{(0,b.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};t.toChecksumAddress=function(e,t){(0,b.assertIsHexString)(e);var r=(0,f.stripHexPrefix)(e).toLowerCase(),n="";t&&(n=(0,h.toType)(t,h.TypeOutput.BN).toString()+"0x");for(var a=(0,u.keccakFromString)(n+r).toString("hex"),i="0x",o=0;o=8?i+=r[o].toUpperCase():i+=r[o];return i};t.isValidChecksumAddress=function(e,r){return(0,t.isValidAddress)(e)&&(0,t.toChecksumAddress)(e,r)===e};t.generateAddress=function(t,r){(0,b.assertIsBuffer)(t),(0,b.assertIsBuffer)(r);var n=new o.BN(r);return n.isZero()?(0,u.rlphash)([t,null]).slice(-20):(0,u.rlphash)([t,e.from(n.toArray())]).slice(-20)};t.generateAddress2=function(t,r,n){return(0,b.assertIsBuffer)(t),(0,b.assertIsBuffer)(r),(0,b.assertIsBuffer)(n),(0,i.default)(20===t.length),(0,i.default)(32===r.length),(0,u.keccak256)(e.concat([e.from("ff","hex"),t,r,(0,u.keccak256)(n)])).slice(-20)};t.isValidPrivate=function(e){return(0,c.privateKeyVerify)(e)};t.isValidPublic=function(t,r){return void 0===r&&(r=!1),(0,b.assertIsBuffer)(t),64===t.length?(0,c.publicKeyVerify)(e.concat([e.from([4]),t])):!!r&&(0,c.publicKeyVerify)(t)};t.pubToAddress=function(t,r){return void 0===r&&(r=!1),(0,b.assertIsBuffer)(t),r&&64!==t.length&&(t=e.from((0,c.publicKeyConvert)(t,!1).slice(1))),(0,i.default)(64===t.length),(0,u.keccak)(t).slice(-20)},t.publicToAddress=t.pubToAddress;t.privateToPublic=function(t){return(0,b.assertIsBuffer)(t),e.from((0,c.publicKeyCreate)(t,!1)).slice(1)};t.privateToAddress=function(e){return(0,t.publicToAddress)((0,t.privateToPublic)(e))};t.importPublic=function(t){return(0,b.assertIsBuffer)(t),64!==t.length&&(t=e.from((0,c.publicKeyConvert)(t,!1).slice(1))),t};t.zeroAddress=function(){var e=(0,s.zeros)(20);return(0,s.bufferToHex)(e)};t.isZeroAddress=function(e){try{(0,b.assertIsString)(e)}catch(e){return!1}return(0,t.zeroAddress)()===e}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(19),a=r(827);e.exports=a((function(e){var t=n("sha256").update(e).digest();return n("sha256").update(t).digest()}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,a={};t.wordlists=a,t._default=n;try{t._default=n=r(836),a.czech=n}catch(e){}try{t._default=n=r(837),a.chinese_simplified=n}catch(e){}try{t._default=n=r(838),a.chinese_traditional=n}catch(e){}try{t._default=n=r(839),a.korean=n}catch(e){}try{t._default=n=r(840),a.french=n}catch(e){}try{t._default=n=r(841),a.italian=n}catch(e){}try{t._default=n=r(842),a.spanish=n}catch(e){}try{t._default=n=r(843),a.japanese=n,a.JA=n}catch(e){}try{t._default=n=r(844),a.portuguese=n}catch(e){}try{t._default=n=r(845),a.english=n,a.EN=n}catch(e){}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=this&&this.__decorate||function(e,t,r,a){var i,o=arguments.length,c=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,a);else for(var f=e.length-1;f>=0;f--)(i=e[f])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c};Object.defineProperty(t,"__esModule",{value:!0}),t.NativeSvr=void 0;var i=r(5),o=r(116),c=r(46),f=function(){function e(){this._event=o.createWalletEvents()}return e.prototype._subscribeToResponse=function(e,t){this._event.on("response:"+e,t)},e.prototype._subscribeToCallResponse=function(e){var t=this;return new Promise((function(r,n){t._subscribeToResponse(e,(function(e){e.errcode?n(e.errmessage||e.errcode):r(e.data)}))}))},e.prototype.handleNativeCallback=function(){for(var e=[],t=0;t0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]=0||"tuple"===e)&&y[t])return!0;return(x[t]||"payable"===t)&&p.throwArgumentError("invalid modifier","name",t),!1}function g(e,t){for(var r in t)Object(a.c)(e,r,t[r])}var w=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),_=new RegExp(/^(.*)\[([0-9]*)\]$/),M=function(){function e(t,r){b(this,e),t!==m&&p.throwError("use fromString",i.a.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),g(this,r);var n=this.type.match(_);g(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}return l(e,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json){var t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((function(t){return JSON.parse(t.format(e))}))),JSON.stringify(t)}var r="";return"array"===this.baseType?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==w.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+")"):r+=this.type,e!==w.sighash&&(!0===this.indexed&&(r+=" indexed"),e===w.full&&this.name&&(r+=" "+this.name)),r}}],[{key:"from",value:function(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}},{key:"fromObject",value:function(t){return e.isParamType(t)?t:new e(m,{name:t.name||null,type:C(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}},{key:"fromString",value:function(t,r){return function(t){return e.fromObject({name:t.name,type:t.type,indexed:t.indexed,components:t.components})}(function(e,t){var r=e;function n(t){p.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function a(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,c=0;c2&&p.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||p.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=n.a.from(r[1]),r[0]):e}function O(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((function(e){switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function T(e){var t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&p.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&p.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||p.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&p.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&p.throwArgumentError("unable to determine stateMutability","value",e),t}var P=function(e){c(r,e);var t=d(r);function r(){return b(this,r),t.apply(this,arguments)}return l(r,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});e===w.sighash&&p.throwError("cannot format a constructor for sighash",i.a.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});var t="constructor("+this.inputs.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isConstructorFragment(e))return e;"constructor"!==e.type&&p.throwArgumentError("invalid constructor object","value",e);var t=T(e);t.constant&&p.throwArgumentError("constructor cannot be constant","value",e);var a={name:null,type:e.type,inputs:e.inputs?e.inputs.map(M.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.a.from(e.gas):null};return new r(m,a)}},{key:"fromString",value:function(e){var t={type:"constructor"},n=(e=E(e,t)).match(N);return n&&"constructor"===n[1].trim()||p.throwArgumentError("invalid constructor string","value",e),t.inputs=k(n[2].trim(),!1),O(n[3].trim(),t),r.fromObject(t)}},{key:"isConstructorFragment",value:function(e){return e&&e._isFragment&&"constructor"===e.type}}]),r}(S),j=function(e){c(r,e);var t=d(r);function r(){return b(this,r),t.apply(this,arguments)}return l(r,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))})),outputs:this.outputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==w.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+") ",e!==w.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((function(t){return t.format(e)})).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isFunctionFragment(e))return e;"function"!==e.type&&p.throwArgumentError("invalid function object","value",e);var t=T(e),a={type:e.type,name:L(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(M.fromObject):[],outputs:e.outputs?e.outputs.map(M.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.a.from(e.gas):null};return new r(m,a)}},{key:"fromString",value:function(e){var t={type:"function"},n=(e=E(e,t)).split(" returns ");n.length>2&&p.throwArgumentError("invalid function string","value",e);var a=n[0].match(N);if(a||p.throwArgumentError("invalid function signature","value",e),t.name=a[1].trim(),t.name&&L(t.name),t.inputs=k(a[2],!1),O(a[3].trim(),t),n.length>1){var i=n[1].match(N);""==i[1].trim()&&""==i[3].trim()||p.throwArgumentError("unexpected tokens","value",e),t.outputs=k(i[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(P);function B(e){var t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||p.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}var R=function(e){c(r,e);var t=d(r);function r(){return b(this,r),t.apply(this,arguments)}return l(r,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==w.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+") ").trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isErrorFragment(e))return e;"error"!==e.type&&p.throwArgumentError("invalid error object","value",e);var t={type:e.type,name:L(e.name),inputs:e.inputs?e.inputs.map(M.fromObject):[]};return B(new r(m,t))}},{key:"fromString",value:function(e){var t={type:"error"},n=e.match(N);return n||p.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&L(t.name),t.inputs=k(n[2],!1),B(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(S);function C(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var I=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function L(e){return e&&e.match(I)||p.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}var N=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");var U=r(1);function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var r=0;rthis.wordSize&&H.throwError("value out-of-bounds",i.a.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Object(U.b)([this._padding.slice(t.length%this.wordSize),t])),t}},{key:"writeValue",value:function(e){return this._writeData(this._getValue(e))}},{key:"writeUpdatableValue",value:function(){var e=this,t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,function(r){e._data[t]=e._getValue(r)}}}]),e}(),W=function(){function e(t,r,n,i){z(this,e),Object(a.c)(this,"_data",Object(U.a)(t)),Object(a.c)(this,"wordSize",r||32),Object(a.c)(this,"_coerceFunc",n),Object(a.c)(this,"allowLoose",i),this._offset=0}return D(e,[{key:"data",get:function(){return Object(U.g)(this._data)}},{key:"consumed",get:function(){return this._offset}},{key:"coerce",value:function(t,r){return this._coerceFunc?this._coerceFunc(t,r):e.coerce(t,r)}},{key:"_peekBytes",value:function(e,t,r){var n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:H.throwError("data out-of-bounds",i.a.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}},{key:"subReader",value:function(t){return new e(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}},{key:"readBytes",value:function(e,t){var r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}},{key:"readValue",value:function(){return n.a.from(this.readBytes(this.wordSize))}}],[{key:"coerce",value:function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}}]),e}(),V=r(33);function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function J(e,t){for(var r=0;r=0?t:"")+"]",c=-1===t||e.dynamic;return(n=a.call(this,"array",i,r,c)).coder=e,n.length=t,n}return t=o,(r=[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;re._data.length&&le.throwError("insufficient data length",i.a.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});for(var r=[],n=0;n>6==2;o++)i++;return i}return e===ot.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(it||(it={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(ot||(ot={}));var st=Object.freeze({error:function(e,t,r,n,a){return ft.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:dt,replace:function(e,t,r,n,a){return e===ot.OVERLONG?(n.push(a),0):(n.push(65533),dt(e,t,r))}});function ut(e,t){null==t&&(t=st.error),e=Object(U.a)(e);for(var r=[],n=0;n>7!=0){var i=null,o=null;if(192==(224&a))i=1,o=127;else if(224==(240&a))i=2,o=2047;else{if(240!=(248&a)){n+=t(128==(192&a)?ot.UNEXPECTED_CONTINUE:ot.BAD_PREFIX,n-1,e,r);continue}i=3,o=65535}if(n-1+i>=e.length)n+=t(ot.OVERRUN,n-1,e,r);else{for(var c=a&(1<<8-i-1)-1,f=0;f1114111?n+=t(ot.OUT_OF_RANGE,n-1-i,e,r,c):c>=55296&&c<=57343?n+=t(ot.UTF16_SURROGATE,n-1-i,e,r,c):c<=o?n+=t(ot.OVERLONG,n-1-i,e,r,c):r.push(c))}}else r.push(a)}return r}function bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it.current;t!=it.current&&(ft.checkNormalize(),e=e.normalize(t));for(var r=[],n=0;n>6|192),r.push(63&a|128);else if(55296==(64512&a)){n++;var i=e.charCodeAt(n);if(n>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");var o=65536+((1023&a)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(a>>12|224),r.push(a>>6&63|128),r.push(63&a|128)}return Object(U.a)(r)}function ht(e,t){return ut(e,t).map((function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))})).join("")}function lt(e){return(lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pt(e,t){for(var r=0;r256||n%8!=0)&&jt.throwArgumentError("invalid "+r[1]+" bit length","param",e),new ct(n/8,"int"===r[1],e.name)}if(r=e.type.match(Bt)){var a=parseInt(r[1]);return(0===a||a>32)&&jt.throwArgumentError("invalid bytes length","param",e),new Ke(a,e.name)}return jt.throwArgumentError("invalid type","type",e.type)}},{key:"_getWordSize",value:function(){return 32}},{key:"_getReader",value:function(e,t){return new W(e,this._getWordSize(),this.coerceFunc,t)}},{key:"_getWriter",value:function(){return new G(this._getWordSize())}},{key:"getDefaultValue",value:function(e){var t=this,r=e.map((function(e){return t._getCoder(M.from(e))}));return new Tt(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&jt.throwError("types/values length mismatch",i.a.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var n=e.map((function(e){return r._getCoder(M.from(e))})),a=new Tt(n,"_"),o=this._getWriter();return a.encode(o,t),o.data}},{key:"decode",value:function(e,t,r){var n=this,a=e.map((function(e){return n._getCoder(M.from(e))}));return new Tt(a,"_").decode(this._getReader(Object(U.a)(t),r))}}])&&Pt(t.prototype,r),n&&Pt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),It=new Ct,Lt=r(20);function Nt(e){return Object(Lt.a)(bt(e))}function Ut(e){return(Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zt(e,t){for(var r=0;r1&&Vt.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var a=this.functions[j.fromString(e).format()];return a||Vt.throwArgumentError("no matching function","signature",e),a}},{key:"getEvent",value:function(e){if(Object(U.j)(e)){var t=e.toLowerCase();for(var r in this.events)if(t===this.getEventTopic(r))return this.events[r];Vt.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),a=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===a.length?Vt.throwArgumentError("no matching event","name",n):a.length>1&&Vt.throwArgumentError("multiple matching events","name",n),this.events[a[0]]}var i=this.events[A.fromString(e).format()];return i||Vt.throwArgumentError("no matching event","signature",e),i}},{key:"getError",value:function(e){if(Object(U.j)(e)){var t=Object(a.d)(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Vt.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),i=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===i.length?Vt.throwArgumentError("no matching error","name",n):i.length>1&&Vt.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}var o=this.errors[j.fromString(e).format()];return o||Vt.throwArgumentError("no matching error","signature",e),o}},{key:"getSighash",value:function(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return Object(a.d)(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"==typeof e&&(e=this.getEvent(e)),Object(a.d)(this.constructor,"getEventTopic")(e)}},{key:"_decodeParams",value:function(e,t){return this._abiCoder.decode(e,t)}},{key:"_encodeParams",value:function(e,t){return this._abiCoder.encode(e,t)}},{key:"encodeDeploy",value:function(e){return this._encodeParams(this.deploy.inputs,e||[])}},{key:"decodeErrorResult",value:function(e,t){"string"==typeof e&&(e=this.getError(e));var r=Object(U.a)(t);return Object(U.g)(r.slice(0,4))!==this.getSighash(e)&&Vt.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",Object(U.g)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeErrorResult",value:function(e,t){return"string"==typeof e&&(e=this.getError(e)),Object(U.g)(Object(U.b)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionData",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=Object(U.a)(t);return Object(U.g)(r.slice(0,4))!==this.getSighash(e)&&Vt.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",Object(U.g)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeFunctionData",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Object(U.g)(Object(U.b)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionResult",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=Object(U.a)(t),n=null,a="",o=null,c=null,f=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(u){}break;case 4:var d=Object(U.g)(r.slice(0,4)),s=$t[d];if(s)o=this._abiCoder.decode(s.inputs,r.slice(4)),c=s.name,f=s.signature,s.reason&&(n=o[0]),"Error"===c?a="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(o[0])):"Panic"===c&&(a="; VM Exception while processing transaction: reverted with panic code ".concat(o[0]));else try{var u=this.getError(d);o=this._abiCoder.decode(u.inputs,r.slice(4)),c=u.name,f=u.format()}catch(u){}}return Vt.throwError("call revert exception"+a,i.a.errors.CALL_EXCEPTION,{method:e.format(),data:Object(U.g)(t),errorArgs:o,errorName:c,errorSignature:f,reason:n})}},{key:"encodeFunctionResult",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Object(U.g)(this._abiCoder.encode(e.outputs,t||[]))}},{key:"encodeFilterTopics",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Vt.throwError("too many arguments for "+e.format(),i.a.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var a=[];e.anonymous||a.push(this.getEventTopic(e));var o=function(e,t){return"string"===e.type?Nt(t):"bytes"===e.type?Object(Lt.a)(Object(U.g)(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=n.a.from(t).toHexString()),"address"===e.type&&r._abiCoder.encode(["address"],[t]),Object(U.f)(Object(U.g)(t),32))};for(t.forEach((function(t,r){var n=e.inputs[r];n.indexed?null==t?a.push(null):"array"===n.baseType||"tuple"===n.baseType?Vt.throwArgumentError("filtering with tuples or arrays not supported","contract."+n.name,t):Array.isArray(t)?a.push(t.map((function(e){return o(n,e)}))):a.push(o(n,t)):null!=t&&Vt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+n.name,t)}));a.length&&null===a[a.length-1];)a.pop();return a}},{key:"encodeEventLog",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e));var n=[],a=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Vt.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,o){var c=t[o];if(e.indexed)if("string"===e.type)n.push(Nt(c));else if("bytes"===e.type)n.push(Object(Lt.a)(c));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[c]))}else a.push(e),i.push(c)})),{data:this._abiCoder.encode(a,i),topics:n}}},{key:"decodeEventLog",value:function(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);Object(U.j)(r[0],32)&&r[0].toLowerCase()===n||Vt.throwError("fragment/topic mismatch",i.a.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var a=[],o=[],c=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(a.push(M.fromObject({type:"bytes32",name:e.name})),c.push(!0)):(a.push(e),c.push(!1)):(o.push(e),c.push(!1))}));var f=null!=r?this._abiCoder.decode(a,Object(U.b)(r)):null,d=this._abiCoder.decode(o,t,!0),s=[],u=0,b=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==f)s[t]=new Yt({_isIndexed:!0,hash:null});else if(c[t])s[t]=new Yt({_isIndexed:!0,hash:f[b++]});else try{s[t]=f[b++]}catch(e){s[t]=e}else try{s[t]=d[u++]}catch(e){s[t]=e}if(e.name&&null==s[e.name]){var r=s[t];r instanceof Error?Object.defineProperty(s,e.name,{enumerable:!0,get:function(){throw Qt("property ".concat(JSON.stringify(e.name)),r)}}):s[e.name]=r}}));for(var h=function(e){var t=s[e];t instanceof Error&&Object.defineProperty(s,e,{enumerable:!0,get:function(){throw Qt("index ".concat(e),t)}})},l=0;l=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void a(!1,"Invalid character in "+e)}function d(e,t,r){var n=f(e,r);return r-1>=t&&(n|=f(e,r-1)<<4),n}function s(e,t,r,n){for(var i=0,o=0,c=Math.min(e.length,r),f=t;f=49?d-49+10:d>=17?d-17+10:d,a(d>=0&&o0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,r,n){if("number"==typeof e)return this._initNumber(e,r,n);if("object"===t(e))return this._initArray(e,r,n);"hex"===r&&(r=16),a(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);else if("le"===r)for(n=0,i=0;n>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)a=d(e,t,n)<=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=t)n++;n--,a=a/t|0;for(var i=e.length-r,o=i%n,c=Math.min(i,i-o)+r,f=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=b}catch(e){o.prototype.inspect=b}else o.prototype.inspect=b;function b(){return(this.red?""}var h=["","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"],l=[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],p=[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];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==i||o!==this.length-1?h[6-f.length]+f+r:f+r}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],s=p[e];r="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(s).toString(e);r=(u=u.idivn(s)).isZero()?b+r:h[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}a(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},c&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var a=0|e.words[0],i=0|t.words[0],o=a*i,c=67108863&o,f=o/67108864|0;r.words[0]=c;for(var d=1;d>>26,u=67108863&f,b=Math.min(d,t.length-1),h=Math.max(0,d-e.length+1);h<=b;h++){var l=d-h|0;s+=(o=(a=0|e.words[l])*(i=0|t.words[h])+u)/67108864|0,u=67108863&o}r.words[d]=0|u,f=0|s}return 0!==f?r.words[d]=0|f:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),i=r||Math.max(1,n);a(n<=i,"byte array longer than desired length"),a(i>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,a=0,i=0;a>8&255),r>16&255),6===i?(r>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===i?(r>=0&&(e[r--]=o>>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){a("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){a("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,a=this.cmp(e);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,h=0|o[1],l=8191&h,p=h>>>13,m=0|o[2],x=8191&m,y=m>>>13,v=0|o[3],g=8191&v,w=v>>>13,_=0|o[4],M=8191&_,k=_>>>13,S=0|o[5],A=8191&S,E=S>>>13,O=0|o[6],T=8191&O,P=O>>>13,j=0|o[7],B=8191&j,R=j>>>13,C=0|o[8],I=8191&C,L=C>>>13,N=0|o[9],U=8191&N,z=N>>>13,F=0|c[0],D=8191&F,H=F>>>13,q=0|c[1],K=8191&q,G=q>>>13,W=0|c[2],V=8191&W,Z=W>>>13,J=0|c[3],X=8191&J,Y=J>>>13,$=0|c[4],Q=8191&$,ee=$>>>13,te=0|c[5],re=8191&te,ne=te>>>13,ae=0|c[6],ie=8191&ae,oe=ae>>>13,ce=0|c[7],fe=8191&ce,de=ce>>>13,se=0|c[8],ue=8191&se,be=se>>>13,he=0|c[9],le=8191&he,pe=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(d+(n=Math.imul(u,D))|0)+((8191&(a=(a=Math.imul(u,H))+Math.imul(b,D)|0))<<13)|0;d=((i=Math.imul(b,H))+(a>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(l,D),a=(a=Math.imul(l,H))+Math.imul(p,D)|0,i=Math.imul(p,H);var xe=(d+(n=n+Math.imul(u,K)|0)|0)+((8191&(a=(a=a+Math.imul(u,G)|0)+Math.imul(b,K)|0))<<13)|0;d=((i=i+Math.imul(b,G)|0)+(a>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(x,D),a=(a=Math.imul(x,H))+Math.imul(y,D)|0,i=Math.imul(y,H),n=n+Math.imul(l,K)|0,a=(a=a+Math.imul(l,G)|0)+Math.imul(p,K)|0,i=i+Math.imul(p,G)|0;var ye=(d+(n=n+Math.imul(u,V)|0)|0)+((8191&(a=(a=a+Math.imul(u,Z)|0)+Math.imul(b,V)|0))<<13)|0;d=((i=i+Math.imul(b,Z)|0)+(a>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(g,D),a=(a=Math.imul(g,H))+Math.imul(w,D)|0,i=Math.imul(w,H),n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,G)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(l,V)|0,a=(a=a+Math.imul(l,Z)|0)+Math.imul(p,V)|0,i=i+Math.imul(p,Z)|0;var ve=(d+(n=n+Math.imul(u,X)|0)|0)+((8191&(a=(a=a+Math.imul(u,Y)|0)+Math.imul(b,X)|0))<<13)|0;d=((i=i+Math.imul(b,Y)|0)+(a>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(M,D),a=(a=Math.imul(M,H))+Math.imul(k,D)|0,i=Math.imul(k,H),n=n+Math.imul(g,K)|0,a=(a=a+Math.imul(g,G)|0)+Math.imul(w,K)|0,i=i+Math.imul(w,G)|0,n=n+Math.imul(x,V)|0,a=(a=a+Math.imul(x,Z)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,Z)|0,n=n+Math.imul(l,X)|0,a=(a=a+Math.imul(l,Y)|0)+Math.imul(p,X)|0,i=i+Math.imul(p,Y)|0;var ge=(d+(n=n+Math.imul(u,Q)|0)|0)+((8191&(a=(a=a+Math.imul(u,ee)|0)+Math.imul(b,Q)|0))<<13)|0;d=((i=i+Math.imul(b,ee)|0)+(a>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,D),a=(a=Math.imul(A,H))+Math.imul(E,D)|0,i=Math.imul(E,H),n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,G)|0)+Math.imul(k,K)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(g,V)|0,a=(a=a+Math.imul(g,Z)|0)+Math.imul(w,V)|0,i=i+Math.imul(w,Z)|0,n=n+Math.imul(x,X)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(l,Q)|0,a=(a=a+Math.imul(l,ee)|0)+Math.imul(p,Q)|0,i=i+Math.imul(p,ee)|0;var we=(d+(n=n+Math.imul(u,re)|0)|0)+((8191&(a=(a=a+Math.imul(u,ne)|0)+Math.imul(b,re)|0))<<13)|0;d=((i=i+Math.imul(b,ne)|0)+(a>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,D),a=(a=Math.imul(T,H))+Math.imul(P,D)|0,i=Math.imul(P,H),n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,G)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,G)|0,n=n+Math.imul(M,V)|0,a=(a=a+Math.imul(M,Z)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,Z)|0,n=n+Math.imul(g,X)|0,a=(a=a+Math.imul(g,Y)|0)+Math.imul(w,X)|0,i=i+Math.imul(w,Y)|0,n=n+Math.imul(x,Q)|0,a=(a=a+Math.imul(x,ee)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(l,re)|0,a=(a=a+Math.imul(l,ne)|0)+Math.imul(p,re)|0,i=i+Math.imul(p,ne)|0;var _e=(d+(n=n+Math.imul(u,ie)|0)|0)+((8191&(a=(a=a+Math.imul(u,oe)|0)+Math.imul(b,ie)|0))<<13)|0;d=((i=i+Math.imul(b,oe)|0)+(a>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(B,D),a=(a=Math.imul(B,H))+Math.imul(R,D)|0,i=Math.imul(R,H),n=n+Math.imul(T,K)|0,a=(a=a+Math.imul(T,G)|0)+Math.imul(P,K)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(A,V)|0,a=(a=a+Math.imul(A,Z)|0)+Math.imul(E,V)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(M,X)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(k,X)|0,i=i+Math.imul(k,Y)|0,n=n+Math.imul(g,Q)|0,a=(a=a+Math.imul(g,ee)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,ee)|0,n=n+Math.imul(x,re)|0,a=(a=a+Math.imul(x,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(l,ie)|0,a=(a=a+Math.imul(l,oe)|0)+Math.imul(p,ie)|0,i=i+Math.imul(p,oe)|0;var Me=(d+(n=n+Math.imul(u,fe)|0)|0)+((8191&(a=(a=a+Math.imul(u,de)|0)+Math.imul(b,fe)|0))<<13)|0;d=((i=i+Math.imul(b,de)|0)+(a>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,D),a=(a=Math.imul(I,H))+Math.imul(L,D)|0,i=Math.imul(L,H),n=n+Math.imul(B,K)|0,a=(a=a+Math.imul(B,G)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(T,V)|0,a=(a=a+Math.imul(T,Z)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(A,X)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,a=(a=a+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(g,re)|0,a=(a=a+Math.imul(g,ne)|0)+Math.imul(w,re)|0,i=i+Math.imul(w,ne)|0,n=n+Math.imul(x,ie)|0,a=(a=a+Math.imul(x,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(l,fe)|0,a=(a=a+Math.imul(l,de)|0)+Math.imul(p,fe)|0,i=i+Math.imul(p,de)|0;var ke=(d+(n=n+Math.imul(u,ue)|0)|0)+((8191&(a=(a=a+Math.imul(u,be)|0)+Math.imul(b,ue)|0))<<13)|0;d=((i=i+Math.imul(b,be)|0)+(a>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,D),a=(a=Math.imul(U,H))+Math.imul(z,D)|0,i=Math.imul(z,H),n=n+Math.imul(I,K)|0,a=(a=a+Math.imul(I,G)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,G)|0,n=n+Math.imul(B,V)|0,a=(a=a+Math.imul(B,Z)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(T,X)|0,a=(a=a+Math.imul(T,Y)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(A,Q)|0,a=(a=a+Math.imul(A,ee)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(M,re)|0,a=(a=a+Math.imul(M,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(g,ie)|0,a=(a=a+Math.imul(g,oe)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,oe)|0,n=n+Math.imul(x,fe)|0,a=(a=a+Math.imul(x,de)|0)+Math.imul(y,fe)|0,i=i+Math.imul(y,de)|0,n=n+Math.imul(l,ue)|0,a=(a=a+Math.imul(l,be)|0)+Math.imul(p,ue)|0,i=i+Math.imul(p,be)|0;var Se=(d+(n=n+Math.imul(u,le)|0)|0)+((8191&(a=(a=a+Math.imul(u,pe)|0)+Math.imul(b,le)|0))<<13)|0;d=((i=i+Math.imul(b,pe)|0)+(a>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,K),a=(a=Math.imul(U,G))+Math.imul(z,K)|0,i=Math.imul(z,G),n=n+Math.imul(I,V)|0,a=(a=a+Math.imul(I,Z)|0)+Math.imul(L,V)|0,i=i+Math.imul(L,Z)|0,n=n+Math.imul(B,X)|0,a=(a=a+Math.imul(B,Y)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(T,Q)|0,a=(a=a+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(A,re)|0,a=(a=a+Math.imul(A,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(M,ie)|0,a=(a=a+Math.imul(M,oe)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,oe)|0,n=n+Math.imul(g,fe)|0,a=(a=a+Math.imul(g,de)|0)+Math.imul(w,fe)|0,i=i+Math.imul(w,de)|0,n=n+Math.imul(x,ue)|0,a=(a=a+Math.imul(x,be)|0)+Math.imul(y,ue)|0,i=i+Math.imul(y,be)|0;var Ae=(d+(n=n+Math.imul(l,le)|0)|0)+((8191&(a=(a=a+Math.imul(l,pe)|0)+Math.imul(p,le)|0))<<13)|0;d=((i=i+Math.imul(p,pe)|0)+(a>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,V),a=(a=Math.imul(U,Z))+Math.imul(z,V)|0,i=Math.imul(z,Z),n=n+Math.imul(I,X)|0,a=(a=a+Math.imul(I,Y)|0)+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(B,Q)|0,a=(a=a+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,a=(a=a+Math.imul(T,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(A,ie)|0,a=(a=a+Math.imul(A,oe)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,oe)|0,n=n+Math.imul(M,fe)|0,a=(a=a+Math.imul(M,de)|0)+Math.imul(k,fe)|0,i=i+Math.imul(k,de)|0,n=n+Math.imul(g,ue)|0,a=(a=a+Math.imul(g,be)|0)+Math.imul(w,ue)|0,i=i+Math.imul(w,be)|0;var Ee=(d+(n=n+Math.imul(x,le)|0)|0)+((8191&(a=(a=a+Math.imul(x,pe)|0)+Math.imul(y,le)|0))<<13)|0;d=((i=i+Math.imul(y,pe)|0)+(a>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,X),a=(a=Math.imul(U,Y))+Math.imul(z,X)|0,i=Math.imul(z,Y),n=n+Math.imul(I,Q)|0,a=(a=a+Math.imul(I,ee)|0)+Math.imul(L,Q)|0,i=i+Math.imul(L,ee)|0,n=n+Math.imul(B,re)|0,a=(a=a+Math.imul(B,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(T,ie)|0,a=(a=a+Math.imul(T,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(A,fe)|0,a=(a=a+Math.imul(A,de)|0)+Math.imul(E,fe)|0,i=i+Math.imul(E,de)|0,n=n+Math.imul(M,ue)|0,a=(a=a+Math.imul(M,be)|0)+Math.imul(k,ue)|0,i=i+Math.imul(k,be)|0;var Oe=(d+(n=n+Math.imul(g,le)|0)|0)+((8191&(a=(a=a+Math.imul(g,pe)|0)+Math.imul(w,le)|0))<<13)|0;d=((i=i+Math.imul(w,pe)|0)+(a>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,Q),a=(a=Math.imul(U,ee))+Math.imul(z,Q)|0,i=Math.imul(z,ee),n=n+Math.imul(I,re)|0,a=(a=a+Math.imul(I,ne)|0)+Math.imul(L,re)|0,i=i+Math.imul(L,ne)|0,n=n+Math.imul(B,ie)|0,a=(a=a+Math.imul(B,oe)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,oe)|0,n=n+Math.imul(T,fe)|0,a=(a=a+Math.imul(T,de)|0)+Math.imul(P,fe)|0,i=i+Math.imul(P,de)|0,n=n+Math.imul(A,ue)|0,a=(a=a+Math.imul(A,be)|0)+Math.imul(E,ue)|0,i=i+Math.imul(E,be)|0;var Te=(d+(n=n+Math.imul(M,le)|0)|0)+((8191&(a=(a=a+Math.imul(M,pe)|0)+Math.imul(k,le)|0))<<13)|0;d=((i=i+Math.imul(k,pe)|0)+(a>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),a=(a=Math.imul(U,ne))+Math.imul(z,re)|0,i=Math.imul(z,ne),n=n+Math.imul(I,ie)|0,a=(a=a+Math.imul(I,oe)|0)+Math.imul(L,ie)|0,i=i+Math.imul(L,oe)|0,n=n+Math.imul(B,fe)|0,a=(a=a+Math.imul(B,de)|0)+Math.imul(R,fe)|0,i=i+Math.imul(R,de)|0,n=n+Math.imul(T,ue)|0,a=(a=a+Math.imul(T,be)|0)+Math.imul(P,ue)|0,i=i+Math.imul(P,be)|0;var Pe=(d+(n=n+Math.imul(A,le)|0)|0)+((8191&(a=(a=a+Math.imul(A,pe)|0)+Math.imul(E,le)|0))<<13)|0;d=((i=i+Math.imul(E,pe)|0)+(a>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,ie),a=(a=Math.imul(U,oe))+Math.imul(z,ie)|0,i=Math.imul(z,oe),n=n+Math.imul(I,fe)|0,a=(a=a+Math.imul(I,de)|0)+Math.imul(L,fe)|0,i=i+Math.imul(L,de)|0,n=n+Math.imul(B,ue)|0,a=(a=a+Math.imul(B,be)|0)+Math.imul(R,ue)|0,i=i+Math.imul(R,be)|0;var je=(d+(n=n+Math.imul(T,le)|0)|0)+((8191&(a=(a=a+Math.imul(T,pe)|0)+Math.imul(P,le)|0))<<13)|0;d=((i=i+Math.imul(P,pe)|0)+(a>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,fe),a=(a=Math.imul(U,de))+Math.imul(z,fe)|0,i=Math.imul(z,de),n=n+Math.imul(I,ue)|0,a=(a=a+Math.imul(I,be)|0)+Math.imul(L,ue)|0,i=i+Math.imul(L,be)|0;var Be=(d+(n=n+Math.imul(B,le)|0)|0)+((8191&(a=(a=a+Math.imul(B,pe)|0)+Math.imul(R,le)|0))<<13)|0;d=((i=i+Math.imul(R,pe)|0)+(a>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,ue),a=(a=Math.imul(U,be))+Math.imul(z,ue)|0,i=Math.imul(z,be);var Re=(d+(n=n+Math.imul(I,le)|0)|0)+((8191&(a=(a=a+Math.imul(I,pe)|0)+Math.imul(L,le)|0))<<13)|0;d=((i=i+Math.imul(L,pe)|0)+(a>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(d+(n=Math.imul(U,le))|0)+((8191&(a=(a=Math.imul(U,pe))+Math.imul(z,le)|0))<<13)|0;return d=((i=Math.imul(z,pe))+(a>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f[0]=me,f[1]=xe,f[2]=ye,f[3]=ve,f[4]=ge,f[5]=we,f[6]=_e,f[7]=Me,f[8]=ke,f[9]=Se,f[10]=Ae,f[11]=Ee,f[12]=Oe,f[13]=Te,f[14]=Pe,f[15]=je,f[16]=Be,f[17]=Re,f[18]=Ce,0!==d&&(f[19]=d,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=c,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r._strip()}function v(e,t,r){return y(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(x=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):r<63?m(this,e,t):r<1024?y(this,e,t):v(this,e,t)},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,r+=i/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>a&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,n=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),c=67108863^67108863>>>i<o)for(this.length-=o,d=0;d=0&&(0!==s||d>=n);d--){var u=0|this.words[d];this.words[d]=s<<26-i|u>>>i,s=u&c}return f&&0!==s&&(f.words[f.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return a(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){a("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<=0);var t=e%26,r=(e-t)/26;if(a(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(a("number"==typeof e),a(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===c)return this._strip();for(a(-1===c),c=0,n=0;n>26,this.words[n]=67108863&i;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,i=0|a.words[a.length-1];0!==(r=26-this._countBits(i))&&(a=a.ushln(r),n.iushln(r),i=0|a.words[a.length-1]);var c,f=n.length-a.length;if("mod"!==t){(c=new o(null)).length=f+1,c.words=new Array(c.length);for(var d=0;d=0;u--){var b=67108864*(0|n.words[a.length+u])+(0|n.words[a.length+u-1]);for(b=Math.min(b/i|0,67108863),n._ishlnsubmul(a,b,u);0!==n.negative;)b--,n.negative=0,n._ishlnsubmul(a,1,u),n.isZero()||(n.negative^=1);c&&(c.words[u]=b)}return c&&c._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:c||null,mod:n}},o.prototype.divmod=function(e,t,r){return a(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(c=this.neg().divmod(e,t),"mod"!==t&&(n=c.div.neg()),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:n,mod:i}):0===this.negative&&0!==e.negative?(c=this.divmod(e.neg(),t),"mod"!==t&&(n=c.div.neg()),{div:n,mod:c.mod}):0!=(this.negative&e.negative)?(c=this.neg().divmod(e.neg(),t),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:c.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,i,c},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),a=e.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(r*n+(0|this.words[i]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*r;this.words[n]=i/e|0,r=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),i=new o(0),c=new o(0),f=new o(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var s=r.clone(),u=t.clone();!t.isZero();){for(var b=0,h=1;0==(t.words[0]&h)&&b<26;++b,h<<=1);if(b>0)for(t.iushrn(b);b-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(s),i.isub(u)),n.iushrn(1),i.iushrn(1);for(var l=0,p=1;0==(r.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(u)),c.iushrn(1),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(c),i.isub(f)):(r.isub(t),c.isub(n),f.isub(i))}return{a:c,b:f,gcd:r.iushln(d)}},o.prototype._invmp=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,i=new o(1),c=new o(0),f=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,s=1;0==(t.words[0]&s)&&d<26;++d,s<<=1);if(d>0)for(t.iushrn(d);d-- >0;)i.isOdd()&&i.iadd(f),i.iushrn(1);for(var u=0,b=1;0==(r.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(r.iushrn(u);u-- >0;)c.isOdd()&&c.iadd(f),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(c)):(r.isub(t),c.isub(i))}return(n=0===t.cmpn(1)?i:c).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=t.cmp(r);if(a<0){var i=t;t=r,r=i}else if(0===a||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){a("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,c&=67108863,this.words[o]=c}return 0!==i&&(this.words[o]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),a(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|e.words[r];if(n!==a){na&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new E(e)},o.prototype.toRed=function(e){return a(!this.red,"Already a number in reduction context"),a(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return a(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return a(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else a(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},i(M,_),M.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,a=i}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},M.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=a,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new M;else if("p224"===e)t=new k;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return w[e]=t,t},E.prototype._verify1=function(e){a(0===e.negative,"red works only with positives"),a(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){a(0==(e.negative|t.negative),"red works only with positives"),a(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(a(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);a(!n.isZero());var c=new o(1).toRed(this),f=c.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);0!==this.pow(s,d).cmp(f);)s.redIAdd(f);for(var u=this.pow(s,n),b=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),l=i;0!==h.cmp(c);){for(var p=h,m=0;0!==p.cmp(c);m++)p=p.redSqr();a(m=0;n--){for(var d=t.words[n],s=f-1;s>=0;s--){var u=d>>s&1;a!==r[0]&&(a=this.sqr(a)),0!==u||0!==i?(i<<=1,i|=u,(4===++c||0===n&&0===s)&&(a=this.mul(a,r[i]),c=0,i=0)):c=0}f=26}return a},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,E),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(15)(e))},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return q}));var n=r(8),a=r.n(n),i=r(26),o=r.n(i);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e||"undefined"!=typeof self&&self;function f(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var d=s;function s(e,t){if(!e)throw new Error(t||"Assertion failed")}s.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var u=f((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function a(e){for(var t="",r=0;r>8,o=255&a;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=a,r.encode=function(e,t){return"hex"===t?a(e):e}})),b=f((function(e,t){var r=t;r.assert=d,r.toArray=u.toArray,r.zero2=u.zero2,r.toHex=u.toHex,r.encode=u.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var a=1<(a>>1)-1?(a>>1)-f:f,i.isubn(c)):c=0,n[o]=c,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,a=0,i=0;e.cmpn(-a)>0||t.cmpn(-i)>0;){var o,c,f=e.andln(3)+a&3,d=t.andln(3)+i&3;3===f&&(f=-1),3===d&&(d=-1),o=0==(1&f)?0:3!==(n=e.andln(7)+a&7)&&5!==n||2!==d?f:-f,r[0].push(o),c=0==(1&d)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==f?d:-d,r[1].push(c),2*a===o+1&&(a=1-a),2*i===c+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new a.a(e,"hex","le")}})),h=b.getNAF,l=b.getJSF,p=b.assert;function m(e,t){this.type=e,this.p=new a.a(t.p,16),this.red=t.prime?a.a.red(t.prime):a.a.mont(this.p),this.zero=new a.a(0).toRed(this.red),this.one=new a.a(1).toRed(this.red),this.two=new a.a(2).toRed(this.red),this.n=t.n&&new a.a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var x=m;function y(e,t){this.curve=e,this.type=t,this.precomputed=null}m.prototype.point=function(){throw new Error("Not implemented")},m.prototype.validate=function(){throw new Error("Not implemented")},m.prototype._fixedNafMul=function(e,t){p(e.precomputed);var r=e._getDoubles(),n=h(t,1,this._bitLength),a=(1<=i;f--)o=(o<<1)+n[f];c.push(o)}for(var d=this.jpoint(null,null,null),s=this.jpoint(null,null,null),u=a;u>0;u--){for(i=0;i=0;c--){for(var f=0;c>=0&&0===i[c];c--)f++;if(c>=0&&f++,o=o.dblp(f),c<0)break;var d=i[c];p(0!==d),o="affine"===e.type?d>0?o.mixedAdd(a[d-1>>1]):o.mixedAdd(a[-d-1>>1].neg()):d>0?o.add(a[d-1>>1]):o.add(a[-d-1>>1].neg())}return"affine"===e.type?o.toP():o},m.prototype._wnafMulAdd=function(e,t,r,n,a){var i,o,c,f=this._wnafT1,d=this._wnafT2,s=this._wnafT3,u=0;for(i=0;i=1;i-=2){var p=i-1,m=i;if(1===f[p]&&1===f[m]){var x=[t[p],null,null,t[m]];0===t[p].y.cmp(t[m].y)?(x[1]=t[p].add(t[m]),x[2]=t[p].toJ().mixedAdd(t[m].neg())):0===t[p].y.cmp(t[m].y.redNeg())?(x[1]=t[p].toJ().mixedAdd(t[m]),x[2]=t[p].add(t[m].neg())):(x[1]=t[p].toJ().mixedAdd(t[m]),x[2]=t[p].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=l(r[p],r[m]);for(u=Math.max(v[0].length,u),s[p]=new Array(u),s[m]=new Array(u),o=0;o=0;i--){for(var k=0;i>=0;){var S=!0;for(o=0;o=0&&k++,_=_.dblp(k),i<0)break;for(o=0;o0?c=d[o][A-1>>1]:A<0&&(c=d[o][-A-1>>1].neg()),_="affine"===c.type?_.mixedAdd(c):_.add(c))}}for(i=0;i=Math.ceil((e.bitLength()+1)/t.step)},y.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,a=0;a=0&&(o=t,c=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),c=c.neg()),[{a:n,b:i},{a:o,b:c}]},w.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),o=a.mul(r.a),c=i.mul(n.a),f=a.mul(r.b),d=i.mul(n.b);return{k1:e.sub(o).sub(c),k2:f.add(d).neg()}},w.prototype.pointFromX=function(e,t){(e=new a.a(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},w.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(a).cmpn(0)},w.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,a=this._endoWnafT2,i=0;i":""},M.prototype.isInfinity=function(){return this.inf},M.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},M.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),a=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=a.redSqr().redISub(this.x.redAdd(this.x)),o=a.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,o)},M.prototype.getX=function(){return this.x.fromRed()},M.prototype.getY=function(){return this.y.fromRed()},M.prototype.mul=function(e){return e=new a.a(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},M.prototype.mulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)},M.prototype.jmulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)},M.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},M.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},M.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},v(k,x.BasePoint),w.prototype.jpoint=function(e,t,r){return new k(this,e,t,r)},k.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},k.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},k.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),a=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),c=n.redSub(a),f=i.redSub(o);if(0===c.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=c.redSqr(),s=d.redMul(c),u=n.redMul(d),b=f.redSqr().redIAdd(s).redISub(u).redISub(u),h=f.redMul(u.redISub(b)).redISub(i.redMul(s)),l=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(b,h,l)},k.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),a=this.y,i=e.y.redMul(t).redMul(this.z),o=r.redSub(n),c=a.redSub(i);if(0===o.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),d=f.redMul(o),s=r.redMul(f),u=c.redSqr().redIAdd(d).redISub(s).redISub(s),b=c.redMul(s.redISub(u)).redISub(a.redMul(d)),h=this.z.redMul(o);return this.curve.jpoint(u,b,h)},k.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(a),0===this.x.cmp(r))return!0}},k.prototype.inspect=function(){return this.isInfinity()?"":""},k.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var S=f((function(e,t){var r=t;r.base=x,r.short=_,r.mont=null,r.edwards=null})),A=f((function(e,t){var r,n=t,a=b.assert;function i(e){"short"===e.type?this.curve=new S.short(e):"edwards"===e.type?this.curve=new S.edwards(e):this.curve=new S.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new i(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=i,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.a.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function E(e){if(!(this instanceof E))return new E(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=u.toArray(e.entropy,e.entropyEnc||"hex"),r=u.toArray(e.nonce,e.nonceEnc||"hex"),n=u.toArray(e.pers,e.persEnc||"hex");d(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var O=E;E.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},E.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=u.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length"};var B=b.assert;function R(e,t){if(e instanceof R)return e;this._importDER(e,t)||(B(e.r&&e.s,"Signature without r or s"),this.r=new a.a(e.r,16),this.s=new a.a(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var C=R;function I(){this.place=0}function L(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var a=0,i=0,o=t.place;i>>=0;return!(a<=127)&&(t.place=o,a)}function N(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}R.prototype._importDER=function(e,t){e=b.toArray(e,t);var r=new I;if(48!==e[r.place++])return!1;var n=L(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=L(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var c=L(e,r);if(!1===c)return!1;if(e.length!==c+r.place)return!1;var f=e.slice(r.place,c+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new a.a(o),this.s=new a.a(f),this.recoveryParam=null,!0},R.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=N(t),r=N(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];U(n,t.length),(n=n.concat(t)).push(2),U(n,r.length);var a=n.concat(r),i=[48];return U(i,a.length),i=i.concat(a),b.encode(i,e)};var z=function(){throw new Error("unsupported")},F=b.assert;function D(e){if(!(this instanceof D))return new D(e);"string"==typeof e&&(F(Object.prototype.hasOwnProperty.call(A,e),"Unknown curve "+e),e=A[e]),e instanceof A.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var H=D;D.prototype.keyPair=function(e){return new j(this,e)},D.prototype.keyFromPrivate=function(e,t){return j.fromPrivate(this,e,t)},D.prototype.keyFromPublic=function(e,t){return j.fromPublic(this,e,t)},D.prototype.genKeyPair=function(e){e||(e={});for(var t=new O({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||z(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new a.a(2));;){var i=new a.a(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},D.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},D.prototype.sign=function(e,t,r,n){"object"===c(r)&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new a.a(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),f=e.toArray("be",i),d=new O({hash:this.hash,entropy:o,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),s=this.n.sub(new a.a(1)),u=0;;u++){var b=n.k?n.k(u):new a.a(d.generate(this.n.byteLength()));if(!((b=this._truncateToN(b,!0)).cmpn(1)<=0||b.cmp(s)>=0)){var h=this.g.mul(b);if(!h.isInfinity()){var l=h.getX(),p=l.umod(this.n);if(0!==p.cmpn(0)){var m=b.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var x=(h.getY().isOdd()?1:0)|(0!==l.cmp(p)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),x^=1),new C({r:p,s:m,recoveryParam:x})}}}}}},D.prototype.verify=function(e,t,r,n){e=this._truncateToN(new a.a(e,16)),r=this.keyFromPublic(r,n);var i=(t=new C(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c,f=o.invm(this.n),d=f.mul(e).umod(this.n),s=f.mul(i).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(d,r.getPublic(),s)).isInfinity()&&c.eqXToP(i):!(c=this.g.mulAdd(d,r.getPublic(),s)).isInfinity()&&0===c.getX().umod(this.n).cmp(i)},D.prototype.recoverPubKey=function(e,t,r,n){F((3&r)===r,"The recovery param is more than two bits"),t=new C(t,n);var i=this.n,o=new a.a(e),c=t.r,f=t.s,d=1&r,s=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&s)throw new Error("Unable to find sencond key candinate");c=s?this.curve.pointFromX(c.add(this.curve.n),d):this.curve.pointFromX(c,d);var u=t.r.invm(i),b=i.sub(o).mul(u).umod(i),h=f.mul(u).umod(i);return this.g.mulAdd(b,c,h)},D.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new C(t,n)).recoveryParam)return t.recoveryParam;for(var a=0;a<4;a++){var i;try{i=this.recoverPubKey(e,t,a)}catch(e){continue}if(i.eq(r))return a}throw new Error("Unable to find valid recovery factor")};var q=f((function(e,t){var r=t;r.version="6.5.4",r.utils=b,r.rand=function(){throw new Error("unsupported")},r.curve=S,r.curves=A,r.ec=H,r.eddsa=null})).ec}).call(this,r(13))},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.getWindowMetadata=void 0;var a=r(27);t.getWindowMetadata=function(){var e,t;try{e=a.getDocumentOrThrow(),t=a.getLocationOrThrow()}catch(e){return null}function r(){for(var t=arguments.length,r=new Array(t),a=0;a-1){var c=i.getAttribute("href");if(c)if(-1===c.toLowerCase().indexOf("https:")&&-1===c.toLowerCase().indexOf("http:")&&0!==c.indexOf("//")){var f=t.protocol+"//"+t.host;if(0===c.indexOf("/"))f+=c;else{var d=t.pathname.split("/");d.pop(),f+=d.join("/")+"/"+c}n.push(f)}else if(0===c.indexOf("//")){var s=t.protocol+c;n.push(s)}else n.push(c)}}return n}(),name:i}}},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return b}));var n=function(){for(var e=0,t=0,r=arguments.length;t=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),f=r.call(i,"finallyLoc");if(c&&f){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;k(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),b}},e}function c(e,t,r,n,a,i,o){try{var c=e[i](o),f=c.value}catch(e){return void r(e)}c.done?t(f):Promise.resolve(f).then(n,a)}function f(e,t){for(var r=0;r=0;f--)(i=e[f])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c},o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)},c=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{f(n.next(e))}catch(e){i(e)}}function c(e){try{f(n.throw(e))}catch(e){i(e)}}function f(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}f((n=n.apply(e,t||[])).next())}))},f=this&&this.__generator||function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o},u=this&&this.__spread||function(){for(var e=[],t=0;tt&&c[t].tokenId&&!n)&&(this.updateTokenInfo(c[t],e,t,r),M.saveData(this.data)),[2,c[t]]}))}))},t.prototype.nftList=function(e,t){return c(this,void 0,void 0,(function(){var r,n,a,i,o,c,d,s,u;return f(this,(function(f){switch(f.label){case 0:return t=t||this.currentAccAddr,r=this.wallet.currentChain.id,[4,this.erc721Standard.getBalance(e,t)];case 1:if(n=f.sent(),a=L.getTypeByAddress(r,e),i=a.categor,o=a.type,c=[],i!==L.UNKNOW&&(c=this.currentAccountData.tokenData[r][i+"s"]),d=!1,c.length!==n&&(d=!0),d)for(c.length=0,s=0;s=0?[4,k.parseUrl(t)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2,t]}}))}))},t=i([_.singleton],t)}();t.default=F,o(r(116),t),o(r(862),t),o(r(95),t),o(r(324),t),o(r(288),t),o(r(193),t),o(r(192),t)}).call(this,r(0).Buffer)},,,function(e,t,r){"use strict";t.byteLength=function(e){var t=d(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=d(e),o=n[0],c=n[1],f=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,c)),s=0,u=c>0?o-4:o;for(r=0;r>16&255,f[s++]=t>>8&255,f[s++]=255&t;2===c&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,f[s++]=255&t);1===c&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,f[s++]=t>>8&255,f[s++]=255&t);return f},t.fromByteArray=function(e){for(var t,r=e.length,a=r%3,i=[],o=0,c=r-a;oc?c:o+16383));1===a?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,f=o.length;c0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(e,t,r){for(var a,i,o=[],c=t;c>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(e,t){ +return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}var n=t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,a=n.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0),function(e){0===(e[0]=r(e[0]))&&(e[1]=r(e[1]))}(o);var c=o.slice(0);n.encryptBlock(c,0);for(var f=0;f>>2]|=a<<24-i%4*8,e.sigBytes+=a},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,a=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(a-1)).concat(e.lib.WordArray.create([a<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){var t,r,n;return r=(t=e).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},e.format.Hex},"object"===c(t)?e.exports=t=o(r(2),r(12)):(a=[r(2),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,a=[],i=[],o=[],c=[],f=[],d=[],s=[],u=[],b=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var l=n^n<<1^n<<2^n<<3^n<<4;l=l>>>8^255&l^99,a[r]=l,i[l]=r;var p=e[r],m=e[p],x=e[m],y=257*e[l]^16843008*l;o[r]=y<<24|y>>>8,c[r]=y<<16|y>>>16,f[r]=y<<8|y>>>24,d[r]=y,y=16843009*x^65537*m^257*p^16843008*r,s[l]=y<<24|y>>>8,u[l]=y<<16|y>>>16,b[l]=y<<8|y>>>24,h[l]=y,r?(r=p^e[e[e[x^p]]],n^=e[e[n]]):r=n=1}}();var l=[0,1,2,4,8,16,32,64,128,27,54],p=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],o=0;o6&&o%r==4&&(d=a[d>>>24]<<24|a[d>>>16&255]<<16|a[d>>>8&255]<<8|a[255&d]):(d=a[(d=d<<8|d>>>24)>>>24]<<24|a[d>>>16&255]<<16|a[d>>>8&255]<<8|a[255&d],d^=l[o/r|0]<<24),i[o]=i[o-r]^d);for(var c=this._invKeySchedule=[],f=0;f>>24]]^u[a[d>>>16&255]]^b[a[d>>>8&255]]^h[a[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,c,f,d,a)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,s,u,b,h,i),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,a,i,o,c){for(var f=this._nRounds,d=e[t]^r[0],s=e[t+1]^r[1],u=e[t+2]^r[2],b=e[t+3]^r[3],h=4,l=1;l>>24]^a[s>>>16&255]^i[u>>>8&255]^o[255&b]^r[h++],m=n[s>>>24]^a[u>>>16&255]^i[b>>>8&255]^o[255&d]^r[h++],x=n[u>>>24]^a[b>>>16&255]^i[d>>>8&255]^o[255&s]^r[h++],y=n[b>>>24]^a[d>>>16&255]^i[s>>>8&255]^o[255&u]^r[h++];d=p,s=m,u=x,b=y}p=(c[d>>>24]<<24|c[s>>>16&255]<<16|c[u>>>8&255]<<8|c[255&b])^r[h++],m=(c[s>>>24]<<24|c[u>>>16&255]<<16|c[b>>>8&255]<<8|c[255&d])^r[h++],x=(c[u>>>24]<<24|c[b>>>16&255]<<16|c[d>>>8&255]<<8|c[255&s])^r[h++],y=(c[b>>>24]<<24|c[d>>>16&255]<<16|c[s>>>8&255]<<8|c[255&u])^r[h++],e[t]=p,e[t+1]=m,e[t+2]=x,e[t+3]=y},keySize:8});t.AES=r._createHelper(p)}(),e.AES},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,a=r.BlockCipher,i=t.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],f=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],s=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=i.DES=a.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=o[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var a=this._subKeys=[],i=0;i<16;i++){var d=a[i]=[],s=f[i];for(r=0;r<24;r++)d[r/6|0]|=t[(c[r]-1+s)%28]<<31-r%6,d[4+(r/6|0)]|=t[28+(c[r+24]-1+s)%28]<<31-r%6;for(d[0]=d[0]<<1|d[0]>>>31,r=1;r<7;r++)d[r]=d[r]>>>4*(r-1)+3;d[7]=d[7]<<5|d[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=a[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],b.call(this,4,252645135),b.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),b.call(this,1,1431655765);for(var n=0;n<16;n++){for(var a=r[n],i=this._lBlock,o=this._rBlock,c=0,f=0;f<8;f++)c|=d[f][((o^a[f])&s[f])>>>0];this._lBlock=o,this._rBlock=i^c}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,b.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),b.call(this,16,65535),b.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function b(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),a=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(n.create(t)),this._des2=u.createEncryptor(n.create(r)),this._des3=u.createEncryptor(n.create(a))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=a._createHelper(l)}(),e.TripleDES},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,a=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],a=0;a<256;a++)n[a]=a;a=0;for(var i=0;a<256;a++){var o=a%r,c=t[o>>>2]>>>24-o%4*8&255;i=(i+n[a]+c)%256;var f=n[a];n[a]=n[i],n[i]=f}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,r=this._j,n=0,a=0;a<4;a++){r=(r+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[r],e[r]=i,n|=e[(e[t]+e[r])%256]<<24-8*a}return this._i=t,this._j=r,n}t.RC4=r._createHelper(a);var o=n.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=r._createHelper(o)}(),e.RC4},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,a=[],i=[],o=[],c=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],a=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)f.call(this);for(r=0;r<8;r++)a[r]^=n[r+4&7];if(t){var i=t.words,o=i[0],c=i[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),u=d>>>16|4294901760&s,b=s<<16|65535&d;for(a[0]^=d,a[1]^=u,a[2]^=s,a[3]^=b,a[4]^=d,a[5]^=u,a[6]^=s,a[7]^=b,r=0;r<4;r++)f.call(this)}},_doProcessBlock:function(e,t){var r=this._X;f.call(this),a[0]=r[0]^r[5]>>>16^r[3]<<16,a[1]=r[2]^r[7]>>>16^r[5]<<16,a[2]=r[4]^r[1]>>>16^r[7]<<16,a[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),e[t+n]^=a[n]},blockSize:4,ivSize:2});function f(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],a=65535&n,c=n>>>16,f=((a*a>>>17)+a*c>>>15)+c*c,d=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=f^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=r._createHelper(c)}(),e.Rabbit},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){var n,a,i,o;function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,a=[],i=[],o=[],c=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var a=0;a<4;a++)f.call(this);for(a=0;a<8;a++)n[a]^=r[a+4&7];if(t){var i=t.words,o=i[0],c=i[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),u=d>>>16|4294901760&s,b=s<<16|65535&d;for(n[0]^=d,n[1]^=u,n[2]^=s,n[3]^=b,n[4]^=d,n[5]^=u,n[6]^=s,n[7]^=b,a=0;a<4;a++)f.call(this)}},_doProcessBlock:function(e,t){var r=this._X;f.call(this),a[0]=r[0]^r[5]>>>16^r[3]<<16,a[1]=r[2]^r[7]>>>16^r[5]<<16,a[2]=r[4]^r[1]>>>16^r[7]<<16,a[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)a[n]=16711935&(a[n]<<8|a[n]>>>24)|4278255360&(a[n]<<24|a[n]>>>8),e[t+n]^=a[n]},blockSize:4,ivSize:2});function f(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],a=65535&n,c=n>>>16,f=((a*a>>>17)+a*c>>>15)+c*c,d=((4294901760&n)*n|0)+((65535&n)*n|0);o[r]=f^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=r._createHelper(c)}(),e.RabbitLegacy},"object"===c(t)?e.exports=t=o(r(2),r(31),r(28),r(25),r(12)):(a=[r(2),r(31),r(28),r(25),r(12)],void 0===(i="function"==typeof(n=o)?n.apply(t,a):n)||(e.exports=i))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{f(n.next(e))}catch(e){i(e)}}function c(e){try{f(n.throw(e))}catch(e){i(e)}}function f(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}f((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var i=a(r(14)),o=r(43),c=r(22),f=r(79),d=r(353),s=r(60),u=r(190),b=r(121),h=r(191),l=function(){function e(e,t,r,n){void 0===e&&(e=new o.BN(0)),void 0===t&&(t=new o.BN(0)),void 0===r&&(r=d.KECCAK256_RLP),void 0===n&&(n=d.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=n,this._validate()}return e.fromAccountData=function(t){var r=t.nonce,n=t.balance,a=t.stateRoot,i=t.codeHash;return new e(r?new o.BN((0,s.toBuffer)(r)):void 0,n?new o.BN((0,s.toBuffer)(n)):void 0,a?(0,s.toBuffer)(a):void 0,i?(0,s.toBuffer)(i):void 0)},e.fromRlpSerializedAccount=function(e){var t=o.rlp.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},e.fromValuesArray=function(t){var r=n(t,4),a=r[0],i=r[1],c=r[2],f=r[3];return new e(new o.BN(a),new o.BN(i),c,f)},e.prototype._validate=function(){if(this.nonce.lt(new o.BN(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new o.BN(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},e.prototype.raw=function(){return[(0,h.bnToUnpaddedBuffer)(this.nonce),(0,h.bnToUnpaddedBuffer)(this.balance),this.stateRoot,this.codeHash]},e.prototype.serialize=function(){return o.rlp.encode(this.raw())},e.prototype.isContract=function(){return!this.codeHash.equals(d.KECCAK256_NULL)},e.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(d.KECCAK256_NULL)},e}();t.Account=l;t.isValidAddress=function(e){try{(0,b.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};t.toChecksumAddress=function(e,t){(0,b.assertIsHexString)(e);var r=(0,f.stripHexPrefix)(e).toLowerCase(),n="";t&&(n=(0,h.toType)(t,h.TypeOutput.BN).toString()+"0x");for(var a=(0,u.keccakFromString)(n+r).toString("hex"),i="0x",o=0;o=8?i+=r[o].toUpperCase():i+=r[o];return i};t.isValidChecksumAddress=function(e,r){return(0,t.isValidAddress)(e)&&(0,t.toChecksumAddress)(e,r)===e};t.generateAddress=function(t,r){(0,b.assertIsBuffer)(t),(0,b.assertIsBuffer)(r);var n=new o.BN(r);return n.isZero()?(0,u.rlphash)([t,null]).slice(-20):(0,u.rlphash)([t,e.from(n.toArray())]).slice(-20)};t.generateAddress2=function(t,r,n){return(0,b.assertIsBuffer)(t),(0,b.assertIsBuffer)(r),(0,b.assertIsBuffer)(n),(0,i.default)(20===t.length),(0,i.default)(32===r.length),(0,u.keccak256)(e.concat([e.from("ff","hex"),t,r,(0,u.keccak256)(n)])).slice(-20)};t.isValidPrivate=function(e){return(0,c.privateKeyVerify)(e)};t.isValidPublic=function(t,r){return void 0===r&&(r=!1),(0,b.assertIsBuffer)(t),64===t.length?(0,c.publicKeyVerify)(e.concat([e.from([4]),t])):!!r&&(0,c.publicKeyVerify)(t)};t.pubToAddress=function(t,r){return void 0===r&&(r=!1),(0,b.assertIsBuffer)(t),r&&64!==t.length&&(t=e.from((0,c.publicKeyConvert)(t,!1).slice(1))),(0,i.default)(64===t.length),(0,u.keccak)(t).slice(-20)},t.publicToAddress=t.pubToAddress;t.privateToPublic=function(t){return(0,b.assertIsBuffer)(t),e.from((0,c.publicKeyCreate)(t,!1)).slice(1)};t.privateToAddress=function(e){return(0,t.publicToAddress)((0,t.privateToPublic)(e))};t.importPublic=function(t){return(0,b.assertIsBuffer)(t),64!==t.length&&(t=e.from((0,c.publicKeyConvert)(t,!1).slice(1))),t};t.zeroAddress=function(){var e=(0,s.zeros)(20);return(0,s.bufferToHex)(e)};t.isZeroAddress=function(e){try{(0,b.assertIsString)(e)}catch(e){return!1}return(0,t.zeroAddress)()===e}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var n=r(19),a=r(827);e.exports=a((function(e){var t=n("sha256").update(e).digest();return n("sha256").update(t).digest()}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,a={};t.wordlists=a,t._default=n;try{t._default=n=r(836),a.czech=n}catch(e){}try{t._default=n=r(837),a.chinese_simplified=n}catch(e){}try{t._default=n=r(838),a.chinese_traditional=n}catch(e){}try{t._default=n=r(839),a.korean=n}catch(e){}try{t._default=n=r(840),a.french=n}catch(e){}try{t._default=n=r(841),a.italian=n}catch(e){}try{t._default=n=r(842),a.spanish=n}catch(e){}try{t._default=n=r(843),a.japanese=n,a.JA=n}catch(e){}try{t._default=n=r(844),a.portuguese=n}catch(e){}try{t._default=n=r(845),a.english=n,a.EN=n}catch(e){}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=this&&this.__decorate||function(e,t,r,a){var i,o=arguments.length,c=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,a);else for(var f=e.length-1;f>=0;f--)(i=e[f])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c};Object.defineProperty(t,"__esModule",{value:!0}),t.NativeSvr=void 0;var i=r(5),o=r(116),c=r(46),f=function(){function e(){this._event=o.createWalletEvents()}return e.prototype._subscribeToResponse=function(e,t){this._event.on("response:"+e,t)},e.prototype._subscribeToCallResponse=function(e){var t=this;return new Promise((function(r,n){t._subscribeToResponse(e,(function(e){e.errcode?n(e.errmessage||e.errcode):r(e.data)}))}))},e.prototype.handleNativeCallback=function(){for(var e=[],t=0;t0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]=0||"tuple"===e)&&y[t])return!0;return(x[t]||"payable"===t)&&p.throwArgumentError("invalid modifier","name",t),!1}function g(e,t){for(var r in t)Object(a.c)(e,r,t[r])}var w=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),_=new RegExp(/^(.*)\[([0-9]*)\]$/),M=function(){function e(t,r){b(this,e),t!==m&&p.throwError("use fromString",i.a.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),g(this,r);var n=this.type.match(_);g(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}return l(e,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json){var t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((function(t){return JSON.parse(t.format(e))}))),JSON.stringify(t)}var r="";return"array"===this.baseType?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==w.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+")"):r+=this.type,e!==w.sighash&&(!0===this.indexed&&(r+=" indexed"),e===w.full&&this.name&&(r+=" "+this.name)),r}}],[{key:"from",value:function(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}},{key:"fromObject",value:function(t){return e.isParamType(t)?t:new e(m,{name:t.name||null,type:C(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}},{key:"fromString",value:function(t,r){return function(t){return e.fromObject({name:t.name,type:t.type,indexed:t.indexed,components:t.components})}(function(e,t){var r=e;function n(t){p.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function a(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,c=0;c2&&p.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||p.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=n.a.from(r[1]),r[0]):e}function O(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((function(e){switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function T(e){var t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&p.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&p.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||p.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&p.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&p.throwArgumentError("unable to determine stateMutability","value",e),t}var P=function(e){c(r,e);var t=d(r);function r(){return b(this,r),t.apply(this,arguments)}return l(r,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});e===w.sighash&&p.throwError("cannot format a constructor for sighash",i.a.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});var t="constructor("+this.inputs.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isConstructorFragment(e))return e;"constructor"!==e.type&&p.throwArgumentError("invalid constructor object","value",e);var t=T(e);t.constant&&p.throwArgumentError("constructor cannot be constant","value",e);var a={name:null,type:e.type,inputs:e.inputs?e.inputs.map(M.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.a.from(e.gas):null};return new r(m,a)}},{key:"fromString",value:function(e){var t={type:"constructor"},n=(e=E(e,t)).match(N);return n&&"constructor"===n[1].trim()||p.throwArgumentError("invalid constructor string","value",e),t.inputs=k(n[2].trim(),!1),O(n[3].trim(),t),r.fromObject(t)}},{key:"isConstructorFragment",value:function(e){return e&&e._isFragment&&"constructor"===e.type}}]),r}(S),j=function(e){c(r,e);var t=d(r);function r(){return b(this,r),t.apply(this,arguments)}return l(r,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))})),outputs:this.outputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==w.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+") ",e!==w.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((function(t){return t.format(e)})).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isFunctionFragment(e))return e;"function"!==e.type&&p.throwArgumentError("invalid function object","value",e);var t=T(e),a={type:e.type,name:L(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(M.fromObject):[],outputs:e.outputs?e.outputs.map(M.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?n.a.from(e.gas):null};return new r(m,a)}},{key:"fromString",value:function(e){var t={type:"function"},n=(e=E(e,t)).split(" returns ");n.length>2&&p.throwArgumentError("invalid function string","value",e);var a=n[0].match(N);if(a||p.throwArgumentError("invalid function signature","value",e),t.name=a[1].trim(),t.name&&L(t.name),t.inputs=k(a[2],!1),O(a[3].trim(),t),n.length>1){var i=n[1].match(N);""==i[1].trim()&&""==i[3].trim()||p.throwArgumentError("unexpected tokens","value",e),t.outputs=k(i[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(P);function B(e){var t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||p.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}var R=function(e){c(r,e);var t=d(r);function r(){return b(this,r),t.apply(this,arguments)}return l(r,[{key:"format",value:function(e){if(e||(e=w.sighash),w[e]||p.throwArgumentError("invalid format type","format",e),e===w.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==w.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===w.full?", ":",")+") ").trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isErrorFragment(e))return e;"error"!==e.type&&p.throwArgumentError("invalid error object","value",e);var t={type:e.type,name:L(e.name),inputs:e.inputs?e.inputs.map(M.fromObject):[]};return B(new r(m,t))}},{key:"fromString",value:function(e){var t={type:"error"},n=e.match(N);return n||p.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&L(t.name),t.inputs=k(n[2],!1),B(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(S);function C(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var I=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function L(e){return e&&e.match(I)||p.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}var N=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");var U=r(1);function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var r=0;rthis.wordSize&&H.throwError("value out-of-bounds",i.a.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Object(U.b)([this._padding.slice(t.length%this.wordSize),t])),t}},{key:"writeValue",value:function(e){return this._writeData(this._getValue(e))}},{key:"writeUpdatableValue",value:function(){var e=this,t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,function(r){e._data[t]=e._getValue(r)}}}]),e}(),W=function(){function e(t,r,n,i){z(this,e),Object(a.c)(this,"_data",Object(U.a)(t)),Object(a.c)(this,"wordSize",r||32),Object(a.c)(this,"_coerceFunc",n),Object(a.c)(this,"allowLoose",i),this._offset=0}return D(e,[{key:"data",get:function(){return Object(U.g)(this._data)}},{key:"consumed",get:function(){return this._offset}},{key:"coerce",value:function(t,r){return this._coerceFunc?this._coerceFunc(t,r):e.coerce(t,r)}},{key:"_peekBytes",value:function(e,t,r){var n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:H.throwError("data out-of-bounds",i.a.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}},{key:"subReader",value:function(t){return new e(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}},{key:"readBytes",value:function(e,t){var r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}},{key:"readValue",value:function(){return n.a.from(this.readBytes(this.wordSize))}}],[{key:"coerce",value:function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}}]),e}(),V=r(33);function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function J(e,t){for(var r=0;r=0?t:"")+"]",c=-1===t||e.dynamic;return(n=a.call(this,"array",i,r,c)).coder=e,n.length=t,n}return t=o,(r=[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;re._data.length&&le.throwError("insufficient data length",i.a.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});for(var r=[],n=0;n>6==2;o++)i++;return i}return e===ot.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(it||(it={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(ot||(ot={}));var st=Object.freeze({error:function(e,t,r,n,a){return ft.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:dt,replace:function(e,t,r,n,a){return e===ot.OVERLONG?(n.push(a),0):(n.push(65533),dt(e,t,r))}});function ut(e,t){null==t&&(t=st.error),e=Object(U.a)(e);for(var r=[],n=0;n>7!=0){var i=null,o=null;if(192==(224&a))i=1,o=127;else if(224==(240&a))i=2,o=2047;else{if(240!=(248&a)){n+=t(128==(192&a)?ot.UNEXPECTED_CONTINUE:ot.BAD_PREFIX,n-1,e,r);continue}i=3,o=65535}if(n-1+i>=e.length)n+=t(ot.OVERRUN,n-1,e,r);else{for(var c=a&(1<<8-i-1)-1,f=0;f1114111?n+=t(ot.OUT_OF_RANGE,n-1-i,e,r,c):c>=55296&&c<=57343?n+=t(ot.UTF16_SURROGATE,n-1-i,e,r,c):c<=o?n+=t(ot.OVERLONG,n-1-i,e,r,c):r.push(c))}}else r.push(a)}return r}function bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it.current;t!=it.current&&(ft.checkNormalize(),e=e.normalize(t));for(var r=[],n=0;n>6|192),r.push(63&a|128);else if(55296==(64512&a)){n++;var i=e.charCodeAt(n);if(n>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");var o=65536+((1023&a)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(a>>12|224),r.push(a>>6&63|128),r.push(63&a|128)}return Object(U.a)(r)}function ht(e,t){return ut(e,t).map((function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))})).join("")}function lt(e){return(lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pt(e,t){for(var r=0;r256||n%8!=0)&&jt.throwArgumentError("invalid "+r[1]+" bit length","param",e),new ct(n/8,"int"===r[1],e.name)}if(r=e.type.match(Bt)){var a=parseInt(r[1]);return(0===a||a>32)&&jt.throwArgumentError("invalid bytes length","param",e),new Ke(a,e.name)}return jt.throwArgumentError("invalid type","type",e.type)}},{key:"_getWordSize",value:function(){return 32}},{key:"_getReader",value:function(e,t){return new W(e,this._getWordSize(),this.coerceFunc,t)}},{key:"_getWriter",value:function(){return new G(this._getWordSize())}},{key:"getDefaultValue",value:function(e){var t=this,r=e.map((function(e){return t._getCoder(M.from(e))}));return new Tt(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&jt.throwError("types/values length mismatch",i.a.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var n=e.map((function(e){return r._getCoder(M.from(e))})),a=new Tt(n,"_"),o=this._getWriter();return a.encode(o,t),o.data}},{key:"decode",value:function(e,t,r){var n=this,a=e.map((function(e){return n._getCoder(M.from(e))}));return new Tt(a,"_").decode(this._getReader(Object(U.a)(t),r))}}])&&Pt(t.prototype,r),n&&Pt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),It=new Ct,Lt=r(20);function Nt(e){return Object(Lt.a)(bt(e))}function Ut(e){return(Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zt(e,t){for(var r=0;r1&&Vt.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var a=this.functions[j.fromString(e).format()];return a||Vt.throwArgumentError("no matching function","signature",e),a}},{key:"getEvent",value:function(e){if(Object(U.j)(e)){var t=e.toLowerCase();for(var r in this.events)if(t===this.getEventTopic(r))return this.events[r];Vt.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),a=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===a.length?Vt.throwArgumentError("no matching event","name",n):a.length>1&&Vt.throwArgumentError("multiple matching events","name",n),this.events[a[0]]}var i=this.events[A.fromString(e).format()];return i||Vt.throwArgumentError("no matching event","signature",e),i}},{key:"getError",value:function(e){if(Object(U.j)(e)){var t=Object(a.d)(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Vt.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),i=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===i.length?Vt.throwArgumentError("no matching error","name",n):i.length>1&&Vt.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}var o=this.errors[j.fromString(e).format()];return o||Vt.throwArgumentError("no matching error","signature",e),o}},{key:"getSighash",value:function(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return Object(a.d)(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"==typeof e&&(e=this.getEvent(e)),Object(a.d)(this.constructor,"getEventTopic")(e)}},{key:"_decodeParams",value:function(e,t){return this._abiCoder.decode(e,t)}},{key:"_encodeParams",value:function(e,t){return this._abiCoder.encode(e,t)}},{key:"encodeDeploy",value:function(e){return this._encodeParams(this.deploy.inputs,e||[])}},{key:"decodeErrorResult",value:function(e,t){"string"==typeof e&&(e=this.getError(e));var r=Object(U.a)(t);return Object(U.g)(r.slice(0,4))!==this.getSighash(e)&&Vt.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",Object(U.g)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeErrorResult",value:function(e,t){return"string"==typeof e&&(e=this.getError(e)),Object(U.g)(Object(U.b)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionData",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=Object(U.a)(t);return Object(U.g)(r.slice(0,4))!==this.getSighash(e)&&Vt.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",Object(U.g)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeFunctionData",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Object(U.g)(Object(U.b)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionResult",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=Object(U.a)(t),n=null,a="",o=null,c=null,f=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(u){}break;case 4:var d=Object(U.g)(r.slice(0,4)),s=$t[d];if(s)o=this._abiCoder.decode(s.inputs,r.slice(4)),c=s.name,f=s.signature,s.reason&&(n=o[0]),"Error"===c?a="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(o[0])):"Panic"===c&&(a="; VM Exception while processing transaction: reverted with panic code ".concat(o[0]));else try{var u=this.getError(d);o=this._abiCoder.decode(u.inputs,r.slice(4)),c=u.name,f=u.format()}catch(u){}}return Vt.throwError("call revert exception"+a,i.a.errors.CALL_EXCEPTION,{method:e.format(),data:Object(U.g)(t),errorArgs:o,errorName:c,errorSignature:f,reason:n})}},{key:"encodeFunctionResult",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Object(U.g)(this._abiCoder.encode(e.outputs,t||[]))}},{key:"encodeFilterTopics",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Vt.throwError("too many arguments for "+e.format(),i.a.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var a=[];e.anonymous||a.push(this.getEventTopic(e));var o=function(e,t){return"string"===e.type?Nt(t):"bytes"===e.type?Object(Lt.a)(Object(U.g)(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=n.a.from(t).toHexString()),"address"===e.type&&r._abiCoder.encode(["address"],[t]),Object(U.f)(Object(U.g)(t),32))};for(t.forEach((function(t,r){var n=e.inputs[r];n.indexed?null==t?a.push(null):"array"===n.baseType||"tuple"===n.baseType?Vt.throwArgumentError("filtering with tuples or arrays not supported","contract."+n.name,t):Array.isArray(t)?a.push(t.map((function(e){return o(n,e)}))):a.push(o(n,t)):null!=t&&Vt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+n.name,t)}));a.length&&null===a[a.length-1];)a.pop();return a}},{key:"encodeEventLog",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e));var n=[],a=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Vt.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,o){var c=t[o];if(e.indexed)if("string"===e.type)n.push(Nt(c));else if("bytes"===e.type)n.push(Object(Lt.a)(c));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[c]))}else a.push(e),i.push(c)})),{data:this._abiCoder.encode(a,i),topics:n}}},{key:"decodeEventLog",value:function(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);Object(U.j)(r[0],32)&&r[0].toLowerCase()===n||Vt.throwError("fragment/topic mismatch",i.a.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var a=[],o=[],c=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(a.push(M.fromObject({type:"bytes32",name:e.name})),c.push(!0)):(a.push(e),c.push(!1)):(o.push(e),c.push(!1))}));var f=null!=r?this._abiCoder.decode(a,Object(U.b)(r)):null,d=this._abiCoder.decode(o,t,!0),s=[],u=0,b=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==f)s[t]=new Yt({_isIndexed:!0,hash:null});else if(c[t])s[t]=new Yt({_isIndexed:!0,hash:f[b++]});else try{s[t]=f[b++]}catch(e){s[t]=e}else try{s[t]=d[u++]}catch(e){s[t]=e}if(e.name&&null==s[e.name]){var r=s[t];r instanceof Error?Object.defineProperty(s,e.name,{enumerable:!0,get:function(){throw Qt("property ".concat(JSON.stringify(e.name)),r)}}):s[e.name]=r}}));for(var h=function(e){var t=s[e];t instanceof Error&&Object.defineProperty(s,e,{enumerable:!0,get:function(){throw Qt("index ".concat(e),t)}})},l=0;l=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void a(!1,"Invalid character in "+e)}function d(e,t,r){var n=f(e,r);return r-1>=t&&(n|=f(e,r-1)<<4),n}function s(e,t,r,n){for(var i=0,o=0,c=Math.min(e.length,r),f=t;f=49?d-49+10:d>=17?d-17+10:d,a(d>=0&&o0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,r,n){if("number"==typeof e)return this._initNumber(e,r,n);if("object"===t(e))return this._initArray(e,r,n);"hex"===r&&(r=16),a(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);else if("le"===r)for(n=0,i=0;n>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)a=d(e,t,n)<=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=t)n++;n--,a=a/t|0;for(var i=e.length-r,o=i%n,c=Math.min(i,i-o)+r,f=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=b}catch(e){o.prototype.inspect=b}else o.prototype.inspect=b;function b(){return(this.red?""}var h=["","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"],l=[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],p=[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];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==i||o!==this.length-1?h[6-f.length]+f+r:f+r}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],s=p[e];r="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(s).toString(e);r=(u=u.idivn(s)).isZero()?b+r:h[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}a(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},c&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var a=0|e.words[0],i=0|t.words[0],o=a*i,c=67108863&o,f=o/67108864|0;r.words[0]=c;for(var d=1;d>>26,u=67108863&f,b=Math.min(d,t.length-1),h=Math.max(0,d-e.length+1);h<=b;h++){var l=d-h|0;s+=(o=(a=0|e.words[l])*(i=0|t.words[h])+u)/67108864|0,u=67108863&o}r.words[d]=0|u,f=0|s}return 0!==f?r.words[d]=0|f:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),i=r||Math.max(1,n);a(n<=i,"byte array longer than desired length"),a(i>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,a=0,i=0;a>8&255),r>16&255),6===i?(r>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===i?(r>=0&&(e[r--]=o>>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){a("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){a("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,a=this.cmp(e);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,h=0|o[1],l=8191&h,p=h>>>13,m=0|o[2],x=8191&m,y=m>>>13,v=0|o[3],g=8191&v,w=v>>>13,_=0|o[4],M=8191&_,k=_>>>13,S=0|o[5],A=8191&S,E=S>>>13,O=0|o[6],T=8191&O,P=O>>>13,j=0|o[7],B=8191&j,R=j>>>13,C=0|o[8],I=8191&C,L=C>>>13,N=0|o[9],U=8191&N,z=N>>>13,F=0|c[0],D=8191&F,H=F>>>13,q=0|c[1],K=8191&q,G=q>>>13,W=0|c[2],V=8191&W,Z=W>>>13,J=0|c[3],X=8191&J,Y=J>>>13,$=0|c[4],Q=8191&$,ee=$>>>13,te=0|c[5],re=8191&te,ne=te>>>13,ae=0|c[6],ie=8191&ae,oe=ae>>>13,ce=0|c[7],fe=8191&ce,de=ce>>>13,se=0|c[8],ue=8191&se,be=se>>>13,he=0|c[9],le=8191&he,pe=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(d+(n=Math.imul(u,D))|0)+((8191&(a=(a=Math.imul(u,H))+Math.imul(b,D)|0))<<13)|0;d=((i=Math.imul(b,H))+(a>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(l,D),a=(a=Math.imul(l,H))+Math.imul(p,D)|0,i=Math.imul(p,H);var xe=(d+(n=n+Math.imul(u,K)|0)|0)+((8191&(a=(a=a+Math.imul(u,G)|0)+Math.imul(b,K)|0))<<13)|0;d=((i=i+Math.imul(b,G)|0)+(a>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(x,D),a=(a=Math.imul(x,H))+Math.imul(y,D)|0,i=Math.imul(y,H),n=n+Math.imul(l,K)|0,a=(a=a+Math.imul(l,G)|0)+Math.imul(p,K)|0,i=i+Math.imul(p,G)|0;var ye=(d+(n=n+Math.imul(u,V)|0)|0)+((8191&(a=(a=a+Math.imul(u,Z)|0)+Math.imul(b,V)|0))<<13)|0;d=((i=i+Math.imul(b,Z)|0)+(a>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(g,D),a=(a=Math.imul(g,H))+Math.imul(w,D)|0,i=Math.imul(w,H),n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,G)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(l,V)|0,a=(a=a+Math.imul(l,Z)|0)+Math.imul(p,V)|0,i=i+Math.imul(p,Z)|0;var ve=(d+(n=n+Math.imul(u,X)|0)|0)+((8191&(a=(a=a+Math.imul(u,Y)|0)+Math.imul(b,X)|0))<<13)|0;d=((i=i+Math.imul(b,Y)|0)+(a>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(M,D),a=(a=Math.imul(M,H))+Math.imul(k,D)|0,i=Math.imul(k,H),n=n+Math.imul(g,K)|0,a=(a=a+Math.imul(g,G)|0)+Math.imul(w,K)|0,i=i+Math.imul(w,G)|0,n=n+Math.imul(x,V)|0,a=(a=a+Math.imul(x,Z)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,Z)|0,n=n+Math.imul(l,X)|0,a=(a=a+Math.imul(l,Y)|0)+Math.imul(p,X)|0,i=i+Math.imul(p,Y)|0;var ge=(d+(n=n+Math.imul(u,Q)|0)|0)+((8191&(a=(a=a+Math.imul(u,ee)|0)+Math.imul(b,Q)|0))<<13)|0;d=((i=i+Math.imul(b,ee)|0)+(a>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,D),a=(a=Math.imul(A,H))+Math.imul(E,D)|0,i=Math.imul(E,H),n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,G)|0)+Math.imul(k,K)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(g,V)|0,a=(a=a+Math.imul(g,Z)|0)+Math.imul(w,V)|0,i=i+Math.imul(w,Z)|0,n=n+Math.imul(x,X)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(l,Q)|0,a=(a=a+Math.imul(l,ee)|0)+Math.imul(p,Q)|0,i=i+Math.imul(p,ee)|0;var we=(d+(n=n+Math.imul(u,re)|0)|0)+((8191&(a=(a=a+Math.imul(u,ne)|0)+Math.imul(b,re)|0))<<13)|0;d=((i=i+Math.imul(b,ne)|0)+(a>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,D),a=(a=Math.imul(T,H))+Math.imul(P,D)|0,i=Math.imul(P,H),n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,G)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,G)|0,n=n+Math.imul(M,V)|0,a=(a=a+Math.imul(M,Z)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,Z)|0,n=n+Math.imul(g,X)|0,a=(a=a+Math.imul(g,Y)|0)+Math.imul(w,X)|0,i=i+Math.imul(w,Y)|0,n=n+Math.imul(x,Q)|0,a=(a=a+Math.imul(x,ee)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(l,re)|0,a=(a=a+Math.imul(l,ne)|0)+Math.imul(p,re)|0,i=i+Math.imul(p,ne)|0;var _e=(d+(n=n+Math.imul(u,ie)|0)|0)+((8191&(a=(a=a+Math.imul(u,oe)|0)+Math.imul(b,ie)|0))<<13)|0;d=((i=i+Math.imul(b,oe)|0)+(a>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(B,D),a=(a=Math.imul(B,H))+Math.imul(R,D)|0,i=Math.imul(R,H),n=n+Math.imul(T,K)|0,a=(a=a+Math.imul(T,G)|0)+Math.imul(P,K)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(A,V)|0,a=(a=a+Math.imul(A,Z)|0)+Math.imul(E,V)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(M,X)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(k,X)|0,i=i+Math.imul(k,Y)|0,n=n+Math.imul(g,Q)|0,a=(a=a+Math.imul(g,ee)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,ee)|0,n=n+Math.imul(x,re)|0,a=(a=a+Math.imul(x,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(l,ie)|0,a=(a=a+Math.imul(l,oe)|0)+Math.imul(p,ie)|0,i=i+Math.imul(p,oe)|0;var Me=(d+(n=n+Math.imul(u,fe)|0)|0)+((8191&(a=(a=a+Math.imul(u,de)|0)+Math.imul(b,fe)|0))<<13)|0;d=((i=i+Math.imul(b,de)|0)+(a>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,D),a=(a=Math.imul(I,H))+Math.imul(L,D)|0,i=Math.imul(L,H),n=n+Math.imul(B,K)|0,a=(a=a+Math.imul(B,G)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(T,V)|0,a=(a=a+Math.imul(T,Z)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(A,X)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,a=(a=a+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(g,re)|0,a=(a=a+Math.imul(g,ne)|0)+Math.imul(w,re)|0,i=i+Math.imul(w,ne)|0,n=n+Math.imul(x,ie)|0,a=(a=a+Math.imul(x,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(l,fe)|0,a=(a=a+Math.imul(l,de)|0)+Math.imul(p,fe)|0,i=i+Math.imul(p,de)|0;var ke=(d+(n=n+Math.imul(u,ue)|0)|0)+((8191&(a=(a=a+Math.imul(u,be)|0)+Math.imul(b,ue)|0))<<13)|0;d=((i=i+Math.imul(b,be)|0)+(a>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,D),a=(a=Math.imul(U,H))+Math.imul(z,D)|0,i=Math.imul(z,H),n=n+Math.imul(I,K)|0,a=(a=a+Math.imul(I,G)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,G)|0,n=n+Math.imul(B,V)|0,a=(a=a+Math.imul(B,Z)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(T,X)|0,a=(a=a+Math.imul(T,Y)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(A,Q)|0,a=(a=a+Math.imul(A,ee)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(M,re)|0,a=(a=a+Math.imul(M,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(g,ie)|0,a=(a=a+Math.imul(g,oe)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,oe)|0,n=n+Math.imul(x,fe)|0,a=(a=a+Math.imul(x,de)|0)+Math.imul(y,fe)|0,i=i+Math.imul(y,de)|0,n=n+Math.imul(l,ue)|0,a=(a=a+Math.imul(l,be)|0)+Math.imul(p,ue)|0,i=i+Math.imul(p,be)|0;var Se=(d+(n=n+Math.imul(u,le)|0)|0)+((8191&(a=(a=a+Math.imul(u,pe)|0)+Math.imul(b,le)|0))<<13)|0;d=((i=i+Math.imul(b,pe)|0)+(a>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,K),a=(a=Math.imul(U,G))+Math.imul(z,K)|0,i=Math.imul(z,G),n=n+Math.imul(I,V)|0,a=(a=a+Math.imul(I,Z)|0)+Math.imul(L,V)|0,i=i+Math.imul(L,Z)|0,n=n+Math.imul(B,X)|0,a=(a=a+Math.imul(B,Y)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(T,Q)|0,a=(a=a+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(A,re)|0,a=(a=a+Math.imul(A,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(M,ie)|0,a=(a=a+Math.imul(M,oe)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,oe)|0,n=n+Math.imul(g,fe)|0,a=(a=a+Math.imul(g,de)|0)+Math.imul(w,fe)|0,i=i+Math.imul(w,de)|0,n=n+Math.imul(x,ue)|0,a=(a=a+Math.imul(x,be)|0)+Math.imul(y,ue)|0,i=i+Math.imul(y,be)|0;var Ae=(d+(n=n+Math.imul(l,le)|0)|0)+((8191&(a=(a=a+Math.imul(l,pe)|0)+Math.imul(p,le)|0))<<13)|0;d=((i=i+Math.imul(p,pe)|0)+(a>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,V),a=(a=Math.imul(U,Z))+Math.imul(z,V)|0,i=Math.imul(z,Z),n=n+Math.imul(I,X)|0,a=(a=a+Math.imul(I,Y)|0)+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(B,Q)|0,a=(a=a+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,a=(a=a+Math.imul(T,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(A,ie)|0,a=(a=a+Math.imul(A,oe)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,oe)|0,n=n+Math.imul(M,fe)|0,a=(a=a+Math.imul(M,de)|0)+Math.imul(k,fe)|0,i=i+Math.imul(k,de)|0,n=n+Math.imul(g,ue)|0,a=(a=a+Math.imul(g,be)|0)+Math.imul(w,ue)|0,i=i+Math.imul(w,be)|0;var Ee=(d+(n=n+Math.imul(x,le)|0)|0)+((8191&(a=(a=a+Math.imul(x,pe)|0)+Math.imul(y,le)|0))<<13)|0;d=((i=i+Math.imul(y,pe)|0)+(a>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,X),a=(a=Math.imul(U,Y))+Math.imul(z,X)|0,i=Math.imul(z,Y),n=n+Math.imul(I,Q)|0,a=(a=a+Math.imul(I,ee)|0)+Math.imul(L,Q)|0,i=i+Math.imul(L,ee)|0,n=n+Math.imul(B,re)|0,a=(a=a+Math.imul(B,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(T,ie)|0,a=(a=a+Math.imul(T,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(A,fe)|0,a=(a=a+Math.imul(A,de)|0)+Math.imul(E,fe)|0,i=i+Math.imul(E,de)|0,n=n+Math.imul(M,ue)|0,a=(a=a+Math.imul(M,be)|0)+Math.imul(k,ue)|0,i=i+Math.imul(k,be)|0;var Oe=(d+(n=n+Math.imul(g,le)|0)|0)+((8191&(a=(a=a+Math.imul(g,pe)|0)+Math.imul(w,le)|0))<<13)|0;d=((i=i+Math.imul(w,pe)|0)+(a>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,Q),a=(a=Math.imul(U,ee))+Math.imul(z,Q)|0,i=Math.imul(z,ee),n=n+Math.imul(I,re)|0,a=(a=a+Math.imul(I,ne)|0)+Math.imul(L,re)|0,i=i+Math.imul(L,ne)|0,n=n+Math.imul(B,ie)|0,a=(a=a+Math.imul(B,oe)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,oe)|0,n=n+Math.imul(T,fe)|0,a=(a=a+Math.imul(T,de)|0)+Math.imul(P,fe)|0,i=i+Math.imul(P,de)|0,n=n+Math.imul(A,ue)|0,a=(a=a+Math.imul(A,be)|0)+Math.imul(E,ue)|0,i=i+Math.imul(E,be)|0;var Te=(d+(n=n+Math.imul(M,le)|0)|0)+((8191&(a=(a=a+Math.imul(M,pe)|0)+Math.imul(k,le)|0))<<13)|0;d=((i=i+Math.imul(k,pe)|0)+(a>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),a=(a=Math.imul(U,ne))+Math.imul(z,re)|0,i=Math.imul(z,ne),n=n+Math.imul(I,ie)|0,a=(a=a+Math.imul(I,oe)|0)+Math.imul(L,ie)|0,i=i+Math.imul(L,oe)|0,n=n+Math.imul(B,fe)|0,a=(a=a+Math.imul(B,de)|0)+Math.imul(R,fe)|0,i=i+Math.imul(R,de)|0,n=n+Math.imul(T,ue)|0,a=(a=a+Math.imul(T,be)|0)+Math.imul(P,ue)|0,i=i+Math.imul(P,be)|0;var Pe=(d+(n=n+Math.imul(A,le)|0)|0)+((8191&(a=(a=a+Math.imul(A,pe)|0)+Math.imul(E,le)|0))<<13)|0;d=((i=i+Math.imul(E,pe)|0)+(a>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,ie),a=(a=Math.imul(U,oe))+Math.imul(z,ie)|0,i=Math.imul(z,oe),n=n+Math.imul(I,fe)|0,a=(a=a+Math.imul(I,de)|0)+Math.imul(L,fe)|0,i=i+Math.imul(L,de)|0,n=n+Math.imul(B,ue)|0,a=(a=a+Math.imul(B,be)|0)+Math.imul(R,ue)|0,i=i+Math.imul(R,be)|0;var je=(d+(n=n+Math.imul(T,le)|0)|0)+((8191&(a=(a=a+Math.imul(T,pe)|0)+Math.imul(P,le)|0))<<13)|0;d=((i=i+Math.imul(P,pe)|0)+(a>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,fe),a=(a=Math.imul(U,de))+Math.imul(z,fe)|0,i=Math.imul(z,de),n=n+Math.imul(I,ue)|0,a=(a=a+Math.imul(I,be)|0)+Math.imul(L,ue)|0,i=i+Math.imul(L,be)|0;var Be=(d+(n=n+Math.imul(B,le)|0)|0)+((8191&(a=(a=a+Math.imul(B,pe)|0)+Math.imul(R,le)|0))<<13)|0;d=((i=i+Math.imul(R,pe)|0)+(a>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,ue),a=(a=Math.imul(U,be))+Math.imul(z,ue)|0,i=Math.imul(z,be);var Re=(d+(n=n+Math.imul(I,le)|0)|0)+((8191&(a=(a=a+Math.imul(I,pe)|0)+Math.imul(L,le)|0))<<13)|0;d=((i=i+Math.imul(L,pe)|0)+(a>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(d+(n=Math.imul(U,le))|0)+((8191&(a=(a=Math.imul(U,pe))+Math.imul(z,le)|0))<<13)|0;return d=((i=Math.imul(z,pe))+(a>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f[0]=me,f[1]=xe,f[2]=ye,f[3]=ve,f[4]=ge,f[5]=we,f[6]=_e,f[7]=Me,f[8]=ke,f[9]=Se,f[10]=Ae,f[11]=Ee,f[12]=Oe,f[13]=Te,f[14]=Pe,f[15]=je,f[16]=Be,f[17]=Re,f[18]=Ce,0!==d&&(f[19]=d,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=c,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r._strip()}function v(e,t,r){return y(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(x=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):r<63?m(this,e,t):r<1024?y(this,e,t):v(this,e,t)},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,r+=i/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>a&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,n=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),c=67108863^67108863>>>i<o)for(this.length-=o,d=0;d=0&&(0!==s||d>=n);d--){var u=0|this.words[d];this.words[d]=s<<26-i|u>>>i,s=u&c}return f&&0!==s&&(f.words[f.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return a(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){a("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<=0);var t=e%26,r=(e-t)/26;if(a(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(a("number"==typeof e),a(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===c)return this._strip();for(a(-1===c),c=0,n=0;n>26,this.words[n]=67108863&i;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,i=0|a.words[a.length-1];0!==(r=26-this._countBits(i))&&(a=a.ushln(r),n.iushln(r),i=0|a.words[a.length-1]);var c,f=n.length-a.length;if("mod"!==t){(c=new o(null)).length=f+1,c.words=new Array(c.length);for(var d=0;d=0;u--){var b=67108864*(0|n.words[a.length+u])+(0|n.words[a.length+u-1]);for(b=Math.min(b/i|0,67108863),n._ishlnsubmul(a,b,u);0!==n.negative;)b--,n.negative=0,n._ishlnsubmul(a,1,u),n.isZero()||(n.negative^=1);c&&(c.words[u]=b)}return c&&c._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:c||null,mod:n}},o.prototype.divmod=function(e,t,r){return a(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(c=this.neg().divmod(e,t),"mod"!==t&&(n=c.div.neg()),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:n,mod:i}):0===this.negative&&0!==e.negative?(c=this.divmod(e.neg(),t),"mod"!==t&&(n=c.div.neg()),{div:n,mod:c.mod}):0!=(this.negative&e.negative)?(c=this.neg().divmod(e.neg(),t),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:c.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,i,c},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),a=e.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(r*n+(0|this.words[i]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*r;this.words[n]=i/e|0,r=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),i=new o(0),c=new o(0),f=new o(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var s=r.clone(),u=t.clone();!t.isZero();){for(var b=0,h=1;0==(t.words[0]&h)&&b<26;++b,h<<=1);if(b>0)for(t.iushrn(b);b-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(s),i.isub(u)),n.iushrn(1),i.iushrn(1);for(var l=0,p=1;0==(r.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(u)),c.iushrn(1),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(c),i.isub(f)):(r.isub(t),c.isub(n),f.isub(i))}return{a:c,b:f,gcd:r.iushln(d)}},o.prototype._invmp=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,i=new o(1),c=new o(0),f=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,s=1;0==(t.words[0]&s)&&d<26;++d,s<<=1);if(d>0)for(t.iushrn(d);d-- >0;)i.isOdd()&&i.iadd(f),i.iushrn(1);for(var u=0,b=1;0==(r.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(r.iushrn(u);u-- >0;)c.isOdd()&&c.iadd(f),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(c)):(r.isub(t),c.isub(i))}return(n=0===t.cmpn(1)?i:c).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=t.cmp(r);if(a<0){var i=t;t=r,r=i}else if(0===a||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){a("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,c&=67108863,this.words[o]=c}return 0!==i&&(this.words[o]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),a(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|e.words[r];if(n!==a){na&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new E(e)},o.prototype.toRed=function(e){return a(!this.red,"Already a number in reduction context"),a(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return a(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return a(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else a(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},i(M,_),M.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,a=i}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},M.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=a,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new M;else if("p224"===e)t=new k;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return w[e]=t,t},E.prototype._verify1=function(e){a(0===e.negative,"red works only with positives"),a(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){a(0==(e.negative|t.negative),"red works only with positives"),a(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(a(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);a(!n.isZero());var c=new o(1).toRed(this),f=c.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);0!==this.pow(s,d).cmp(f);)s.redIAdd(f);for(var u=this.pow(s,n),b=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),l=i;0!==h.cmp(c);){for(var p=h,m=0;0!==p.cmp(c);m++)p=p.redSqr();a(m=0;n--){for(var d=t.words[n],s=f-1;s>=0;s--){var u=d>>s&1;a!==r[0]&&(a=this.sqr(a)),0!==u||0!==i?(i<<=1,i|=u,(4===++c||0===n&&0===s)&&(a=this.mul(a,r[i]),c=0,i=0)):c=0}f=26}return a},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,E),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(15)(e))},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return q}));var n=r(8),a=r.n(n),i=r(26),o=r.n(i);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e||"undefined"!=typeof self&&self;function f(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var d=s;function s(e,t){if(!e)throw new Error(t||"Assertion failed")}s.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var u=f((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function a(e){for(var t="",r=0;r>8,o=255&a;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=a,r.encode=function(e,t){return"hex"===t?a(e):e}})),b=f((function(e,t){var r=t;r.assert=d,r.toArray=u.toArray,r.zero2=u.zero2,r.toHex=u.toHex,r.encode=u.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var a=1<(a>>1)-1?(a>>1)-f:f,i.isubn(c)):c=0,n[o]=c,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,a=0,i=0;e.cmpn(-a)>0||t.cmpn(-i)>0;){var o,c,f=e.andln(3)+a&3,d=t.andln(3)+i&3;3===f&&(f=-1),3===d&&(d=-1),o=0==(1&f)?0:3!==(n=e.andln(7)+a&7)&&5!==n||2!==d?f:-f,r[0].push(o),c=0==(1&d)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==f?d:-d,r[1].push(c),2*a===o+1&&(a=1-a),2*i===c+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new a.a(e,"hex","le")}})),h=b.getNAF,l=b.getJSF,p=b.assert;function m(e,t){this.type=e,this.p=new a.a(t.p,16),this.red=t.prime?a.a.red(t.prime):a.a.mont(this.p),this.zero=new a.a(0).toRed(this.red),this.one=new a.a(1).toRed(this.red),this.two=new a.a(2).toRed(this.red),this.n=t.n&&new a.a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var x=m;function y(e,t){this.curve=e,this.type=t,this.precomputed=null}m.prototype.point=function(){throw new Error("Not implemented")},m.prototype.validate=function(){throw new Error("Not implemented")},m.prototype._fixedNafMul=function(e,t){p(e.precomputed);var r=e._getDoubles(),n=h(t,1,this._bitLength),a=(1<=i;f--)o=(o<<1)+n[f];c.push(o)}for(var d=this.jpoint(null,null,null),s=this.jpoint(null,null,null),u=a;u>0;u--){for(i=0;i=0;c--){for(var f=0;c>=0&&0===i[c];c--)f++;if(c>=0&&f++,o=o.dblp(f),c<0)break;var d=i[c];p(0!==d),o="affine"===e.type?d>0?o.mixedAdd(a[d-1>>1]):o.mixedAdd(a[-d-1>>1].neg()):d>0?o.add(a[d-1>>1]):o.add(a[-d-1>>1].neg())}return"affine"===e.type?o.toP():o},m.prototype._wnafMulAdd=function(e,t,r,n,a){var i,o,c,f=this._wnafT1,d=this._wnafT2,s=this._wnafT3,u=0;for(i=0;i=1;i-=2){var p=i-1,m=i;if(1===f[p]&&1===f[m]){var x=[t[p],null,null,t[m]];0===t[p].y.cmp(t[m].y)?(x[1]=t[p].add(t[m]),x[2]=t[p].toJ().mixedAdd(t[m].neg())):0===t[p].y.cmp(t[m].y.redNeg())?(x[1]=t[p].toJ().mixedAdd(t[m]),x[2]=t[p].add(t[m].neg())):(x[1]=t[p].toJ().mixedAdd(t[m]),x[2]=t[p].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=l(r[p],r[m]);for(u=Math.max(v[0].length,u),s[p]=new Array(u),s[m]=new Array(u),o=0;o=0;i--){for(var k=0;i>=0;){var S=!0;for(o=0;o=0&&k++,_=_.dblp(k),i<0)break;for(o=0;o0?c=d[o][A-1>>1]:A<0&&(c=d[o][-A-1>>1].neg()),_="affine"===c.type?_.mixedAdd(c):_.add(c))}}for(i=0;i=Math.ceil((e.bitLength()+1)/t.step)},y.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,a=0;a=0&&(o=t,c=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),c=c.neg()),[{a:n,b:i},{a:o,b:c}]},w.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),o=a.mul(r.a),c=i.mul(n.a),f=a.mul(r.b),d=i.mul(n.b);return{k1:e.sub(o).sub(c),k2:f.add(d).neg()}},w.prototype.pointFromX=function(e,t){(e=new a.a(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},w.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(a).cmpn(0)},w.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,a=this._endoWnafT2,i=0;i":""},M.prototype.isInfinity=function(){return this.inf},M.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},M.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),a=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=a.redSqr().redISub(this.x.redAdd(this.x)),o=a.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,o)},M.prototype.getX=function(){return this.x.fromRed()},M.prototype.getY=function(){return this.y.fromRed()},M.prototype.mul=function(e){return e=new a.a(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},M.prototype.mulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)},M.prototype.jmulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)},M.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},M.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},M.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},v(k,x.BasePoint),w.prototype.jpoint=function(e,t,r){return new k(this,e,t,r)},k.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},k.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},k.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),a=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),c=n.redSub(a),f=i.redSub(o);if(0===c.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=c.redSqr(),s=d.redMul(c),u=n.redMul(d),b=f.redSqr().redIAdd(s).redISub(u).redISub(u),h=f.redMul(u.redISub(b)).redISub(i.redMul(s)),l=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(b,h,l)},k.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),a=this.y,i=e.y.redMul(t).redMul(this.z),o=r.redSub(n),c=a.redSub(i);if(0===o.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),d=f.redMul(o),s=r.redMul(f),u=c.redSqr().redIAdd(d).redISub(s).redISub(s),b=c.redMul(s.redISub(u)).redISub(a.redMul(d)),h=this.z.redMul(o);return this.curve.jpoint(u,b,h)},k.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(a),0===this.x.cmp(r))return!0}},k.prototype.inspect=function(){return this.isInfinity()?"":""},k.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var S=f((function(e,t){var r=t;r.base=x,r.short=_,r.mont=null,r.edwards=null})),A=f((function(e,t){var r,n=t,a=b.assert;function i(e){"short"===e.type?this.curve=new S.short(e):"edwards"===e.type?this.curve=new S.edwards(e):this.curve=new S.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new i(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=i,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.a.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function E(e){if(!(this instanceof E))return new E(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=u.toArray(e.entropy,e.entropyEnc||"hex"),r=u.toArray(e.nonce,e.nonceEnc||"hex"),n=u.toArray(e.pers,e.persEnc||"hex");d(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var O=E;E.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},E.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=u.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length"};var B=b.assert;function R(e,t){if(e instanceof R)return e;this._importDER(e,t)||(B(e.r&&e.s,"Signature without r or s"),this.r=new a.a(e.r,16),this.s=new a.a(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var C=R;function I(){this.place=0}function L(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var a=0,i=0,o=t.place;i>>=0;return!(a<=127)&&(t.place=o,a)}function N(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}R.prototype._importDER=function(e,t){e=b.toArray(e,t);var r=new I;if(48!==e[r.place++])return!1;var n=L(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=L(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var c=L(e,r);if(!1===c)return!1;if(e.length!==c+r.place)return!1;var f=e.slice(r.place,c+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new a.a(o),this.s=new a.a(f),this.recoveryParam=null,!0},R.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=N(t),r=N(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];U(n,t.length),(n=n.concat(t)).push(2),U(n,r.length);var a=n.concat(r),i=[48];return U(i,a.length),i=i.concat(a),b.encode(i,e)};var z=function(){throw new Error("unsupported")},F=b.assert;function D(e){if(!(this instanceof D))return new D(e);"string"==typeof e&&(F(Object.prototype.hasOwnProperty.call(A,e),"Unknown curve "+e),e=A[e]),e instanceof A.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var H=D;D.prototype.keyPair=function(e){return new j(this,e)},D.prototype.keyFromPrivate=function(e,t){return j.fromPrivate(this,e,t)},D.prototype.keyFromPublic=function(e,t){return j.fromPublic(this,e,t)},D.prototype.genKeyPair=function(e){e||(e={});for(var t=new O({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||z(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new a.a(2));;){var i=new a.a(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},D.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},D.prototype.sign=function(e,t,r,n){"object"===c(r)&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new a.a(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),f=e.toArray("be",i),d=new O({hash:this.hash,entropy:o,nonce:f,pers:n.pers,persEnc:n.persEnc||"utf8"}),s=this.n.sub(new a.a(1)),u=0;;u++){var b=n.k?n.k(u):new a.a(d.generate(this.n.byteLength()));if(!((b=this._truncateToN(b,!0)).cmpn(1)<=0||b.cmp(s)>=0)){var h=this.g.mul(b);if(!h.isInfinity()){var l=h.getX(),p=l.umod(this.n);if(0!==p.cmpn(0)){var m=b.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var x=(h.getY().isOdd()?1:0)|(0!==l.cmp(p)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),x^=1),new C({r:p,s:m,recoveryParam:x})}}}}}},D.prototype.verify=function(e,t,r,n){e=this._truncateToN(new a.a(e,16)),r=this.keyFromPublic(r,n);var i=(t=new C(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c,f=o.invm(this.n),d=f.mul(e).umod(this.n),s=f.mul(i).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(d,r.getPublic(),s)).isInfinity()&&c.eqXToP(i):!(c=this.g.mulAdd(d,r.getPublic(),s)).isInfinity()&&0===c.getX().umod(this.n).cmp(i)},D.prototype.recoverPubKey=function(e,t,r,n){F((3&r)===r,"The recovery param is more than two bits"),t=new C(t,n);var i=this.n,o=new a.a(e),c=t.r,f=t.s,d=1&r,s=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&s)throw new Error("Unable to find sencond key candinate");c=s?this.curve.pointFromX(c.add(this.curve.n),d):this.curve.pointFromX(c,d);var u=t.r.invm(i),b=i.sub(o).mul(u).umod(i),h=f.mul(u).umod(i);return this.g.mulAdd(b,c,h)},D.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new C(t,n)).recoveryParam)return t.recoveryParam;for(var a=0;a<4;a++){var i;try{i=this.recoverPubKey(e,t,a)}catch(e){continue}if(i.eq(r))return a}throw new Error("Unable to find valid recovery factor")};var q=f((function(e,t){var r=t;r.version="6.5.4",r.utils=b,r.rand=function(){throw new Error("unsupported")},r.curve=S,r.curves=A,r.ec=H,r.eddsa=null})).ec}).call(this,r(13))},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.getWindowMetadata=void 0;var a=r(27);t.getWindowMetadata=function(){var e,t;try{e=a.getDocumentOrThrow(),t=a.getLocationOrThrow()}catch(e){return null}function r(){for(var t=arguments.length,r=new Array(t),a=0;a-1){var c=i.getAttribute("href");if(c)if(-1===c.toLowerCase().indexOf("https:")&&-1===c.toLowerCase().indexOf("http:")&&0!==c.indexOf("//")){var f=t.protocol+"//"+t.host;if(0===c.indexOf("/"))f+=c;else{var d=t.pathname.split("/");d.pop(),f+=d.join("/")+"/"+c}n.push(f)}else if(0===c.indexOf("//")){var s=t.protocol+c;n.push(s)}else n.push(c)}}return n}(),name:i}}},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return b}));var n=function(){for(var e=0,t=0,r=arguments.length;t=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),f=r.call(i,"finallyLoc");if(c&&f){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;k(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),b}},e}function c(e,t,r,n,a,i,o){try{var c=e[i](o),f=c.value}catch(e){return void r(e)}c.done?t(f):Promise.resolve(f).then(n,a)}function f(e,t){for(var r=0;r=0;f--)(i=e[f])&&(c=(o<3?i(c):o>3?i(t,r,c):i(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c},o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)},c=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{f(n.next(e))}catch(e){i(e)}}function c(e){try{f(n.throw(e))}catch(e){i(e)}}function f(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}f((n=n.apply(e,t||[])).next())}))},f=this&&this.__generator||function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o},u=this&&this.__spread||function(){for(var e=[],t=0;tt&&c[t].tokenId&&!n)&&(this.updateTokenInfo(c[t],e,t,r),M.saveData(this.data)),[2,c[t]]}))}))},t.prototype.nftList=function(e,t){return c(this,void 0,void 0,(function(){var r,n,a,i,o,c,d,s,u;return f(this,(function(f){switch(f.label){case 0:return t=t||this.currentAccAddr,r=this.wallet.currentChain.id,[4,this.erc721Standard.getBalance(e,t)];case 1:if(n=f.sent(),a=L.getTypeByAddress(r,e),i=a.categor,o=a.type,c=[],i!==L.UNKNOW&&(c=this.currentAccountData.tokenData[r][i+"s"]),d=!1,c.length!==n&&(d=!0),d)for(c.length=0,s=0;s=0?[4,k.parseUrl(t)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2,t]}}))}))},t=i([_.singleton],t)}();t.default=F,o(r(116),t),o(r(862),t),o(r(95),t),o(r(324),t),o(r(288),t),o(r(193),t),o(r(192),t)}).call(this,r(0).Buffer)},,,function(e,t,r){"use strict";t.byteLength=function(e){var t=d(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=d(e),o=n[0],c=n[1],f=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,c)),s=0,u=c>0?o-4:o;for(r=0;r>16&255,f[s++]=t>>8&255,f[s++]=255&t;2===c&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,f[s++]=255&t);1===c&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,f[s++]=t>>8&255,f[s++]=255&t);return f},t.fromByteArray=function(e){for(var t,r=e.length,a=r%3,i=[],o=0,c=r-a;oc?c:o+16383));1===a?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,f=o.length;c0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(e,t,r){for(var a,i,o=[],c=t;c>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(e,t){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ t.read=function(e,t,r,n,a){var i,o,c=8*a-n-1,f=(1<>1,s=-7,u=r?a-1:0,b=r?-1:1,h=e[t+u];for(u+=b,i=h&(1<<-s)-1,h>>=-s,s+=c;s>0;i=256*i+e[t+u],u+=b,s-=8);for(o=i&(1<<-s)-1,i>>=-s,s+=n;s>0;o=256*o+e[t+u],u+=b,s-=8);if(0===i)i=1-d;else{if(i===f)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=d}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,c,f,d=8*i-a-1,s=(1<>1,b=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,l=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=s):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),(t+=o+u>=1?b/f:b*Math.pow(2,1-u))*f>=2&&(o++,f/=2),o+u>=s?(c=0,o=s):o+u>=1?(c=(t*f-1)*Math.pow(2,a),o+=u):(c=t*Math.pow(2,u-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&c,h+=l,c/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=l,o/=256,d-=8);e[r+h-l]|=128*p}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractPublicKey=t.recoverPersonalSignature=t.personalSign=void 0;var n=r(122),a=r(103);function i(e,t){var r=n.hashPersonalMessage(a.legacyToBuffer(e));return a.recoverPublicKey(r,t)}t.personalSign=function(e){var t=e.privateKey,r=e.data;if(a.isNullish(r))throw new Error("Missing data parameter");if(a.isNullish(t))throw new Error("Missing privateKey parameter");var i=a.legacyToBuffer(r),o=n.hashPersonalMessage(i),c=n.ecsign(o,t);return a.concatSig(n.toBuffer(c.v),c.r,c.s)},t.recoverPersonalSignature=function(e){var t=e.data,r=e.signature;if(a.isNullish(t))throw new Error("Missing data parameter");if(a.isNullish(r))throw new Error("Missing signature parameter");var o=i(t,r),c=n.publicToAddress(o);return n.bufferToHex(c)},t.extractPublicKey=function(e){var t=e.data,r=e.signature;if(a.isNullish(t))throw new Error("Missing data parameter");if(a.isNullish(r))throw new Error("Missing signature parameter");var n=i(t,r);return"0x".concat(n.toString("hex"))}},function(e,t){function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,f=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){f=!0,o=e},f:function(){try{c||null==r.return||r.return()}finally{if(f)throw o}}}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&void 0!==arguments[0]?arguments[0]:function(e){return new Uint8Array(e)},t=arguments.length>1?arguments[1]:void 0;return"function"==typeof e&&(e=e(t)),x("output",e,t),e}function g(e){return Object.prototype.toString.call(e).slice(8,-1)}e.exports=function(e){return{contextRandomize:function(t){switch(m(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&x("seed",t,32),e.contextRandomize(t)){case 1:throw new Error(c)}},privateKeyVerify:function(t){return x("private key",t,32),0===e.privateKeyVerify(t)},privateKeyNegate:function(t){switch(x("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(a)}},privateKeyTweakAdd:function(t,r){switch(x("private key",t,32),x("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(i)}},privateKeyTweakMul:function(t,r){switch(x("private key",t,32),x("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(o)}},publicKeyVerify:function(t){return x("public key",t,[33,65]),0===e.publicKeyVerify(t)},publicKeyCreate:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;switch(x("private key",t,32),y(r),n=v(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(f);case 2:throw new Error(s)}},publicKeyConvert:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;switch(x("public key",t,[33,65]),y(r),n=v(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(d);case 2:throw new Error(s)}},publicKeyNegate:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;switch(x("public key",t,[33,65]),y(r),n=v(n,r?33:65),e.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(d);case 2:throw new Error(a);case 3:throw new Error(s)}},publicKeyCombine:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=arguments.length>2?arguments[2]:void 0;m(Array.isArray(t),"Expected public keys to be an Array"),m(t.length>0,"Expected public keys array will have more than zero items");var i,o=r(t);try{for(o.s();!(i=o.n()).done;){var c=i.value;x("public key",c,[33,65])}}catch(e){o.e(e)}finally{o.f()}switch(y(n),a=v(a,n?33:65),e.publicKeyCombine(a,t)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(u);case 3:throw new Error(s)}},publicKeyTweakAdd:function(t,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3?arguments[3]:void 0;switch(x("public key",t,[33,65]),x("tweak",r,32),y(n),a=v(a,n?33:65),e.publicKeyTweakAdd(a,t,r)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(i)}},publicKeyTweakMul:function(t,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3?arguments[3]:void 0;switch(x("public key",t,[33,65]),x("tweak",r,32),y(n),a=v(a,n?33:65),e.publicKeyTweakMul(a,t,r)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(o)}},signatureNormalize:function(t){switch(x("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(b)}},signatureExport:function(t,r){x("signature",t,64);var n={output:r=v(r,72),outputlen:72};switch(e.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(b);case 2:throw new Error(a)}},signatureImport:function(t,r){switch(x("signature",t),r=v(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(b);case 2:throw new Error(a)}},ecdsaSign:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;x("message",t,32),x("private key",r,32),m("Object"===g(n),"Expected options to be an Object"),void 0!==n.data&&x("options.data",n.data),void 0!==n.noncefn&&m("Function"===g(n.noncefn),"Expected options.noncefn to be a Function");var o={signature:i=v(i,64),recid:null};switch(e.ecdsaSign(o,t,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(h);case 2:throw new Error(a)}},ecdsaVerify:function(t,r,n){switch(x("signature",t,64),x("message",r,32),x("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(b);case 2:throw new Error(d)}},ecdsaRecover:function(t,r,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4?arguments[4]:void 0;switch(x("signature",t,64),m("Number"===g(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),x("message",n,32),y(i),o=v(o,i?33:65),e.ecdsaRecover(o,t,r,n)){case 0:return o;case 1:throw new Error(b);case 2:throw new Error(l);case 3:throw new Error(a)}},ecdh:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;switch(x("public key",t,[33,65]),x("private key",r,32),m("Object"===g(n),"Expected options to be an Object"),void 0!==n.data&&x("options.data",n.data),void 0!==n.hashfn?(m("Function"===g(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&x("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&x("options.ybuf",n.ybuf,32),x("output",a)):a=v(a,32),e.ecdh(a,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(p)}}}}},function(e,t,r){var n=new(0,r(36).ec)("secp256k1"),a=n.curve,i=a.n.constructor;function o(e){var t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){var r=new i(t);if(r.cmp(a.p)>=0)return null;var o=(r=r.toRed(a.red)).redSqr().redIMul(r).redIAdd(a.b).redSqrt();return 3===e!==o.isOdd()&&(o=o.redNeg()),n.keyPair({pub:{x:r,y:o}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){var o=new i(t),c=new i(r);if(o.cmp(a.p)>=0||c.cmp(a.p)>=0)return null;if(o=o.toRed(a.red),c=c.toRed(a.red),(6===e||7===e)&&c.isOdd()!==(7===e))return null;var f=o.redSqr().redIMul(o);return c.redSqr().redISub(f.redIAdd(a.b)).isZero()?n.keyPair({pub:{x:o,y:c}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function c(e,t){for(var r=t.encode(null,33===e.length),n=0;n=0)return 1;if(r.iadd(new i(e)),r.cmp(a.n)>=0&&r.isub(a.n),r.isZero())return 1;var n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul:function(e,t){var r=new i(t);if(r.cmp(a.n)>=0||r.isZero())return 1;r.imul(new i(e)),r.cmp(a.n)>=0&&(r=r.umod(a.n));var n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:function(e){return null===o(e)?1:0},publicKeyCreate:function(e,t){var r=new i(t);return r.cmp(a.n)>=0||r.isZero()?1:(c(e,n.keyFromPrivate(t).getPublic()),0)},publicKeyConvert:function(e,t){var r=o(t);return null===r?1:(c(e,r.getPublic()),0)},publicKeyNegate:function(e,t){var r=o(t);if(null===r)return 1;var n=r.getPublic();return n.y=n.y.redNeg(),c(e,n),0},publicKeyCombine:function(e,t){for(var r=new Array(t.length),n=0;n=0)return 2;var f=n.getPublic().add(a.g.mul(r));return f.isInfinity()?2:(c(e,f),0)},publicKeyTweakMul:function(e,t,r){var n=o(t);return null===n?1:(r=new i(r)).cmp(a.n)>=0||r.isZero()?2:(c(e,n.getPublic().mul(r)),0)},signatureNormalize:function(e){var t=new i(e.subarray(0,32)),r=new i(e.subarray(32,64));return t.cmp(a.n)>=0||r.cmp(a.n)>=0?1:(1===r.cmp(n.nh)&&e.set(a.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport:function(e,t){var r=t.subarray(0,32),n=t.subarray(32,64);if(new i(r).cmp(a.n)>=0)return 1;if(new i(n).cmp(a.n)>=0)return 1;var o=e.output,c=o.subarray(4,37);c[0]=0,c.set(r,1);for(var f=33,d=0;f>1&&0===c[d]&&!(128&c[d+1]);--f,++d);if(128&(c=c.subarray(d))[0])return 1;if(f>1&&0===c[0]&&!(128&c[1]))return 1;var s=o.subarray(39,72);s[0]=0,s.set(n,1);for(var u=33,b=0;u>1&&0===s[b]&&!(128&s[b+1]);--u,++b);return 128&(s=s.subarray(b))[0]||u>1&&0===s[0]&&!(128&s[1])?1:(e.outputlen=6+f+u,o[0]=48,o[1]=e.outputlen-2,o[2]=2,o[3]=c.length,o.set(c,4),o[4+f]=2,o[5+f]=s.length,o.set(s,6+f),0)},signatureImport:function(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;var r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;var n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;var o=t.subarray(4,4+r);if(33===o.length&&0===o[0]&&(o=o.subarray(1)),o.length>32)return 1;var c=t.subarray(6+r);if(33===c.length&&0===c[0]&&(c=c.slice(1)),c.length>32)throw new Error("S length is too long");var f=new i(o);f.cmp(a.n)>=0&&(f=new i(0));var d=new i(t.subarray(6+r));return d.cmp(a.n)>=0&&(d=new i(0)),e.set(f.toArrayLike(Uint8Array,"be",32),0),e.set(d.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign:function(e,t,r,o,c){if(c){var f=c;c=function(e){var n=f(t,r,null,o,e);if(!(n instanceof Uint8Array&&32===n.length))throw new Error("This is the way");return new i(n)}}var d,s=new i(r);if(s.cmp(a.n)>=0||s.isZero())return 1;try{d=n.sign(t,r,{canonical:!0,k:c,pers:o})}catch(e){return 1}return e.signature.set(d.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(d.s.toArrayLike(Uint8Array,"be",32),32),e.recid=d.recoveryParam,0},ecdsaVerify:function(e,t,r){var c={r:e.subarray(0,32),s:e.subarray(32,64)},f=new i(c.r),d=new i(c.s);if(f.cmp(a.n)>=0||d.cmp(a.n)>=0)return 1;if(1===d.cmp(n.nh)||f.isZero()||d.isZero())return 3;var s=o(r);if(null===s)return 2;var u=s.getPublic();return n.verify(t,c,u)?0:3},ecdsaRecover:function(e,t,r,o){var f,d={r:t.slice(0,32),s:t.slice(32,64)},s=new i(d.r),u=new i(d.s);if(s.cmp(a.n)>=0||u.cmp(a.n)>=0)return 1;if(s.isZero()||u.isZero())return 2;try{f=n.recoverPubKey(o,d,r)}catch(e){return 2}return c(e,f),0},ecdh:function(e,t,r,c,f,d,s){var u=o(t);if(null===u)return 1;var b=new i(r);if(b.cmp(a.n)>=0||b.isZero())return 2;var h=u.getPublic().mul(b);if(void 0===f)for(var l=h.encode(null,!0),p=n.hash().update(l).digest(),m=0;m<32;++m)e[m]=p[m];else{d||(d=new Uint8Array(32));for(var x=h.getX().toArray("be",32),y=0;y<32;++y)d[y]=x[y];s||(s=new Uint8Array(32));for(var v=h.getY().toArray("be",32),g=0;g<32;++g)s[g]=v[g];var w=f(d,s,c);if(!(w instanceof Uint8Array&&w.length===e.length))return 2;e.set(w)}return 0}}},function(e){e.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')},function(e,t){},function(e,t){},function(e,t,r){"use strict";var n=r(29),a=r(9),i=r(4),o=r(100),c=n.assert;function f(e){o.call(this,"short",e),this.a=new a(e.a,16).toRed(this.red),this.b=new a(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function d(e,t,r,n){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new a(t,16),this.y=new a(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(e,t,r,n){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new a(0)):(this.x=new a(t,16),this.y=new a(r,16),this.z=new a(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}i(f,o),e.exports=f,f.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new a(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new a(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],c(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new a(e.a,16),b:new a(e.b,16)}})):this._getEndoBasis(r)}}},f.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:a.mont(e),r=new a(2).toRed(t).redInvm(),n=r.redNeg(),i=new a(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},f.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,c,f,d,s,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),b=e,h=this.n.clone(),l=new a(1),p=new a(0),m=new a(0),x=new a(1),y=0;0!==b.cmpn(0);){var v=h.div(b);d=h.sub(v.mul(b)),s=m.sub(v.mul(l));var g=x.sub(v.mul(p));if(!n&&d.cmp(u)<0)t=f.neg(),r=l,n=d.neg(),i=s;else if(n&&2==++y)break;f=d,h=b,b=d,m=l,l=s,x=p,p=g}o=d.neg(),c=s;var w=n.sqr().add(i.sqr());return o.sqr().add(c.sqr()).cmp(w)>=0&&(o=t,c=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),c=c.neg()),[{a:n,b:i},{a:o,b:c}]},f.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),o=a.mul(r.a),c=i.mul(n.a),f=a.mul(r.b),d=i.mul(n.b);return{k1:e.sub(o).sub(c),k2:f.add(d).neg()}},f.prototype.pointFromX=function(e,t){(e=new a(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},f.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(a).cmpn(0)},f.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,a=this._endoWnafT2,i=0;i":""},d.prototype.isInfinity=function(){return this.inf},d.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},d.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),a=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=a.redSqr().redISub(this.x.redAdd(this.x)),o=a.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,o)},d.prototype.getX=function(){return this.x.fromRed()},d.prototype.getY=function(){return this.y.fromRed()},d.prototype.mul=function(e){return e=new a(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},d.prototype.mulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)},d.prototype.jmulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,2,!0)},d.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},d.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},d.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},i(s,o.BasePoint),f.prototype.jpoint=function(e,t,r){return new s(this,e,t,r)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),a=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),c=n.redSub(a),f=i.redSub(o);if(0===c.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=c.redSqr(),s=d.redMul(c),u=n.redMul(d),b=f.redSqr().redIAdd(s).redISub(u).redISub(u),h=f.redMul(u.redISub(b)).redISub(i.redMul(s)),l=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(b,h,l)},s.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),a=this.y,i=e.y.redMul(t).redMul(this.z),o=r.redSub(n),c=a.redSub(i);if(0===o.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),d=f.redMul(o),s=r.redMul(f),u=c.redSqr().redIAdd(d).redISub(s).redISub(s),b=c.redMul(s.redISub(u)).redISub(a.redMul(d)),h=this.z.redMul(o);return this.curve.jpoint(u,b,h)},s.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(a),0===this.x.cmp(r))return!0}},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var n=r(9),a=r(4),i=r(100),o=r(29);function c(e){i.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(e,t,r){i.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}a(c,i),e.exports=c,c.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},a(f,i.BasePoint),c.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},c.prototype.point=function(e,t){return new f(this,e,t)},c.prototype.pointFromJSON=function(e){return f.fromJSON(this,e)},f.prototype.precompute=function(){},f.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function(e,t){return new f(e,t[0],t[1]||e.one)},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},f.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),a=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,a)},f.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),a=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),o=a.redMul(n),c=t.z.redMul(i.redAdd(o).redSqr()),f=t.x.redMul(i.redISub(o).redSqr());return this.curve.point(c,f)},f.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),a=[];0!==t.cmpn(0);t.iushrn(1))a.push(t.andln(1));for(var i=a.length-1;i>=0;i--)0===a[i]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},f.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},f.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var n=r(29),a=r(9),i=r(4),o=r(100),c=n.assert;function f(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new a(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function d(e,t,r,n,i){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new a(t,16),this.y=new a(r,16),this.z=n?new a(n,16):this.curve.one,this.t=i&&new a(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}i(f,o),e.exports=f,f.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},f.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},f.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},f.prototype.pointFromX=function(e,t){(e=new a(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),c=o.redSqrt();if(0!==c.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var f=c.fromRed().isOdd();return(t&&!f||!t&&f)&&(c=c.redNeg()),this.point(e,c)},f.prototype.pointFromY=function(e,t){(e=new a(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var c=o.redSqrt();if(0!==c.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return c.fromRed().isOdd()!==t&&(c=c.redNeg()),this.point(c,e)},f.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(a)},i(d,o.BasePoint),f.prototype.pointFromJSON=function(e){return d.fromJSON(this,e)},f.prototype.point=function(e,t,r,n){return new d(this,e,t,r,n)},d.fromJSON=function(e,t){return new d(e,t[0],t[1],t[2])},d.prototype.inspect=function(){return this.isInfinity()?"":""},d.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},d.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),a=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),o=i.redSub(r),c=n.redSub(t),f=a.redMul(o),d=i.redMul(c),s=a.redMul(c),u=o.redMul(i);return this.curve.point(f,d,u,s)},d.prototype._projDbl=function(){var e,t,r,n,a,i,o=this.x.redAdd(this.y).redSqr(),c=this.x.redSqr(),f=this.y.redSqr();if(this.curve.twisted){var d=(n=this.curve._mulA(c)).redAdd(f);this.zOne?(e=o.redSub(c).redSub(f).redMul(d.redSub(this.curve.two)),t=d.redMul(n.redSub(f)),r=d.redSqr().redSub(d).redSub(d)):(a=this.z.redSqr(),i=d.redSub(a).redISub(a),e=o.redSub(c).redISub(f).redMul(i),t=d.redMul(n.redSub(f)),r=d.redMul(i))}else n=c.redAdd(f),a=this.curve._mulC(this.z).redSqr(),i=n.redSub(a).redSub(a),e=this.curve._mulC(o.redISub(n)).redMul(i),t=this.curve._mulC(n).redMul(c.redISub(f)),r=n.redMul(i);return this.curve.point(e,t,r)},d.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},d.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),a=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),o=a.redSub(n),c=a.redAdd(n),f=r.redAdd(t),d=i.redMul(o),s=c.redMul(f),u=i.redMul(f),b=o.redMul(c);return this.curve.point(d,s,b,u)},d.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),a=n.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),c=this.curve.d.redMul(i).redMul(o),f=a.redSub(c),d=a.redAdd(c),s=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),u=n.redMul(f).redMul(s);return this.curve.twisted?(t=n.redMul(d).redMul(o.redSub(this.curve._mulA(i))),r=f.redMul(d)):(t=n.redMul(d).redMul(o.redSub(i)),r=this.curve._mulC(f).redMul(d)),this.curve.point(u,t,r)},d.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},d.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},d.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},d.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},d.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},d.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},d.prototype.getX=function(){return this.normalize(),this.x.fromRed()},d.prototype.getY=function(){return this.normalize(),this.y.fromRed()},d.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},d.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},d.prototype.toP=d.prototype.normalize,d.prototype.mixedAdd=d.prototype.add},function(e,t,r){"use strict";t.sha1=r(388),t.sha224=r(389),t.sha256=r(127),t.sha384=r(390),t.sha512=r(202)},function(e,t,r){"use strict";var n=r(35),a=r(80),i=r(201),o=n.rotl32,c=n.sum32,f=n.sum32_5,d=i.ft_1,s=a.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function b(){if(!(this instanceof b))return new b;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(b,s),e.exports=b,b.blockSize=512,b.outSize=160,b.hmacStrength=80,b.padLength=64,b.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),a(e.length<=this.blockSize);for(var t=e.length;t0))return o.iaddn(1),this.keyFromPrivate(o)}},b.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},b.prototype.sign=function(e,t,r,o){"object"===n(r)&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new a(e,16));for(var c=this.n.byteLength(),f=t.getPrivate().toArray("be",c),d=e.toArray("be",c),s=new i({hash:this.hash,entropy:f,nonce:d,pers:o.pers,persEnc:o.persEnc||"utf8"}),b=this.n.sub(new a(1)),h=0;;h++){var l=o.k?o.k(h):new a(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(b)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var m=p.getX(),x=m.umod(this.n);if(0!==x.cmpn(0)){var y=l.invm(this.n).mul(x.mul(t.getPrivate()).iadd(e));if(0!==(y=y.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==m.cmp(x)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),v^=1),new u({r:x,s:y,recoveryParam:v})}}}}}},b.prototype.verify=function(e,t,r,n){e=this._truncateToN(new a(e,16)),r=this.keyFromPublic(r,n);var i=(t=new u(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var c,f=o.invm(this.n),d=f.mul(e).umod(this.n),s=f.mul(i).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(d,r.getPublic(),s)).isInfinity()&&c.eqXToP(i):!(c=this.g.mulAdd(d,r.getPublic(),s)).isInfinity()&&0===c.getX().umod(this.n).cmp(i)},b.prototype.recoverPubKey=function(e,t,r,n){d((3&r)===r,"The recovery param is more than two bits"),t=new u(t,n);var i=this.n,o=new a(e),c=t.r,f=t.s,s=1&r,b=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&b)throw new Error("Unable to find sencond key candinate");c=b?this.curve.pointFromX(c.add(this.curve.n),s):this.curve.pointFromX(c,s);var h=t.r.invm(i),l=i.sub(o).mul(h).umod(i),p=f.mul(h).umod(i);return this.g.mulAdd(l,c,p)},b.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new u(t,n)).recoveryParam)return t.recoveryParam;for(var a=0;a<4;a++){var i;try{i=this.recoverPubKey(e,t,a)}catch(e){continue}if(i.eq(r))return a}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var n=r(26),a=r(199),i=r(30);function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=a.toArray(e.entropy,e.entropyEnc||"hex"),r=a.toArray(e.nonce,e.nonceEnc||"hex"),n=a.toArray(e.pers,e.persEnc||"hex");i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=o,o.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=a.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"}},function(e,t,r){"use strict";var n=r(9),a=r(29),i=a.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(i(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function c(){this.place=0}function f(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var a=0,i=0,o=t.place;i>>=0;return!(a<=127)&&(t.place=o,a)}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=o,o.prototype._importDER=function(e,t){e=a.toArray(e,t);var r=new c;if(48!==e[r.place++])return!1;var i=f(e,r);if(!1===i)return!1;if(i+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=f(e,r);if(!1===o)return!1;var d=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var s=f(e,r);if(!1===s)return!1;if(e.length!==s+r.place)return!1;var u=e.slice(r.place,s+r.place);if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}return this.r=new n(d),this.s=new n(u),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];s(n,t.length),(n=n.concat(t)).push(2),s(n,r.length);var i=n.concat(r),o=[48];return s(o,i.length),o=o.concat(i),a.encode(o,e)}},function(e,t,r){"use strict";var n=r(26),a=r(126),i=r(29),o=i.assert,c=i.parseBytes,f=r(398),d=r(399);function s(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof s))return new s(e);e=a[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=s,s.prototype.sign=function(e,t){e=c(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),a=this.g.mul(n),i=this.encodePoint(a),o=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),f=n.add(o).umod(this.curve.n);return this.makeSignature({R:a,S:f,Rencoded:i})},s.prototype.verify=function(e,t,r){e=c(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),a=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(a)).eq(i)},s.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=0)throw new Error("couldn't export to DER format");var c=a.g.mul(r);return o(c.getX(),c.getY(),t)},t.privateKeyModInverse=function(t){var r=new n(t);if(r.ucmp(i.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(i.n).toArrayLike(e,"be",32)},t.signatureImport=function(t){var r=new n(t.r);r.ucmp(i.n)>=0&&(r=new n(0));var a=new n(t.s);return a.ucmp(i.n)>=0&&(a=new n(0)),e.concat([r.toArrayLike(e,"be",32),a.toArrayLike(e,"be",32)])},t.ecdhUnsafe=function(e,t,r){void 0===r&&(r=!0);var c=a.keyFromPublic(e),f=new n(t);if(f.ucmp(i.n)>=0||f.isZero())throw new Error("scalar was invalid (zero or overflow)");var d=c.pub.mul(f);return o(d.getX(),d.getY(),r)};var o=function(t,r,n){var a;return n?((a=e.alloc(33))[0]=r.isOdd()?3:2,t.toArrayLike(e,"be",32).copy(a,1)):((a=e.alloc(65))[0]=4,t.toArrayLike(e,"be",32).copy(a,1),r.toArrayLike(e,"be",32).copy(a,33)),a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=e.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=e.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(t,a,i){void 0===i&&(i=!0);var o=e.from(i?r:n);return t.copy(o,i?8:9),a.copy(o,i?181:214),o},t.privateKeyImport=function(e){var t=e.length,r=0;if(t2)return null;if(t<(r+=1)+n)return null;var a=e[r+n-1]|(n>1?e[r+n-2]<<8:0);return t<(r+=n)+a||t32||ta)return null;if(2!==t[i++])return null;var c=t[i++];if(128&c){if(i+(o=c-128)>a)return null;for(;o>0&&0===t[i];i+=1,o-=1);for(c=0;o>0;i+=1,o-=1)c=(c<<8)+t[i]}if(c>a-i)return null;var f=i;if(i+=c,2!==t[i++])return null;var d=t[i++];if(128&d){if(i+(o=d-128)>a)return null;for(;o>0&&0===t[i];i+=1,o-=1);for(d=0;o>0;i+=1,o-=1)d=(d<<8)+t[i]}if(d>a-i)return null;var s=i;for(i+=d;c>0&&0===t[f];c-=1,f+=1);if(c>32)return null;var u=t.slice(f,f+c);for(u.copy(r,32-u.length);d>0&&0===t[s];d-=1,s+=1);if(d>32)return null;var b=t.slice(s,s+d);return b.copy(n,32-b.length),{r:r,s:n}}}).call(this,r(0).Buffer)},function(e,t,r){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,n){"use strict";function a(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var c;"object"===t(e)?e.exports=o:n.BN=o,o.BN=o,o.wordSize=26;try{c="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(404).Buffer}catch(e){}function f(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void a(!1,"Invalid character in "+e)}function d(e,t,r){var n=f(e,r);return r-1>=t&&(n|=f(e,r-1)<<4),n}function s(e,t,r,n){for(var i=0,o=0,c=Math.min(e.length,r),f=t;f=49?d-49+10:d>=17?d-17+10:d,a(d>=0&&o0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,r,n){if("number"==typeof e)return this._initNumber(e,r,n);if("object"===t(e))return this._initArray(e,r,n);"hex"===r&&(r=16),a(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);else if("le"===r)for(n=0,i=0;n>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)a=d(e,t,n)<=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=t)n++;n--,a=a/t|0;for(var i=e.length-r,o=i%n,c=Math.min(i,i-o)+r,f=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=b}catch(e){o.prototype.inspect=b}else o.prototype.inspect=b;function b(){return(this.red?""}var h=["","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"],l=[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],p=[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];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==i||o!==this.length-1?h[6-f.length]+f+r:f+r}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],s=p[e];r="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(s).toString(e);r=(u=u.idivn(s)).isZero()?b+r:h[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}a(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},c&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var a=0|e.words[0],i=0|t.words[0],o=a*i,c=67108863&o,f=o/67108864|0;r.words[0]=c;for(var d=1;d>>26,u=67108863&f,b=Math.min(d,t.length-1),h=Math.max(0,d-e.length+1);h<=b;h++){var l=d-h|0;s+=(o=(a=0|e.words[l])*(i=0|t.words[h])+u)/67108864|0,u=67108863&o}r.words[d]=0|u,f=0|s}return 0!==f?r.words[d]=0|f:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),i=r||Math.max(1,n);a(n<=i,"byte array longer than desired length"),a(i>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,a=0,i=0;a>8&255),r>16&255),6===i?(r>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===i?(r>=0&&(e[r--]=o>>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){a("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){a("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,a=this.cmp(e);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,h=0|o[1],l=8191&h,p=h>>>13,m=0|o[2],x=8191&m,y=m>>>13,v=0|o[3],g=8191&v,w=v>>>13,_=0|o[4],M=8191&_,k=_>>>13,S=0|o[5],A=8191&S,E=S>>>13,O=0|o[6],T=8191&O,P=O>>>13,j=0|o[7],B=8191&j,R=j>>>13,C=0|o[8],I=8191&C,L=C>>>13,N=0|o[9],U=8191&N,z=N>>>13,F=0|c[0],D=8191&F,H=F>>>13,q=0|c[1],K=8191&q,G=q>>>13,W=0|c[2],V=8191&W,Z=W>>>13,J=0|c[3],X=8191&J,Y=J>>>13,$=0|c[4],Q=8191&$,ee=$>>>13,te=0|c[5],re=8191&te,ne=te>>>13,ae=0|c[6],ie=8191&ae,oe=ae>>>13,ce=0|c[7],fe=8191&ce,de=ce>>>13,se=0|c[8],ue=8191&se,be=se>>>13,he=0|c[9],le=8191&he,pe=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(d+(n=Math.imul(u,D))|0)+((8191&(a=(a=Math.imul(u,H))+Math.imul(b,D)|0))<<13)|0;d=((i=Math.imul(b,H))+(a>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(l,D),a=(a=Math.imul(l,H))+Math.imul(p,D)|0,i=Math.imul(p,H);var xe=(d+(n=n+Math.imul(u,K)|0)|0)+((8191&(a=(a=a+Math.imul(u,G)|0)+Math.imul(b,K)|0))<<13)|0;d=((i=i+Math.imul(b,G)|0)+(a>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(x,D),a=(a=Math.imul(x,H))+Math.imul(y,D)|0,i=Math.imul(y,H),n=n+Math.imul(l,K)|0,a=(a=a+Math.imul(l,G)|0)+Math.imul(p,K)|0,i=i+Math.imul(p,G)|0;var ye=(d+(n=n+Math.imul(u,V)|0)|0)+((8191&(a=(a=a+Math.imul(u,Z)|0)+Math.imul(b,V)|0))<<13)|0;d=((i=i+Math.imul(b,Z)|0)+(a>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(g,D),a=(a=Math.imul(g,H))+Math.imul(w,D)|0,i=Math.imul(w,H),n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,G)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(l,V)|0,a=(a=a+Math.imul(l,Z)|0)+Math.imul(p,V)|0,i=i+Math.imul(p,Z)|0;var ve=(d+(n=n+Math.imul(u,X)|0)|0)+((8191&(a=(a=a+Math.imul(u,Y)|0)+Math.imul(b,X)|0))<<13)|0;d=((i=i+Math.imul(b,Y)|0)+(a>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(M,D),a=(a=Math.imul(M,H))+Math.imul(k,D)|0,i=Math.imul(k,H),n=n+Math.imul(g,K)|0,a=(a=a+Math.imul(g,G)|0)+Math.imul(w,K)|0,i=i+Math.imul(w,G)|0,n=n+Math.imul(x,V)|0,a=(a=a+Math.imul(x,Z)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,Z)|0,n=n+Math.imul(l,X)|0,a=(a=a+Math.imul(l,Y)|0)+Math.imul(p,X)|0,i=i+Math.imul(p,Y)|0;var ge=(d+(n=n+Math.imul(u,Q)|0)|0)+((8191&(a=(a=a+Math.imul(u,ee)|0)+Math.imul(b,Q)|0))<<13)|0;d=((i=i+Math.imul(b,ee)|0)+(a>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,D),a=(a=Math.imul(A,H))+Math.imul(E,D)|0,i=Math.imul(E,H),n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,G)|0)+Math.imul(k,K)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(g,V)|0,a=(a=a+Math.imul(g,Z)|0)+Math.imul(w,V)|0,i=i+Math.imul(w,Z)|0,n=n+Math.imul(x,X)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(l,Q)|0,a=(a=a+Math.imul(l,ee)|0)+Math.imul(p,Q)|0,i=i+Math.imul(p,ee)|0;var we=(d+(n=n+Math.imul(u,re)|0)|0)+((8191&(a=(a=a+Math.imul(u,ne)|0)+Math.imul(b,re)|0))<<13)|0;d=((i=i+Math.imul(b,ne)|0)+(a>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,D),a=(a=Math.imul(T,H))+Math.imul(P,D)|0,i=Math.imul(P,H),n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,G)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,G)|0,n=n+Math.imul(M,V)|0,a=(a=a+Math.imul(M,Z)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,Z)|0,n=n+Math.imul(g,X)|0,a=(a=a+Math.imul(g,Y)|0)+Math.imul(w,X)|0,i=i+Math.imul(w,Y)|0,n=n+Math.imul(x,Q)|0,a=(a=a+Math.imul(x,ee)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(l,re)|0,a=(a=a+Math.imul(l,ne)|0)+Math.imul(p,re)|0,i=i+Math.imul(p,ne)|0;var _e=(d+(n=n+Math.imul(u,ie)|0)|0)+((8191&(a=(a=a+Math.imul(u,oe)|0)+Math.imul(b,ie)|0))<<13)|0;d=((i=i+Math.imul(b,oe)|0)+(a>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(B,D),a=(a=Math.imul(B,H))+Math.imul(R,D)|0,i=Math.imul(R,H),n=n+Math.imul(T,K)|0,a=(a=a+Math.imul(T,G)|0)+Math.imul(P,K)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(A,V)|0,a=(a=a+Math.imul(A,Z)|0)+Math.imul(E,V)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(M,X)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(k,X)|0,i=i+Math.imul(k,Y)|0,n=n+Math.imul(g,Q)|0,a=(a=a+Math.imul(g,ee)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,ee)|0,n=n+Math.imul(x,re)|0,a=(a=a+Math.imul(x,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(l,ie)|0,a=(a=a+Math.imul(l,oe)|0)+Math.imul(p,ie)|0,i=i+Math.imul(p,oe)|0;var Me=(d+(n=n+Math.imul(u,fe)|0)|0)+((8191&(a=(a=a+Math.imul(u,de)|0)+Math.imul(b,fe)|0))<<13)|0;d=((i=i+Math.imul(b,de)|0)+(a>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,D),a=(a=Math.imul(I,H))+Math.imul(L,D)|0,i=Math.imul(L,H),n=n+Math.imul(B,K)|0,a=(a=a+Math.imul(B,G)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(T,V)|0,a=(a=a+Math.imul(T,Z)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(A,X)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,a=(a=a+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(g,re)|0,a=(a=a+Math.imul(g,ne)|0)+Math.imul(w,re)|0,i=i+Math.imul(w,ne)|0,n=n+Math.imul(x,ie)|0,a=(a=a+Math.imul(x,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(l,fe)|0,a=(a=a+Math.imul(l,de)|0)+Math.imul(p,fe)|0,i=i+Math.imul(p,de)|0;var ke=(d+(n=n+Math.imul(u,ue)|0)|0)+((8191&(a=(a=a+Math.imul(u,be)|0)+Math.imul(b,ue)|0))<<13)|0;d=((i=i+Math.imul(b,be)|0)+(a>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,D),a=(a=Math.imul(U,H))+Math.imul(z,D)|0,i=Math.imul(z,H),n=n+Math.imul(I,K)|0,a=(a=a+Math.imul(I,G)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,G)|0,n=n+Math.imul(B,V)|0,a=(a=a+Math.imul(B,Z)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(T,X)|0,a=(a=a+Math.imul(T,Y)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(A,Q)|0,a=(a=a+Math.imul(A,ee)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(M,re)|0,a=(a=a+Math.imul(M,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(g,ie)|0,a=(a=a+Math.imul(g,oe)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,oe)|0,n=n+Math.imul(x,fe)|0,a=(a=a+Math.imul(x,de)|0)+Math.imul(y,fe)|0,i=i+Math.imul(y,de)|0,n=n+Math.imul(l,ue)|0,a=(a=a+Math.imul(l,be)|0)+Math.imul(p,ue)|0,i=i+Math.imul(p,be)|0;var Se=(d+(n=n+Math.imul(u,le)|0)|0)+((8191&(a=(a=a+Math.imul(u,pe)|0)+Math.imul(b,le)|0))<<13)|0;d=((i=i+Math.imul(b,pe)|0)+(a>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,K),a=(a=Math.imul(U,G))+Math.imul(z,K)|0,i=Math.imul(z,G),n=n+Math.imul(I,V)|0,a=(a=a+Math.imul(I,Z)|0)+Math.imul(L,V)|0,i=i+Math.imul(L,Z)|0,n=n+Math.imul(B,X)|0,a=(a=a+Math.imul(B,Y)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(T,Q)|0,a=(a=a+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(A,re)|0,a=(a=a+Math.imul(A,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(M,ie)|0,a=(a=a+Math.imul(M,oe)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,oe)|0,n=n+Math.imul(g,fe)|0,a=(a=a+Math.imul(g,de)|0)+Math.imul(w,fe)|0,i=i+Math.imul(w,de)|0,n=n+Math.imul(x,ue)|0,a=(a=a+Math.imul(x,be)|0)+Math.imul(y,ue)|0,i=i+Math.imul(y,be)|0;var Ae=(d+(n=n+Math.imul(l,le)|0)|0)+((8191&(a=(a=a+Math.imul(l,pe)|0)+Math.imul(p,le)|0))<<13)|0;d=((i=i+Math.imul(p,pe)|0)+(a>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,V),a=(a=Math.imul(U,Z))+Math.imul(z,V)|0,i=Math.imul(z,Z),n=n+Math.imul(I,X)|0,a=(a=a+Math.imul(I,Y)|0)+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(B,Q)|0,a=(a=a+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,a=(a=a+Math.imul(T,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(A,ie)|0,a=(a=a+Math.imul(A,oe)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,oe)|0,n=n+Math.imul(M,fe)|0,a=(a=a+Math.imul(M,de)|0)+Math.imul(k,fe)|0,i=i+Math.imul(k,de)|0,n=n+Math.imul(g,ue)|0,a=(a=a+Math.imul(g,be)|0)+Math.imul(w,ue)|0,i=i+Math.imul(w,be)|0;var Ee=(d+(n=n+Math.imul(x,le)|0)|0)+((8191&(a=(a=a+Math.imul(x,pe)|0)+Math.imul(y,le)|0))<<13)|0;d=((i=i+Math.imul(y,pe)|0)+(a>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,X),a=(a=Math.imul(U,Y))+Math.imul(z,X)|0,i=Math.imul(z,Y),n=n+Math.imul(I,Q)|0,a=(a=a+Math.imul(I,ee)|0)+Math.imul(L,Q)|0,i=i+Math.imul(L,ee)|0,n=n+Math.imul(B,re)|0,a=(a=a+Math.imul(B,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(T,ie)|0,a=(a=a+Math.imul(T,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(A,fe)|0,a=(a=a+Math.imul(A,de)|0)+Math.imul(E,fe)|0,i=i+Math.imul(E,de)|0,n=n+Math.imul(M,ue)|0,a=(a=a+Math.imul(M,be)|0)+Math.imul(k,ue)|0,i=i+Math.imul(k,be)|0;var Oe=(d+(n=n+Math.imul(g,le)|0)|0)+((8191&(a=(a=a+Math.imul(g,pe)|0)+Math.imul(w,le)|0))<<13)|0;d=((i=i+Math.imul(w,pe)|0)+(a>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,Q),a=(a=Math.imul(U,ee))+Math.imul(z,Q)|0,i=Math.imul(z,ee),n=n+Math.imul(I,re)|0,a=(a=a+Math.imul(I,ne)|0)+Math.imul(L,re)|0,i=i+Math.imul(L,ne)|0,n=n+Math.imul(B,ie)|0,a=(a=a+Math.imul(B,oe)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,oe)|0,n=n+Math.imul(T,fe)|0,a=(a=a+Math.imul(T,de)|0)+Math.imul(P,fe)|0,i=i+Math.imul(P,de)|0,n=n+Math.imul(A,ue)|0,a=(a=a+Math.imul(A,be)|0)+Math.imul(E,ue)|0,i=i+Math.imul(E,be)|0;var Te=(d+(n=n+Math.imul(M,le)|0)|0)+((8191&(a=(a=a+Math.imul(M,pe)|0)+Math.imul(k,le)|0))<<13)|0;d=((i=i+Math.imul(k,pe)|0)+(a>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),a=(a=Math.imul(U,ne))+Math.imul(z,re)|0,i=Math.imul(z,ne),n=n+Math.imul(I,ie)|0,a=(a=a+Math.imul(I,oe)|0)+Math.imul(L,ie)|0,i=i+Math.imul(L,oe)|0,n=n+Math.imul(B,fe)|0,a=(a=a+Math.imul(B,de)|0)+Math.imul(R,fe)|0,i=i+Math.imul(R,de)|0,n=n+Math.imul(T,ue)|0,a=(a=a+Math.imul(T,be)|0)+Math.imul(P,ue)|0,i=i+Math.imul(P,be)|0;var Pe=(d+(n=n+Math.imul(A,le)|0)|0)+((8191&(a=(a=a+Math.imul(A,pe)|0)+Math.imul(E,le)|0))<<13)|0;d=((i=i+Math.imul(E,pe)|0)+(a>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,ie),a=(a=Math.imul(U,oe))+Math.imul(z,ie)|0,i=Math.imul(z,oe),n=n+Math.imul(I,fe)|0,a=(a=a+Math.imul(I,de)|0)+Math.imul(L,fe)|0,i=i+Math.imul(L,de)|0,n=n+Math.imul(B,ue)|0,a=(a=a+Math.imul(B,be)|0)+Math.imul(R,ue)|0,i=i+Math.imul(R,be)|0;var je=(d+(n=n+Math.imul(T,le)|0)|0)+((8191&(a=(a=a+Math.imul(T,pe)|0)+Math.imul(P,le)|0))<<13)|0;d=((i=i+Math.imul(P,pe)|0)+(a>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,fe),a=(a=Math.imul(U,de))+Math.imul(z,fe)|0,i=Math.imul(z,de),n=n+Math.imul(I,ue)|0,a=(a=a+Math.imul(I,be)|0)+Math.imul(L,ue)|0,i=i+Math.imul(L,be)|0;var Be=(d+(n=n+Math.imul(B,le)|0)|0)+((8191&(a=(a=a+Math.imul(B,pe)|0)+Math.imul(R,le)|0))<<13)|0;d=((i=i+Math.imul(R,pe)|0)+(a>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,ue),a=(a=Math.imul(U,be))+Math.imul(z,ue)|0,i=Math.imul(z,be);var Re=(d+(n=n+Math.imul(I,le)|0)|0)+((8191&(a=(a=a+Math.imul(I,pe)|0)+Math.imul(L,le)|0))<<13)|0;d=((i=i+Math.imul(L,pe)|0)+(a>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(d+(n=Math.imul(U,le))|0)+((8191&(a=(a=Math.imul(U,pe))+Math.imul(z,le)|0))<<13)|0;return d=((i=Math.imul(z,pe))+(a>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f[0]=me,f[1]=xe,f[2]=ye,f[3]=ve,f[4]=ge,f[5]=we,f[6]=_e,f[7]=Me,f[8]=ke,f[9]=Se,f[10]=Ae,f[11]=Ee,f[12]=Oe,f[13]=Te,f[14]=Pe,f[15]=je,f[16]=Be,f[17]=Re,f[18]=Ce,0!==d&&(f[19]=d,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=c,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r._strip()}function v(e,t,r){return y(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(x=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):r<63?m(this,e,t):r<1024?y(this,e,t):v(this,e,t)},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,r+=i/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>a&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,n=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),c=67108863^67108863>>>i<o)for(this.length-=o,d=0;d=0&&(0!==s||d>=n);d--){var u=0|this.words[d];this.words[d]=s<<26-i|u>>>i,s=u&c}return f&&0!==s&&(f.words[f.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return a(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){a("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<=0);var t=e%26,r=(e-t)/26;if(a(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(a("number"==typeof e),a(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===c)return this._strip();for(a(-1===c),c=0,n=0;n>26,this.words[n]=67108863&i;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,i=0|a.words[a.length-1];0!==(r=26-this._countBits(i))&&(a=a.ushln(r),n.iushln(r),i=0|a.words[a.length-1]);var c,f=n.length-a.length;if("mod"!==t){(c=new o(null)).length=f+1,c.words=new Array(c.length);for(var d=0;d=0;u--){var b=67108864*(0|n.words[a.length+u])+(0|n.words[a.length+u-1]);for(b=Math.min(b/i|0,67108863),n._ishlnsubmul(a,b,u);0!==n.negative;)b--,n.negative=0,n._ishlnsubmul(a,1,u),n.isZero()||(n.negative^=1);c&&(c.words[u]=b)}return c&&c._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:c||null,mod:n}},o.prototype.divmod=function(e,t,r){return a(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(c=this.neg().divmod(e,t),"mod"!==t&&(n=c.div.neg()),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:n,mod:i}):0===this.negative&&0!==e.negative?(c=this.divmod(e.neg(),t),"mod"!==t&&(n=c.div.neg()),{div:n,mod:c.mod}):0!=(this.negative&e.negative)?(c=this.neg().divmod(e.neg(),t),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:c.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,i,c},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),a=e.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(r*n+(0|this.words[i]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*r;this.words[n]=i/e|0,r=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),i=new o(0),c=new o(0),f=new o(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var s=r.clone(),u=t.clone();!t.isZero();){for(var b=0,h=1;0==(t.words[0]&h)&&b<26;++b,h<<=1);if(b>0)for(t.iushrn(b);b-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(s),i.isub(u)),n.iushrn(1),i.iushrn(1);for(var l=0,p=1;0==(r.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(u)),c.iushrn(1),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(c),i.isub(f)):(r.isub(t),c.isub(n),f.isub(i))}return{a:c,b:f,gcd:r.iushln(d)}},o.prototype._invmp=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,i=new o(1),c=new o(0),f=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,s=1;0==(t.words[0]&s)&&d<26;++d,s<<=1);if(d>0)for(t.iushrn(d);d-- >0;)i.isOdd()&&i.iadd(f),i.iushrn(1);for(var u=0,b=1;0==(r.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(r.iushrn(u);u-- >0;)c.isOdd()&&c.iadd(f),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(c)):(r.isub(t),c.isub(i))}return(n=0===t.cmpn(1)?i:c).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=t.cmp(r);if(a<0){var i=t;t=r,r=i}else if(0===a||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){a("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,c&=67108863,this.words[o]=c}return 0!==i&&(this.words[o]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),a(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|e.words[r];if(n!==a){na&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new E(e)},o.prototype.toRed=function(e){return a(!this.red,"Already a number in reduction context"),a(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return a(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return a(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else a(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},i(M,_),M.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,a=i}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},M.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=a,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new M;else if("p224"===e)t=new k;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return w[e]=t,t},E.prototype._verify1=function(e){a(0===e.negative,"red works only with positives"),a(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){a(0==(e.negative|t.negative),"red works only with positives"),a(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(a(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);a(!n.isZero());var c=new o(1).toRed(this),f=c.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);0!==this.pow(s,d).cmp(f);)s.redIAdd(f);for(var u=this.pow(s,n),b=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),l=i;0!==h.cmp(c);){for(var p=h,m=0;0!==p.cmp(c);m++)p=p.redSqr();a(m=0;n--){for(var d=t.words[n],s=f-1;s>=0;s--){var u=d>>s&1;a!==r[0]&&(a=this.sqr(a)),0!==u||0!==i?(i<<=1,i|=u,(4===++c||0===n&&0===s)&&(a=this.mul(a,r[i]),c=0,i=0)):c=0}f=26}return a},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,E),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(15)(e))},function(e,t){},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(9);t.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=e.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=e.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=e.from(t.KECCAK256_RLP_S,"hex")}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.importPublic=t.privateToPublic=t.privateToAddress=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.isPrecompiled=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isZeroAddress=t.isValidAddress=t.zeroAddress=void 0;var n=r(14),a=r(18),i=r(123),o=r(9),c=r(81),f=r(129);t.zeroAddress=function(){var e=c.zeros(20);return c.bufferToHex(e)},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===c.addHexPrefix(e)},t.toChecksumAddress=function(e,t){e=a.stripHexPrefix(e).toLowerCase();for(var r=void 0!==t?t.toString()+"0x":"",n=f.keccak(r+e).toString("hex"),i="0x",o=0;o=8?i+=e[o].toUpperCase():i+=e[o];return i},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(t,r){t=c.toBuffer(t);var n=new o(r);return n.isZero()?f.rlphash([t,null]).slice(-20):f.rlphash([t,e.from(n.toArray())]).slice(-20)},t.generateAddress2=function(t,r,a){var i=c.toBuffer(t),o=c.toBuffer(r),d=c.toBuffer(a);return n(20===i.length),n(32===o.length),f.keccak256(e.concat([e.from("ff","hex"),i,o,f.keccak256(d)])).slice(-20)},t.isPrecompiled=function(e){var t=c.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},t.isValidPrivate=function(e){return i.privateKeyVerify(e)},t.isValidPublic=function(t,r){return void 0===r&&(r=!1),64===t.length?i.publicKeyVerify(e.concat([e.from([4]),t])):!!r&&i.publicKeyVerify(t)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),e=c.toBuffer(e),t&&64!==e.length&&(e=i.publicKeyConvert(e,!1).slice(1)),n(64===e.length),f.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.privateToPublic=function(e){return e=c.toBuffer(e),i.publicKeyCreate(e,!1).slice(1)},t.importPublic=function(e){return 64!==(e=c.toBuffer(e)).length&&(e=i.publicKeyConvert(e,!1).slice(1)),e}}).call(this,r(0).Buffer)},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return e&&"object"===r(e)&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){e.exports=r(410)(r(420))},function(e,t,r){var n=r(411),a=r(419);e.exports=function(e){var t=n(e),r=a(e);return function(e,n){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}},function(e,t,r){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,n,a=o.allocUnsafe(e>>>0),i=this.head,c=0;i;)t=i.data,r=a,n=c,o.prototype.copy.call(t,r,n),c+=i.data.length,i=i.next;return a}},{key:"consume",value:function(e,t){var r;return ea.length?a.length:e;if(i===a.length?n+=a:n+=a.slice(0,e),0==(e-=i)){i===a.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=a.slice(i));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,i),0==(e-=i)){i===a.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(i));break}++n}return this.length-=n,t}},{key:f,value:function(e,t){return c(this,function(e){for(var t=1;t0,(function(e){n||(n=e),e&&o.forEach(d),i||(o.forEach(d),a(n))}))}));return t.reduce(s)}},function(e,t,r){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var r=0;r>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0);return r},a.prototype.copy=function(e){for(var t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=a}).call(this,r(0).Buffer)},function(e,t){var r=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(e){for(var t=0;t<24;++t){var n=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],o=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],s=e[7]^e[17]^e[27]^e[37]^e[47],u=e[8]^e[18]^e[28]^e[38]^e[48],b=e[9]^e[19]^e[29]^e[39]^e[49],h=u^(i<<1|o>>>31),l=b^(o<<1|i>>>31),p=e[0]^h,m=e[1]^l,x=e[10]^h,y=e[11]^l,v=e[20]^h,g=e[21]^l,w=e[30]^h,_=e[31]^l,M=e[40]^h,k=e[41]^l;h=n^(c<<1|f>>>31),l=a^(f<<1|c>>>31);var S=e[2]^h,A=e[3]^l,E=e[12]^h,O=e[13]^l,T=e[22]^h,P=e[23]^l,j=e[32]^h,B=e[33]^l,R=e[42]^h,C=e[43]^l;h=i^(d<<1|s>>>31),l=o^(s<<1|d>>>31);var I=e[4]^h,L=e[5]^l,N=e[14]^h,U=e[15]^l,z=e[24]^h,F=e[25]^l,D=e[34]^h,H=e[35]^l,q=e[44]^h,K=e[45]^l;h=c^(u<<1|b>>>31),l=f^(b<<1|u>>>31);var G=e[6]^h,W=e[7]^l,V=e[16]^h,Z=e[17]^l,J=e[26]^h,X=e[27]^l,Y=e[36]^h,$=e[37]^l,Q=e[46]^h,ee=e[47]^l;h=d^(n<<1|a>>>31),l=s^(a<<1|n>>>31);var te=e[8]^h,re=e[9]^l,ne=e[18]^h,ae=e[19]^l,ie=e[28]^h,oe=e[29]^l,ce=e[38]^h,fe=e[39]^l,de=e[48]^h,se=e[49]^l,ue=p,be=m,he=y<<4|x>>>28,le=x<<4|y>>>28,pe=v<<3|g>>>29,me=g<<3|v>>>29,xe=_<<9|w>>>23,ye=w<<9|_>>>23,ve=M<<18|k>>>14,ge=k<<18|M>>>14,we=S<<1|A>>>31,_e=A<<1|S>>>31,Me=O<<12|E>>>20,ke=E<<12|O>>>20,Se=T<<10|P>>>22,Ae=P<<10|T>>>22,Ee=B<<13|j>>>19,Oe=j<<13|B>>>19,Te=R<<2|C>>>30,Pe=C<<2|R>>>30,je=L<<30|I>>>2,Be=I<<30|L>>>2,Re=N<<6|U>>>26,Ce=U<<6|N>>>26,Ie=F<<11|z>>>21,Le=z<<11|F>>>21,Ne=D<<15|H>>>17,Ue=H<<15|D>>>17,ze=K<<29|q>>>3,Fe=q<<29|K>>>3,De=G<<28|W>>>4,He=W<<28|G>>>4,qe=Z<<23|V>>>9,Ke=V<<23|Z>>>9,Ge=J<<25|X>>>7,We=X<<25|J>>>7,Ve=Y<<21|$>>>11,Ze=$<<21|Y>>>11,Je=ee<<24|Q>>>8,Xe=Q<<24|ee>>>8,Ye=te<<27|re>>>5,$e=re<<27|te>>>5,Qe=ne<<20|ae>>>12,et=ae<<20|ne>>>12,tt=oe<<7|ie>>>25,rt=ie<<7|oe>>>25,nt=ce<<8|fe>>>24,at=fe<<8|ce>>>24,it=de<<14|se>>>18,ot=se<<14|de>>>18;e[0]=ue^~Me&Ie,e[1]=be^~ke&Le,e[10]=De^~Qe&pe,e[11]=He^~et&me,e[20]=we^~Re&Ge,e[21]=_e^~Ce&We,e[30]=Ye^~he&Se,e[31]=$e^~le&Ae,e[40]=je^~qe&tt,e[41]=Be^~Ke&rt,e[2]=Me^~Ie&Ve,e[3]=ke^~Le&Ze,e[12]=Qe^~pe&Ee,e[13]=et^~me&Oe,e[22]=Re^~Ge&nt,e[23]=Ce^~We&at,e[32]=he^~Se&Ne,e[33]=le^~Ae&Ue,e[42]=qe^~tt&xe,e[43]=Ke^~rt&ye,e[4]=Ie^~Ve&it,e[5]=Le^~Ze&ot,e[14]=pe^~Ee&ze,e[15]=me^~Oe&Fe,e[24]=Ge^~nt&ve,e[25]=We^~at&ge,e[34]=Se^~Ne&Je,e[35]=Ae^~Ue&Xe,e[44]=tt^~xe&Te,e[45]=rt^~ye&Pe,e[6]=Ve^~it&ue,e[7]=Ze^~ot&be,e[16]=Ee^~ze&De,e[17]=Oe^~Fe&He,e[26]=nt^~ve&we,e[27]=at^~ge&_e,e[36]=Ne^~Je&Ye,e[37]=Ue^~Xe&$e,e[46]=xe^~Te&je,e[47]=ye^~Pe&Be,e[8]=it^~ue&Me,e[9]=ot^~be&ke,e[18]=ze^~De&Qe,e[19]=Fe^~He&et,e[28]=ve^~we&Re,e[29]=ge^~_e&Ce,e[38]=Je^~Ye&he,e[39]=Xe^~$e&le,e[48]=Te^~je&qe,e[49]=Pe^~Be&Ke,e[0]^=r[2*t],e[1]^=r[2*t+1]}}},function(e,t,r){(t=e.exports=r(214)).Stream=t,t.Readable=t,t.Writable=r(218),t.Duplex=r(66),t.Transform=r(219),t.PassThrough=r(428),t.finished=r(133),t.pipeline=r(429)},function(e,t){},function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,n,a=o.allocUnsafe(e>>>0),i=this.head,c=0;i;)t=i.data,r=a,n=c,o.prototype.copy.call(t,r,n),c+=i.data.length,i=i.next;return a}},{key:"consume",value:function(e,t){var r;return ea.length?a.length:e;if(i===a.length?n+=a:n+=a.slice(0,e),0==(e-=i)){i===a.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=a.slice(i));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(t,t.length-e,0,i),0==(e-=i)){i===a.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(i));break}++n}return this.length-=n,t}},{key:f,value:function(e,t){return c(this,function(e){for(var t=1;t0,(function(e){n||(n=e),e&&o.forEach(d),i||(o.forEach(d),a(n))}))}));return t.reduce(s)}},function(e,t,r){var n=r(4),a=r(67),i=r(6).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],c=new Array(80);function f(){this.init(),this._w=c,a.call(this,64,56)}function d(e){return e<<30|e>>>2}function s(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(f,a),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,a=0|this._b,i=0|this._c,c=0|this._d,f=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var b=0;b<80;++b){var h=~~(b/20),l=0|((t=n)<<5|t>>>27)+s(h,a,i,c)+f+r[b]+o[h];f=c,c=i,i=d(a),a=n,n=l}this._a=n+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=c+this._d|0,this._e=f+this._e|0},f.prototype._hash=function(){var e=i.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=f},function(e,t,r){var n=r(4),a=r(67),i=r(6).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],c=new Array(80);function f(){this.init(),this._w=c,a.call(this,64,56)}function d(e){return e<<5|e>>>27}function s(e){return e<<30|e>>>2}function u(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(f,a),f.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},f.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,a=0|this._b,i=0|this._c,c=0|this._d,f=0|this._e,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<80;++b)r[b]=(t=r[b-3]^r[b-8]^r[b-14]^r[b-16])<<1|t>>>31;for(var h=0;h<80;++h){var l=~~(h/20),p=d(n)+u(l,a,i,c)+f+r[h]+o[l]|0;f=c,c=i,i=s(a),a=n,n=p}this._a=n+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=c+this._d|0,this._e=f+this._e|0},f.prototype._hash=function(){var e=i.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=f},function(e,t,r){var n=r(4),a=r(220),i=r(67),o=r(6).Buffer,c=new Array(64);function f(){this.init(),this._w=c,i.call(this,64,56)}n(f,a),f.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},f.prototype._hash=function(){var e=o.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=f},function(e,t,r){var n=r(4),a=r(221),i=r(67),o=r(6).Buffer,c=new Array(160);function f(){this.init(),this._w=c,i.call(this,128,112)}n(f,a),f.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},f.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=f},function(e,t,r){e.exports=a;var n=r(23).EventEmitter;function a(){n.call(this)}r(435)(a,n),a.Readable=r(82),a.Writable=r(441),a.Duplex=r(442),a.Transform=r(443),a.PassThrough=r(444),a.Stream=a,a.prototype.pipe=function(e,t){var r=this;function a(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",a),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",c),r.on("close",f));var o=!1;function c(){o||(o=!0,e.end())}function f(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function d(e){if(s(),0===n.listenerCount(this,"error"))throw e}function s(){r.removeListener("data",a),e.removeListener("drain",i),r.removeListener("end",c),r.removeListener("close",f),r.removeListener("error",d),e.removeListener("error",d),r.removeListener("end",s),r.removeListener("close",s),e.removeListener("close",s)}return r.on("error",d),e.on("error",d),r.on("end",s),r.on("close",s),e.on("close",s),e.emit("pipe",r),e}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t){},function(e,t,r){"use strict";var n=r(136).Buffer,a=r(438);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,a,i=n.allocUnsafe(e>>>0),o=this.head,c=0;o;)t=o.data,r=i,a=c,t.copy(r,a),c+=o.data.length,o=o.next;return i},e}(),a&&a.inspect&&a.inspect.custom&&(e.exports.prototype[a.inspect.custom]=function(){var e=a.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,a,i,o,c,f=1,d={},s=!1,u=e.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){l(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){l(e.data)},n=function(e){i.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(a=u.documentElement,n=function(e){var t=u.createElement("script");t.onreadystatechange=function(){l(e),t.onreadystatechange=null,a.removeChild(t),t=null},a.appendChild(t)}):n=function(e){setTimeout(l,0,e)}:(o="setImmediate$"+Math.random()+"$",c=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&l(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",c,!1):e.attachEvent("onmessage",c),n=function(t){e.postMessage(o+t,"*")}),b.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0){var s=d.split("|");d=s[0],c=parseInt(s[1])}var u=Uint8Array.from(e.from(d,"hex"));i=e.from(u.slice(0,32)),o=e.from(u.slice(32,64))}else{var b=n.sign(t,r);c=b.recovery,i=b.signature.slice(0,32),o=b.signature.slice(32,64)}return{r:i,s:o,v:a?c+(2*a+35):c+27}},t.ecrecover=function(t,r,a,o,d){var s=e.concat([i.setLength(a,32),i.setLength(o,32)],64),u=c(r,d);if(!f(u))throw new Error("Invalid signature v value");var b=n.recover(t,s,u);return n.publicKeyConvert(b,!1).slice(1)},t.toRpcSig=function(t,r,n,a){if(!f(c(t,a)))throw new Error("Invalid signature v value");return i.bufferToHex(e.concat([i.setLengthLeft(r,32),i.setLengthLeft(n,32),i.toBuffer(t)]))},t.fromRpcSig=function(e){var t=i.toBuffer(e);if(65!==t.length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},t.isValidSignature=function(e,t,r,n,i){void 0===n&&(n=!0);var o=new a("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),d=new a("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!f(c(e,i)))return!1;var s=new a(t),u=new a(r);return!(s.isZero()||s.gt(d)||u.isZero()||u.gt(d))&&(!n||1!==u.cmp(o))},t.hashPersonalMessage=function(t){var r=e.from("Ethereum Signed Message:\n"+t.length.toString(),"utf-8");return o.keccak(e.concat([r,t]))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var a=r(14),i=r(18),o=r(21),c=r(81);t.defineProperties=function(t,r,f){if(t.raw=[],t._fields=[],t.toJSON=function(e){if(void 0===e&&(e=!1),e){var r={};return t._fields.forEach((function(e){r[e]="0x"+t[e].toString("hex")})),r}return c.baToJSON(t.raw)},t.serialize=function(){return o.encode(t.raw)},r.forEach((function(r,n){function i(){return t.raw[n]}function o(i){"00"!==(i=c.toBuffer(i)).toString("hex")||r.allowZero||(i=e.allocUnsafe(0)),r.allowLess&&r.length?(i=c.stripZeros(i),a(r.length>=i.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===i.length||!r.length||a(r.length===i.length,"The field "+r.name+" must have byte length of "+r.length),t.raw[n]=i}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:i,set:o}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:o,get:i})})),f)if("string"==typeof f&&(f=e.from(i.stripHexPrefix(f),"hex")),e.isBuffer(f)&&(f=o.decode(f)),Array.isArray(f)){if(f.length>t._fields.length)throw new Error("wrong number of fields in data");f.forEach((function(e,r){t[t._fields[r]]=c.toBuffer(e)}))}else{if("object"!==n(f))throw new Error("invalid data");var d=Object.keys(f);r.forEach((function(e){-1!==d.indexOf(e.name)&&(t[e.name]=f[e.name]),-1!==d.indexOf(e.alias)&&(t[e.alias]=f[e.alias])}))}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,f=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){f=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(f)throw i}}}}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,i=[],o=!0,c=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){c=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(c)throw a}}return i}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:new Set,n=e.match(/^[0-9A-Z_a-z]*/),a=o(n,1);if(e=a[0],r.has(e)||void 0===t[e])return r;r.add(e);var c,f=i(t[e]);try{for(f.s();!(c=f.n()).done;){var d=c.value;x(d.type,t,r)}}catch(e){f.e(e)}finally{f.f()}return r}function y(e,t,r,n){return h(n,[d.V3,d.V4]),s.keccak(p(e,t,r,n))}function v(e,t){return s.keccak(m(e,t))}function g(e){var r={};for(var n in t.TYPED_MESSAGE_SCHEMA.properties)e[n]&&(r[n]=e[n]);return"types"in r&&(r.types=Object.assign({EIP712Domain:[]},r.types)),r}function w(e){var t=new Error("Expect argument to be non-empty array");if("object"!==n(e)||!("length"in e)||!e.length)throw t;var r=e.map((function(e){return"bytes"!==e.type?e.value:b.legacyToBuffer(e.value)})),a=e.map((function(e){return e.type})),i=e.map((function(e){if(!e.name)throw t;return"".concat(e.type," ").concat(e.name)}));return u.soliditySHA3(["bytes32","bytes32"],[u.soliditySHA3(new Array(e.length).fill("string"),i),u.soliditySHA3(a,r)])}!function(e){e.V1="V1",e.V3="V3",e.V4="V4"}(d=t.SignTypedDataVersion||(t.SignTypedDataVersion={})),t.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},t.TypedDataUtils={encodeData:p,encodeType:m,findTypeDependencies:x,hashStruct:y,hashType:v,sanitizeData:g,eip712Hash:function(t,r){h(r,[d.V3,d.V4]);var n=g(t),a=[e.from("1901","hex")];return a.push(y("EIP712Domain",n.domain,n.types,r)),"EIP712Domain"!==n.primaryType&&a.push(y(n.primaryType,n.message,n.types,r)),s.keccak(e.concat(a))}},t.typedSignatureHash=function(e){var t=w(e);return s.bufferToHex(t)},t.signTypedData=function(e){var r=e.privateKey,n=e.data,a=e.version;if(h(a),b.isNullish(n))throw new Error("Missing data parameter");if(b.isNullish(r))throw new Error("Missing private key parameter");var i=a===d.V1?w(n):t.TypedDataUtils.eip712Hash(n,a),o=s.ecsign(i,r);return b.concatSig(s.toBuffer(o.v),o.r,o.s)},t.recoverTypedSignature=function(e){var r=e.data,n=e.signature,a=e.version;if(h(a),b.isNullish(r))throw new Error("Missing data parameter");if(b.isNullish(n))throw new Error("Missing signature parameter");var i=a===d.V1?w(r):t.TypedDataUtils.eip712Hash(r,a),o=b.recoverPublicKey(i,n),c=s.publicToAddress(o);return s.bufferToHex(c)}}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(449)},function(e,t,r){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=r(450),i=r(9),o=function(){};function c(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}function f(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function d(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function s(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function u(e){var t=n(e);if("string"===t)return a.isHexPrefixed(e)?new i(a.stripHexPrefix(e),16):new i(e,10);if("number"===t)return new i(e);if(e.toArray)return e;throw new Error("Argument is not a number")}function b(e){var t=/^(\w+)\((.*)\)$/.exec(e);if(3!==t.length)throw new Error("Invalid method signature");var r=/^(.+)\):\((.+)$/.exec(t[2]);if(null!==r&&3===r.length)return{method:t[1],args:r[1].split(","),retargs:r[2].split(",")};var n=t[2].split(",");return 1===n.length&&""===n[0]&&(n=[]),{method:t[1],args:n}}function h(e,r){var n,o,c,b;if("address"===e)return h("uint160",u(r));if("bool"===e)return h("uint8",r?1:0);if("string"===e)return h("bytes",t.from(r,"utf8"));if(x(e)){if(void 0===r.length)throw new Error("Not an array?");if("dynamic"!==(n=s(e))&&0!==n&&r.length>n)throw new Error("Elements exceed array size: "+n);for(b in c=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof r&&(r=JSON.parse(r)),r)c.push(h(e,r[b]));if("dynamic"===n){var l=h("uint256",r.length);c.unshift(l)}return t.concat(c)}if("bytes"===e)return r=t.from(r),c=t.concat([h("uint256",r.length),r]),r.length%32!=0&&(c=t.concat([c,a.zeros(32-r.length%32)])),c;if(e.startsWith("bytes")){if((n=f(e))<1||n>32)throw new Error("Invalid bytes width: "+n);return a.setLengthRight(r,32)}if(e.startsWith("uint")){if((n=f(e))%8||n<8||n>256)throw new Error("Invalid uint width: "+n);if((o=u(r)).bitLength()>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+o.bitLength());if(o<0)throw new Error("Supplied uint is negative");return o.toArrayLike(t,"be",32)}if(e.startsWith("int")){if((n=f(e))%8||n<8||n>256)throw new Error("Invalid int width: "+n);if((o=u(r)).bitLength()>n)throw new Error("Supplied int exceeds width: "+n+" vs "+o.bitLength());return o.toTwos(256).toArrayLike(t,"be",32)}if(e.startsWith("ufixed")){if(n=d(e),(o=u(r))<0)throw new Error("Supplied ufixed is negative");return h("uint256",o.mul(new i(2).pow(new i(n[1]))))}if(e.startsWith("fixed"))return n=d(e),h("int256",u(r).mul(new i(2).pow(new i(n[1]))));throw new Error("Unsupported or invalid type: "+e)}function l(e,r,n){var a,o,c,f;if("string"==typeof e&&(e=p(e)),"address"===e.name)return l(e.rawType,r,n).toArrayLike(t,"be",20).toString("hex");if("bool"===e.name)return l(e.rawType,r,n).toString()===new i(1).toString();if("string"===e.name){var d=l(e.rawType,r,n);return t.from(d,"utf8").toString()}if(e.isArray){for(c=[],a=e.size,"dynamic"===e.size&&(n=l("uint256",r,n).toNumber(),a=l("uint256",r,n).toNumber(),n+=32),f=0;fe.size)throw new Error("Decoded int exceeds width: "+e.size+" vs "+o.bitLength());return o}if(e.name.startsWith("int")){if((o=new i(r.slice(n,n+32),16,"be").fromTwos(256)).bitLength()>e.size)throw new Error("Decoded uint exceeds width: "+e.size+" vs "+o.bitLength());return o}if(e.name.startsWith("ufixed")){if(a=new i(2).pow(new i(e.size[1])),!(o=l("uint256",r,n)).mod(a).isZero())throw new Error("Decimals not supported yet");return o.div(a)}if(e.name.startsWith("fixed")){if(a=new i(2).pow(new i(e.size[1])),!(o=l("int256",r,n)).mod(a).isZero())throw new Error("Decimals not supported yet");return o.div(a)}throw new Error("Unsupported or invalid type: "+e.name)}function p(e){var t,r,n;if(x(e)){t=s(e);var a=e.slice(0,e.lastIndexOf("["));return a=p(a),r={isArray:!0,name:e,size:t,memoryUsage:"dynamic"===t?32:a.memoryUsage*t,subArray:a}}switch(e){case"address":n="uint160";break;case"bool":n="uint8";break;case"string":n="bytes"}if(r={rawType:n,name:e,memoryUsage:32},e.startsWith("bytes")&&"bytes"!==e||e.startsWith("uint")||e.startsWith("int")?r.size=f(e):(e.startsWith("ufixed")||e.startsWith("fixed"))&&(r.size=d(e)),e.startsWith("bytes")&&"bytes"!==e&&(r.size<1||r.size>32))throw new Error("Invalid bytes width: "+r.size);if((e.startsWith("uint")||e.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint width: "+r.size);return r}function m(e){return"string"===e||"bytes"===e||"dynamic"===s(e)}function x(e){return e.lastIndexOf("]")===e.length-1}function y(e,t){return e.startsWith("address")||e.startsWith("bytes")?"0x"+t.toString("hex"):t.toString()}o.eventID=function(e,r){var n=e+"("+r.map(c).join(",")+")";return a.keccak256(t.from(n))},o.methodID=function(e,t){return o.eventID(e,t).slice(0,4)},o.rawEncode=function(e,r){var n=[],a=[],i=0;e.forEach((function(e){if(x(e)){var t=s(e);i+="dynamic"!==t?32*t:32}else i+=32}));for(var o=0;ob)throw new Error("Elements exceed array size: "+b)}var h=r.map((function(e){return o.solidityHexValue(d,e,256)}));return t.concat(h)}if("bytes"===e)return r;if("string"===e)return t.from(r,"utf8");if("bool"===e){n=n||8;var l=Array(n/4).join("0");return t.from(r?l+"1":l+"0","hex")}if("address"===e){var p=20;return n&&(p=n/8),a.setLengthLeft(r,p)}if(e.startsWith("bytes")){if((i=f(e))<1||i>32)throw new Error("Invalid bytes width: "+i);return a.setLengthRight(r,i)}if(e.startsWith("uint")){if((i=f(e))%8||i<8||i>256)throw new Error("Invalid uint width: "+i);if((c=u(r)).bitLength()>i)throw new Error("Supplied uint exceeds width: "+i+" vs "+c.bitLength());return n=n||i,c.toArrayLike(t,"be",n/8)}if(e.startsWith("int")){if((i=f(e))%8||i<8||i>256)throw new Error("Invalid int width: "+i);if((c=u(r)).bitLength()>i)throw new Error("Supplied int exceeds width: "+i+" vs "+c.bitLength());return n=n||i,c.toTwos(i).toArrayLike(t,"be",n/8)}throw new Error("Unsupported or invalid type: "+e)},o.solidityPack=function(e,r){if(e.length!==r.length)throw new Error("Number of types are not matching the values");for(var n=[],a=0;a="0"&&t<="9");)i+=e[o]-"0",o++;n=o-1,r.push(i)}else if("i"===a)r.push("int256");else{if("a"!==a)throw new Error("Unsupported or invalid type: "+a);r.push("int256[]")}}return r},o.toSerpent=function(e){for(var t=[],r=0;r=0)throw new Error("couldn't export to DER format");var c=a.g.mul(r);return o(c.getX(),c.getY(),t)},t.privateKeyModInverse=function(t){var r=new n(t);if(r.ucmp(i.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(i.n).toArrayLike(e,"be",32)},t.signatureImport=function(t){var r=new n(t.r);r.ucmp(i.n)>=0&&(r=new n(0));var a=new n(t.s);return a.ucmp(i.n)>=0&&(a=new n(0)),e.concat([r.toArrayLike(e,"be",32),a.toArrayLike(e,"be",32)])},t.ecdhUnsafe=function(e,t,r){void 0===r&&(r=!0);var c=a.keyFromPublic(e),f=new n(t);if(f.ucmp(i.n)>=0||f.isZero())throw new Error("scalar was invalid (zero or overflow)");var d=c.pub.mul(f);return o(d.getX(),d.getY(),r)};var o=function(t,r,n){var a;return n?((a=e.alloc(33))[0]=r.isOdd()?3:2,t.toArrayLike(e,"be",32).copy(a,1)):((a=e.alloc(65))[0]=4,t.toArrayLike(e,"be",32).copy(a,1),r.toArrayLike(e,"be",32).copy(a,33)),a}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=e.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=e.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(t,a,i){void 0===i&&(i=!0);var o=e.from(i?r:n);return t.copy(o,i?8:9),a.copy(o,i?181:214),o},t.privateKeyImport=function(e){var t=e.length,r=0;if(t2)return null;if(t<(r+=1)+n)return null;var a=e[r+n-1]|(n>1?e[r+n-2]<<8:0);return t<(r+=n)+a||t32||ta)return null;if(2!==t[i++])return null;var c=t[i++];if(128&c){if(i+(o=c-128)>a)return null;for(;o>0&&0===t[i];i+=1,o-=1);for(c=0;o>0;i+=1,o-=1)c=(c<<8)+t[i]}if(c>a-i)return null;var f=i;if(i+=c,2!==t[i++])return null;var d=t[i++];if(128&d){if(i+(o=d-128)>a)return null;for(;o>0&&0===t[i];i+=1,o-=1);for(d=0;o>0;i+=1,o-=1)d=(d<<8)+t[i]}if(d>a-i)return null;var s=i;for(i+=d;c>0&&0===t[f];c-=1,f+=1);if(c>32)return null;var u=t.slice(f,f+c);for(u.copy(r,32-u.length);d>0&&0===t[s];d-=1,s+=1);if(d>32)return null;var b=t.slice(s,s+d);return b.copy(n,32-b.length),{r:r,s:n}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(9);t.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=e.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=e.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=e.from(t.KECCAK256_RLP_S,"hex")}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.importPublic=t.privateToPublic=t.privateToAddress=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.isPrecompiled=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isZeroAddress=t.isValidAddress=t.zeroAddress=void 0;var n=r(14),a=r(18),i=r(139),o=r(9),c=r(84),f=r(140);t.zeroAddress=function(){var e=c.zeros(20);return c.bufferToHex(e)},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===c.addHexPrefix(e)},t.toChecksumAddress=function(e,t){e=a.stripHexPrefix(e).toLowerCase();for(var r=void 0!==t?t.toString()+"0x":"",n=f.keccak(r+e).toString("hex"),i="0x",o=0;o=8?i+=e[o].toUpperCase():i+=e[o];return i},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(t,r){t=c.toBuffer(t);var n=new o(r);return n.isZero()?f.rlphash([t,null]).slice(-20):f.rlphash([t,e.from(n.toArray())]).slice(-20)},t.generateAddress2=function(t,r,a){var i=c.toBuffer(t),o=c.toBuffer(r),d=c.toBuffer(a);return n(20===i.length),n(32===o.length),f.keccak256(e.concat([e.from("ff","hex"),i,o,f.keccak256(d)])).slice(-20)},t.isPrecompiled=function(e){var t=c.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},t.isValidPrivate=function(e){return i.privateKeyVerify(e)},t.isValidPublic=function(t,r){return void 0===r&&(r=!1),64===t.length?i.publicKeyVerify(e.concat([e.from([4]),t])):!!r&&i.publicKeyVerify(t)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),e=c.toBuffer(e),t&&64!==e.length&&(e=i.publicKeyConvert(e,!1).slice(1)),n(64===e.length),f.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.privateToPublic=function(e){return e=c.toBuffer(e),i.publicKeyCreate(e,!1).slice(1)},t.importPublic=function(e){return 64!==(e=c.toBuffer(e)).length&&(e=i.publicKeyConvert(e,!1).slice(1)),e}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var n=r(139),a=r(9),i=r(84),o=r(140);function c(e,t){return t?e-(2*t+35):e-27}function f(e){return 0===e||1===e}t.ecsign=function(t,r,n){var a,i,o;if(window.jsb&&window.jsb.walletSignTran){var c=t.toString("hex"),f=jsb.walletSignTran(c);if(f.indexOf("|")>=0){var d=f.split("|");f=d[0],o=parseInt(d[1])}var s=Uint8Array.from(e.from(f,"hex"));console.log(s),a=e.from(s.slice(0,32)),i=e.from(s.slice(32,64))}else{var u=(0,secp256k1_1.ecdsaSign)(t,r),b=u.signature;o=u.recid,a=e.from(b.slice(0,32)),i=e.from(b.slice(32,64))}return{r:a,s:i,v:n?o+(2*n+35):o+27}},t.ecrecover=function(t,r,a,o,d){var s=e.concat([i.setLength(a,32),i.setLength(o,32)],64),u=c(r,d);if(!f(u))throw new Error("Invalid signature v value");var b=n.recover(t,s,u);return n.publicKeyConvert(b,!1).slice(1)},t.toRpcSig=function(t,r,n,a){if(!f(c(t,a)))throw new Error("Invalid signature v value");return i.bufferToHex(e.concat([i.setLengthLeft(r,32),i.setLengthLeft(n,32),i.toBuffer(t)]))},t.fromRpcSig=function(e){var t=i.toBuffer(e);if(65!==t.length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},t.isValidSignature=function(e,t,r,n,i){void 0===n&&(n=!0);var o=new a("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),d=new a("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!f(c(e,i)))return!1;var s=new a(t),u=new a(r);return!(s.isZero()||s.gt(d)||u.isZero()||u.gt(d))&&(!n||1!==u.cmp(o))},t.hashPersonalMessage=function(t){var r=e.from("Ethereum Signed Message:\n"+t.length.toString(),"utf-8");return o.keccak(e.concat([r,t]))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var a=r(14),i=r(18),o=r(21),c=r(84);t.defineProperties=function(t,r,f){if(t.raw=[],t._fields=[],t.toJSON=function(e){if(void 0===e&&(e=!1),e){var r={};return t._fields.forEach((function(e){r[e]="0x"+t[e].toString("hex")})),r}return c.baToJSON(t.raw)},t.serialize=function(){return o.encode(t.raw)},r.forEach((function(r,n){function i(){return t.raw[n]}function o(i){"00"!==(i=c.toBuffer(i)).toString("hex")||r.allowZero||(i=e.allocUnsafe(0)),r.allowLess&&r.length?(i=c.stripZeros(i),a(r.length>=i.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===i.length||!r.length||a(r.length===i.length,"The field "+r.name+" must have byte length of "+r.length),t.raw[n]=i}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:i,set:o}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:o,get:i})})),f)if("string"==typeof f&&(f=e.from(i.stripHexPrefix(f),"hex")),e.isBuffer(f)&&(f=o.decode(f)),Array.isArray(f)){if(f.length>t._fields.length)throw new Error("wrong number of fields in data");f.forEach((function(e,r){t[t._fields[r]]=c.toBuffer(e)}))}else{if("object"!==n(f))throw new Error("invalid data");var d=Object.keys(f);r.forEach((function(e){-1!==d.indexOf(e.name)&&(t[e.name]=f[e.name]),-1!==d.indexOf(e.alias)&&(t[e.alias]=f[e.alias])}))}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&a(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getEncryptionPublicKey=t.decryptSafely=t.decrypt=t.encryptSafely=t.encrypt=void 0;var c=o(r(458)),f=o(r(460)),d=r(103);function s(e){var t=e.publicKey,r=e.data,n=e.version;if(d.isNullish(t))throw new Error("Missing publicKey parameter");if(d.isNullish(r))throw new Error("Missing data parameter");if(d.isNullish(n))throw new Error("Missing version parameter");switch(n){case"x25519-xsalsa20-poly1305":if("string"!=typeof r)throw new Error("Message data must be given as a string");var a,i=c.box.keyPair();try{a=f.decodeBase64(t)}catch(e){throw new Error("Bad public key")}var o=f.decodeUTF8(r),s=c.randomBytes(c.box.nonceLength),u=c.box(o,s,a,i.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:f.encodeBase64(s),ephemPublicKey:f.encodeBase64(i.publicKey),ciphertext:f.encodeBase64(u)};default:throw new Error("Encryption type/version not supported")}}function u(e){var t=e.encryptedData,r=e.privateKey;if(d.isNullish(t))throw new Error("Missing encryptedData parameter");if(d.isNullish(r))throw new Error("Missing privateKey parameter");switch(t.version){case"x25519-xsalsa20-poly1305":var n,a=b(r),i=c.box.keyPair.fromSecretKey(a).secretKey,o=f.decodeBase64(t.nonce),s=f.decodeBase64(t.ciphertext),u=f.decodeBase64(t.ephemPublicKey),h=c.box.open(s,o,u,i);try{n=f.encodeUTF8(h)}catch(e){throw new Error("Decryption failed.")}if(n)return n;throw new Error("Decryption failed.");default:throw new Error("Encryption type/version not supported.")}}function b(t){var r=e.from(t,"hex").toString("base64");return f.decodeBase64(r)}t.encrypt=s,t.encryptSafely=function(t){var r=t.publicKey,a=t.data,i=t.version;if(d.isNullish(r))throw new Error("Missing publicKey parameter");if(d.isNullish(a))throw new Error("Missing data parameter");if(d.isNullish(i))throw new Error("Missing version parameter");var o=Math.pow(2,11);if("object"===n(a)&&"toJSON"in a)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");var c={data:a,padding:""},f=e.byteLength(JSON.stringify(c),"utf-8")%o,u=0;return f>0&&(u=o-f-16),c.padding="0".repeat(u),s({publicKey:r,data:JSON.stringify(c),version:i})},t.decrypt=u,t.decryptSafely=function(e){var t=e.encryptedData,r=e.privateKey;if(d.isNullish(t))throw new Error("Missing encryptedData parameter");if(d.isNullish(r))throw new Error("Missing privateKey parameter");return JSON.parse(u({encryptedData:t,privateKey:r})).data},t.getEncryptionPublicKey=function(e){var t=b(e),r=c.box.keyPair.fromSecretKey(t).publicKey;return f.encodeBase64(r)}}).call(this,r(0).Buffer)},function(e,t,r){!function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function p(e,t,r,n,a){var i,o=0;for(i=0;i>>8)-1}function m(e,t,r,n){return p(e,t,r,n,16)}function x(e,t,r,n){return p(e,t,r,n,32)}function y(e,t,r,n){!function(e,t,r,n){for(var a,i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,c=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,d=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,b=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,l=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,x=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,g=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=i,_=o,M=c,k=f,S=d,A=s,E=u,O=b,T=h,P=l,j=p,B=m,R=x,C=y,I=v,L=g,N=0;N<20;N+=2)w^=(a=(R^=(a=(T^=(a=(S^=(a=w+R|0)<<7|a>>>25)+w|0)<<9|a>>>23)+S|0)<<13|a>>>19)+T|0)<<18|a>>>14,A^=(a=(_^=(a=(C^=(a=(P^=(a=A+_|0)<<7|a>>>25)+A|0)<<9|a>>>23)+P|0)<<13|a>>>19)+C|0)<<18|a>>>14,j^=(a=(E^=(a=(M^=(a=(I^=(a=j+E|0)<<7|a>>>25)+j|0)<<9|a>>>23)+I|0)<<13|a>>>19)+M|0)<<18|a>>>14,L^=(a=(B^=(a=(O^=(a=(k^=(a=L+B|0)<<7|a>>>25)+L|0)<<9|a>>>23)+k|0)<<13|a>>>19)+O|0)<<18|a>>>14,w^=(a=(k^=(a=(M^=(a=(_^=(a=w+k|0)<<7|a>>>25)+w|0)<<9|a>>>23)+_|0)<<13|a>>>19)+M|0)<<18|a>>>14,A^=(a=(S^=(a=(O^=(a=(E^=(a=A+S|0)<<7|a>>>25)+A|0)<<9|a>>>23)+E|0)<<13|a>>>19)+O|0)<<18|a>>>14,j^=(a=(P^=(a=(T^=(a=(B^=(a=j+P|0)<<7|a>>>25)+j|0)<<9|a>>>23)+B|0)<<13|a>>>19)+T|0)<<18|a>>>14,L^=(a=(I^=(a=(C^=(a=(R^=(a=L+I|0)<<7|a>>>25)+L|0)<<9|a>>>23)+R|0)<<13|a>>>19)+C|0)<<18|a>>>14;w=w+i|0,_=_+o|0,M=M+c|0,k=k+f|0,S=S+d|0,A=A+s|0,E=E+u|0,O=O+b|0,T=T+h|0,P=P+l|0,j=j+p|0,B=B+m|0,R=R+x|0,C=C+y|0,I=I+v|0,L=L+g|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=_>>>0&255,e[5]=_>>>8&255,e[6]=_>>>16&255,e[7]=_>>>24&255,e[8]=M>>>0&255,e[9]=M>>>8&255,e[10]=M>>>16&255,e[11]=M>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=E>>>0&255,e[25]=E>>>8&255,e[26]=E>>>16&255,e[27]=E>>>24&255,e[28]=O>>>0&255,e[29]=O>>>8&255,e[30]=O>>>16&255,e[31]=O>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=P>>>0&255,e[37]=P>>>8&255,e[38]=P>>>16&255,e[39]=P>>>24&255,e[40]=j>>>0&255,e[41]=j>>>8&255,e[42]=j>>>16&255,e[43]=j>>>24&255,e[44]=B>>>0&255,e[45]=B>>>8&255,e[46]=B>>>16&255,e[47]=B>>>24&255,e[48]=R>>>0&255,e[49]=R>>>8&255,e[50]=R>>>16&255,e[51]=R>>>24&255,e[52]=C>>>0&255,e[53]=C>>>8&255,e[54]=C>>>16&255,e[55]=C>>>24&255,e[56]=I>>>0&255,e[57]=I>>>8&255,e[58]=I>>>16&255,e[59]=I>>>24&255,e[60]=L>>>0&255,e[61]=L>>>8&255,e[62]=L>>>16&255,e[63]=L>>>24&255}(e,t,r,n)}function v(e,t,r,n){!function(e,t,r,n){for(var a,i=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,c=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,d=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,s=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,b=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,l=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,x=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,g=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=0;w<20;w+=2)i^=(a=(x^=(a=(h^=(a=(d^=(a=i+x|0)<<7|a>>>25)+i|0)<<9|a>>>23)+d|0)<<13|a>>>19)+h|0)<<18|a>>>14,s^=(a=(o^=(a=(y^=(a=(l^=(a=s+o|0)<<7|a>>>25)+s|0)<<9|a>>>23)+l|0)<<13|a>>>19)+y|0)<<18|a>>>14,p^=(a=(u^=(a=(c^=(a=(v^=(a=p+u|0)<<7|a>>>25)+p|0)<<9|a>>>23)+v|0)<<13|a>>>19)+c|0)<<18|a>>>14,g^=(a=(m^=(a=(b^=(a=(f^=(a=g+m|0)<<7|a>>>25)+g|0)<<9|a>>>23)+f|0)<<13|a>>>19)+b|0)<<18|a>>>14,i^=(a=(f^=(a=(c^=(a=(o^=(a=i+f|0)<<7|a>>>25)+i|0)<<9|a>>>23)+o|0)<<13|a>>>19)+c|0)<<18|a>>>14,s^=(a=(d^=(a=(b^=(a=(u^=(a=s+d|0)<<7|a>>>25)+s|0)<<9|a>>>23)+u|0)<<13|a>>>19)+b|0)<<18|a>>>14,p^=(a=(l^=(a=(h^=(a=(m^=(a=p+l|0)<<7|a>>>25)+p|0)<<9|a>>>23)+m|0)<<13|a>>>19)+h|0)<<18|a>>>14,g^=(a=(v^=(a=(y^=(a=(x^=(a=g+v|0)<<7|a>>>25)+g|0)<<9|a>>>23)+x|0)<<13|a>>>19)+y|0)<<18|a>>>14;e[0]=i>>>0&255,e[1]=i>>>8&255,e[2]=i>>>16&255,e[3]=i>>>24&255,e[4]=s>>>0&255,e[5]=s>>>8&255,e[6]=s>>>16&255,e[7]=s>>>24&255,e[8]=p>>>0&255,e[9]=p>>>8&255,e[10]=p>>>16&255,e[11]=p>>>24&255,e[12]=g>>>0&255,e[13]=g>>>8&255,e[14]=g>>>16&255,e[15]=g>>>24&255,e[16]=u>>>0&255,e[17]=u>>>8&255,e[18]=u>>>16&255,e[19]=u>>>24&255,e[20]=b>>>0&255,e[21]=b>>>8&255,e[22]=b>>>16&255,e[23]=b>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=l>>>0&255,e[29]=l>>>8&255,e[30]=l>>>16&255,e[31]=l>>>24&255}(e,t,r,n)}var g=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,n,a,i,o){var c,f,d=new Uint8Array(16),s=new Uint8Array(64);for(f=0;f<16;f++)d[f]=0;for(f=0;f<8;f++)d[f]=i[f];for(;a>=64;){for(y(s,d,o,g),f=0;f<64;f++)e[t+f]=r[n+f]^s[f];for(c=1,f=8;f<16;f++)c=c+(255&d[f])|0,d[f]=255&c,c>>>=8;a-=64,t+=64,n+=64}if(a>0)for(y(s,d,o,g),f=0;f=64;){for(y(f,c,a,g),o=0;o<64;o++)e[t+o]=f[o];for(i=1,o=8;o<16;o++)i=i+(255&c[o])|0,c[o]=255&i,i>>>=8;r-=64,t+=64}if(r>0)for(y(f,c,a,g),o=0;o>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),a=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|a<<9),i=255&e[8]|(255&e[9])<<8,this.r[4]=255&(a>>>4|i<<12),this.r[5]=i>>>1&8190,o=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(i>>>14|o<<2),c=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(o>>>11|c<<5),f=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(c>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function A(e,t,r,n,a,i){var o=new S(i);return o.update(r,n,a),o.finish(e,t),0}function E(e,t,r,n,a,i){var o=new Uint8Array(16);return A(o,0,r,n,a,i),m(e,t,o,0)}function O(e,t,r,n,a){var i;if(r<32)return-1;for(k(e,0,t,0,r,n,a),A(e,16,e,32,r-32,e),i=0;i<16;i++)e[i]=0;return 0}function T(e,t,r,n,a){var i,o=new Uint8Array(32);if(r<32)return-1;if(M(o,0,32,n,a),0!==E(t,16,t,32,r-32,o))return-1;for(k(e,0,t,0,r,n,a),i=0;i<32;i++)e[i]=0;return 0}function P(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function j(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function B(e,t,r){for(var n,a=~(r-1),i=0;i<16;i++)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function R(e,r){var n,a,i,o=t(),c=t();for(n=0;n<16;n++)c[n]=r[n];for(j(c),j(c),j(c),a=0;a<2;a++){for(o[0]=c[0]-65517,n=1;n<15;n++)o[n]=c[n]-65535-(o[n-1]>>16&1),o[n-1]&=65535;o[15]=c[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,B(c,o,1-i)}for(n=0;n<16;n++)e[2*n]=255&c[n],e[2*n+1]=c[n]>>8}function C(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return R(r,e),R(n,t),x(r,0,n,0)}function I(e){var t=new Uint8Array(32);return R(t,e),1&t[0]}function L(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function N(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function z(e,t,r){var n,a,i=0,o=0,c=0,f=0,d=0,s=0,u=0,b=0,h=0,l=0,p=0,m=0,x=0,y=0,v=0,g=0,w=0,_=0,M=0,k=0,S=0,A=0,E=0,O=0,T=0,P=0,j=0,B=0,R=0,C=0,I=0,L=r[0],N=r[1],U=r[2],z=r[3],F=r[4],D=r[5],H=r[6],q=r[7],K=r[8],G=r[9],W=r[10],V=r[11],Z=r[12],J=r[13],X=r[14],Y=r[15];i+=(n=t[0])*L,o+=n*N,c+=n*U,f+=n*z,d+=n*F,s+=n*D,u+=n*H,b+=n*q,h+=n*K,l+=n*G,p+=n*W,m+=n*V,x+=n*Z,y+=n*J,v+=n*X,g+=n*Y,o+=(n=t[1])*L,c+=n*N,f+=n*U,d+=n*z,s+=n*F,u+=n*D,b+=n*H,h+=n*q,l+=n*K,p+=n*G,m+=n*W,x+=n*V,y+=n*Z,v+=n*J,g+=n*X,w+=n*Y,c+=(n=t[2])*L,f+=n*N,d+=n*U,s+=n*z,u+=n*F,b+=n*D,h+=n*H,l+=n*q,p+=n*K,m+=n*G,x+=n*W,y+=n*V,v+=n*Z,g+=n*J,w+=n*X,_+=n*Y,f+=(n=t[3])*L,d+=n*N,s+=n*U,u+=n*z,b+=n*F,h+=n*D,l+=n*H,p+=n*q,m+=n*K,x+=n*G,y+=n*W,v+=n*V,g+=n*Z,w+=n*J,_+=n*X,M+=n*Y,d+=(n=t[4])*L,s+=n*N,u+=n*U,b+=n*z,h+=n*F,l+=n*D,p+=n*H,m+=n*q,x+=n*K,y+=n*G,v+=n*W,g+=n*V,w+=n*Z,_+=n*J,M+=n*X,k+=n*Y,s+=(n=t[5])*L,u+=n*N,b+=n*U,h+=n*z,l+=n*F,p+=n*D,m+=n*H,x+=n*q,y+=n*K,v+=n*G,g+=n*W,w+=n*V,_+=n*Z,M+=n*J,k+=n*X,S+=n*Y,u+=(n=t[6])*L,b+=n*N,h+=n*U,l+=n*z,p+=n*F,m+=n*D,x+=n*H,y+=n*q,v+=n*K,g+=n*G,w+=n*W,_+=n*V,M+=n*Z,k+=n*J,S+=n*X,A+=n*Y,b+=(n=t[7])*L,h+=n*N,l+=n*U,p+=n*z,m+=n*F,x+=n*D,y+=n*H,v+=n*q,g+=n*K,w+=n*G,_+=n*W,M+=n*V,k+=n*Z,S+=n*J,A+=n*X,E+=n*Y,h+=(n=t[8])*L,l+=n*N,p+=n*U,m+=n*z,x+=n*F,y+=n*D,v+=n*H,g+=n*q,w+=n*K,_+=n*G,M+=n*W,k+=n*V,S+=n*Z,A+=n*J,E+=n*X,O+=n*Y,l+=(n=t[9])*L,p+=n*N,m+=n*U,x+=n*z,y+=n*F,v+=n*D,g+=n*H,w+=n*q,_+=n*K,M+=n*G,k+=n*W,S+=n*V,A+=n*Z,E+=n*J,O+=n*X,T+=n*Y,p+=(n=t[10])*L,m+=n*N,x+=n*U,y+=n*z,v+=n*F,g+=n*D,w+=n*H,_+=n*q,M+=n*K,k+=n*G,S+=n*W,A+=n*V,E+=n*Z,O+=n*J,T+=n*X,P+=n*Y,m+=(n=t[11])*L,x+=n*N,y+=n*U,v+=n*z,g+=n*F,w+=n*D,_+=n*H,M+=n*q,k+=n*K,S+=n*G,A+=n*W,E+=n*V,O+=n*Z,T+=n*J,P+=n*X,j+=n*Y,x+=(n=t[12])*L,y+=n*N,v+=n*U,g+=n*z,w+=n*F,_+=n*D,M+=n*H,k+=n*q,S+=n*K,A+=n*G,E+=n*W,O+=n*V,T+=n*Z,P+=n*J,j+=n*X,B+=n*Y,y+=(n=t[13])*L,v+=n*N,g+=n*U,w+=n*z,_+=n*F,M+=n*D,k+=n*H,S+=n*q,A+=n*K,E+=n*G,O+=n*W,T+=n*V,P+=n*Z,j+=n*J,B+=n*X,R+=n*Y,v+=(n=t[14])*L,g+=n*N,w+=n*U,_+=n*z,M+=n*F,k+=n*D,S+=n*H,A+=n*q,E+=n*K,O+=n*G,T+=n*W,P+=n*V,j+=n*Z,B+=n*J,R+=n*X,C+=n*Y,g+=(n=t[15])*L,o+=38*(_+=n*U),c+=38*(M+=n*z),f+=38*(k+=n*F),d+=38*(S+=n*D),s+=38*(A+=n*H),u+=38*(E+=n*q),b+=38*(O+=n*K),h+=38*(T+=n*G),l+=38*(P+=n*W),p+=38*(j+=n*V),m+=38*(B+=n*Z),x+=38*(R+=n*J),y+=38*(C+=n*X),v+=38*(I+=n*Y),i=(n=(i+=38*(w+=n*N))+(a=1)+65535)-65536*(a=Math.floor(n/65536)),o=(n=o+a+65535)-65536*(a=Math.floor(n/65536)),c=(n=c+a+65535)-65536*(a=Math.floor(n/65536)),f=(n=f+a+65535)-65536*(a=Math.floor(n/65536)),d=(n=d+a+65535)-65536*(a=Math.floor(n/65536)),s=(n=s+a+65535)-65536*(a=Math.floor(n/65536)),u=(n=u+a+65535)-65536*(a=Math.floor(n/65536)),b=(n=b+a+65535)-65536*(a=Math.floor(n/65536)),h=(n=h+a+65535)-65536*(a=Math.floor(n/65536)),l=(n=l+a+65535)-65536*(a=Math.floor(n/65536)),p=(n=p+a+65535)-65536*(a=Math.floor(n/65536)),m=(n=m+a+65535)-65536*(a=Math.floor(n/65536)),x=(n=x+a+65535)-65536*(a=Math.floor(n/65536)),y=(n=y+a+65535)-65536*(a=Math.floor(n/65536)),v=(n=v+a+65535)-65536*(a=Math.floor(n/65536)),g=(n=g+a+65535)-65536*(a=Math.floor(n/65536)),i=(n=(i+=a-1+37*(a-1))+(a=1)+65535)-65536*(a=Math.floor(n/65536)),o=(n=o+a+65535)-65536*(a=Math.floor(n/65536)),c=(n=c+a+65535)-65536*(a=Math.floor(n/65536)),f=(n=f+a+65535)-65536*(a=Math.floor(n/65536)),d=(n=d+a+65535)-65536*(a=Math.floor(n/65536)),s=(n=s+a+65535)-65536*(a=Math.floor(n/65536)),u=(n=u+a+65535)-65536*(a=Math.floor(n/65536)),b=(n=b+a+65535)-65536*(a=Math.floor(n/65536)),h=(n=h+a+65535)-65536*(a=Math.floor(n/65536)),l=(n=l+a+65535)-65536*(a=Math.floor(n/65536)),p=(n=p+a+65535)-65536*(a=Math.floor(n/65536)),m=(n=m+a+65535)-65536*(a=Math.floor(n/65536)),x=(n=x+a+65535)-65536*(a=Math.floor(n/65536)),y=(n=y+a+65535)-65536*(a=Math.floor(n/65536)),v=(n=v+a+65535)-65536*(a=Math.floor(n/65536)),g=(n=g+a+65535)-65536*(a=Math.floor(n/65536)),i+=a-1+37*(a-1),e[0]=i,e[1]=o,e[2]=c,e[3]=f,e[4]=d,e[5]=s,e[6]=u,e[7]=b,e[8]=h,e[9]=l,e[10]=p,e[11]=m,e[12]=x,e[13]=y,e[14]=v,e[15]=g}function F(e,t){z(e,t,t)}function D(e,r){var n,a=t();for(n=0;n<16;n++)a[n]=r[n];for(n=253;n>=0;n--)F(a,a),2!==n&&4!==n&&z(a,a,r);for(n=0;n<16;n++)e[n]=a[n]}function H(e,r){var n,a=t();for(n=0;n<16;n++)a[n]=r[n];for(n=250;n>=0;n--)F(a,a),1!==n&&z(a,a,r);for(n=0;n<16;n++)e[n]=a[n]}function q(e,r,n){var a,i,o=new Uint8Array(32),c=new Float64Array(80),d=t(),s=t(),u=t(),b=t(),h=t(),l=t();for(i=0;i<31;i++)o[i]=r[i];for(o[31]=127&r[31]|64,o[0]&=248,L(c,n),i=0;i<16;i++)s[i]=c[i],b[i]=d[i]=u[i]=0;for(d[0]=b[0]=1,i=254;i>=0;--i)B(d,s,a=o[i>>>3]>>>(7&i)&1),B(u,b,a),N(h,d,u),U(d,d,u),N(u,s,b),U(s,s,b),F(b,h),F(l,d),z(d,u,d),z(u,s,h),N(h,d,u),U(d,d,u),F(s,d),U(u,b,l),z(d,u,f),N(d,d,b),z(u,u,d),z(d,b,l),z(b,s,c),F(s,h),B(d,s,a),B(u,b,a);for(i=0;i<16;i++)c[i+16]=d[i],c[i+32]=u[i],c[i+48]=s[i],c[i+64]=b[i];var p=c.subarray(32),m=c.subarray(16);return D(p,p),z(m,m,p),R(e,m),0}function K(e,t){return q(e,t,i)}function G(e,t){return n(t,32),K(e,t)}function W(e,t,r){var n=new Uint8Array(32);return q(n,r,t),v(e,a,n,g)}S.prototype.blocks=function(e,t,r){for(var n,a,i,o,c,f,d,s,u,b,h,l,p,m,x,y,v,g,w,_=this.fin?0:2048,M=this.h[0],k=this.h[1],S=this.h[2],A=this.h[3],E=this.h[4],O=this.h[5],T=this.h[6],P=this.h[7],j=this.h[8],B=this.h[9],R=this.r[0],C=this.r[1],I=this.r[2],L=this.r[3],N=this.r[4],U=this.r[5],z=this.r[6],F=this.r[7],D=this.r[8],H=this.r[9];r>=16;)b=u=0,b+=(M+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*R,b+=(k+=8191&(n>>>13|(a=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*H),b+=(S+=8191&(a>>>10|(i=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*D),b+=(A+=8191&(i>>>7|(o=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*F),u=(b+=(E+=8191&(o>>>4|(c=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*z))>>>13,b&=8191,b+=(O+=c>>>1&8191)*(5*U),b+=(T+=8191&(c>>>14|(f=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*N),b+=(P+=8191&(f>>>11|(d=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*L),b+=(j+=8191&(d>>>8|(s=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*I),h=u+=(b+=(B+=s>>>5|_)*(5*C))>>>13,h+=M*C,h+=k*R,h+=S*(5*H),h+=A*(5*D),u=(h+=E*(5*F))>>>13,h&=8191,h+=O*(5*z),h+=T*(5*U),h+=P*(5*N),h+=j*(5*L),u+=(h+=B*(5*I))>>>13,h&=8191,l=u,l+=M*I,l+=k*C,l+=S*R,l+=A*(5*H),u=(l+=E*(5*D))>>>13,l&=8191,l+=O*(5*F),l+=T*(5*z),l+=P*(5*U),l+=j*(5*N),p=u+=(l+=B*(5*L))>>>13,p+=M*L,p+=k*I,p+=S*C,p+=A*R,u=(p+=E*(5*H))>>>13,p&=8191,p+=O*(5*D),p+=T*(5*F),p+=P*(5*z),p+=j*(5*U),m=u+=(p+=B*(5*N))>>>13,m+=M*N,m+=k*L,m+=S*I,m+=A*C,u=(m+=E*R)>>>13,m&=8191,m+=O*(5*H),m+=T*(5*D),m+=P*(5*F),m+=j*(5*z),x=u+=(m+=B*(5*U))>>>13,x+=M*U,x+=k*N,x+=S*L,x+=A*I,u=(x+=E*C)>>>13,x&=8191,x+=O*R,x+=T*(5*H),x+=P*(5*D),x+=j*(5*F),y=u+=(x+=B*(5*z))>>>13,y+=M*z,y+=k*U,y+=S*N,y+=A*L,u=(y+=E*I)>>>13,y&=8191,y+=O*C,y+=T*R,y+=P*(5*H),y+=j*(5*D),v=u+=(y+=B*(5*F))>>>13,v+=M*F,v+=k*z,v+=S*U,v+=A*N,u=(v+=E*L)>>>13,v&=8191,v+=O*I,v+=T*C,v+=P*R,v+=j*(5*H),g=u+=(v+=B*(5*D))>>>13,g+=M*D,g+=k*F,g+=S*z,g+=A*U,u=(g+=E*N)>>>13,g&=8191,g+=O*L,g+=T*I,g+=P*C,g+=j*R,w=u+=(g+=B*(5*H))>>>13,w+=M*H,w+=k*D,w+=S*F,w+=A*z,u=(w+=E*U)>>>13,w&=8191,w+=O*N,w+=T*L,w+=P*I,w+=j*C,M=b=8191&(u=(u=((u+=(w+=B*R)>>>13)<<2)+u|0)+(b&=8191)|0),k=h+=u>>>=13,S=l&=8191,A=p&=8191,E=m&=8191,O=x&=8191,T=y&=8191,P=v&=8191,j=g&=8191,B=w&=8191,t+=16,r-=16;this.h[0]=M,this.h[1]=k,this.h[2]=S,this.h[3]=A,this.h[4]=E,this.h[5]=O,this.h[6]=T,this.h[7]=P,this.h[8]=j,this.h[9]=B},S.prototype.finish=function(e,t){var r,n,a,i,o=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=r,r=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,o[0]=this.h[0]+5,r=o[0]>>>13,o[0]&=8191,i=1;i<10;i++)o[i]=this.h[i]+r,r=o[i]>>>13,o[i]&=8191;for(o[9]-=8192,n=(1^r)-1,i=0;i<10;i++)o[i]&=n;for(n=~n,i=0;i<10;i++)this.h[i]=this.h[i]&n|o[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),a=this.h[0]+this.pad[0],this.h[0]=65535&a,i=1;i<8;i++)a=(this.h[i]+this.pad[i]|0)+(a>>>16)|0,this.h[i]=65535&a;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},S.prototype.update=function(e,t,r){var n,a;if(this.leftover){for((a=16-this.leftover)>r&&(a=r),n=0;n=16&&(a=r-r%16,this.blocks(e,t,a),t+=a,r-=a),r){for(n=0;n=128;){for(_=0;_<16;_++)M=8*_+Z,P[_]=r[M+0]<<24|r[M+1]<<16|r[M+2]<<8|r[M+3],j[_]=r[M+4]<<24|r[M+5]<<16|r[M+6]<<8|r[M+7];for(_=0;_<80;_++)if(a=B,i=R,o=C,c=I,f=L,d=N,s=U,z,b=F,h=D,l=H,p=q,m=K,x=G,y=W,V,A=65535&(S=V),E=S>>>16,O=65535&(k=z),T=k>>>16,A+=65535&(S=(K>>>14|L<<18)^(K>>>18|L<<14)^(L>>>9|K<<23)),E+=S>>>16,O+=65535&(k=(L>>>14|K<<18)^(L>>>18|K<<14)^(K>>>9|L<<23)),T+=k>>>16,A+=65535&(S=K&G^~K&W),E+=S>>>16,O+=65535&(k=L&N^~L&U),T+=k>>>16,A+=65535&(S=J[2*_+1]),E+=S>>>16,O+=65535&(k=J[2*_]),T+=k>>>16,k=P[_%16],E+=(S=j[_%16])>>>16,O+=65535&k,T+=k>>>16,O+=(E+=(A+=65535&S)>>>16)>>>16,A=65535&(S=w=65535&A|E<<16),E=S>>>16,O=65535&(k=g=65535&O|(T+=O>>>16)<<16),T=k>>>16,A+=65535&(S=(F>>>28|B<<4)^(B>>>2|F<<30)^(B>>>7|F<<25)),E+=S>>>16,O+=65535&(k=(B>>>28|F<<4)^(F>>>2|B<<30)^(F>>>7|B<<25)),T+=k>>>16,E+=(S=F&D^F&H^D&H)>>>16,O+=65535&(k=B&R^B&C^R&C),T+=k>>>16,u=65535&(O+=(E+=(A+=65535&S)>>>16)>>>16)|(T+=O>>>16)<<16,v=65535&A|E<<16,A=65535&(S=p),E=S>>>16,O=65535&(k=c),T=k>>>16,E+=(S=w)>>>16,O+=65535&(k=g),T+=k>>>16,R=a,C=i,I=o,L=c=65535&(O+=(E+=(A+=65535&S)>>>16)>>>16)|(T+=O>>>16)<<16,N=f,U=d,z=s,B=u,D=b,H=h,q=l,K=p=65535&A|E<<16,G=m,W=x,V=y,F=v,_%16==15)for(M=0;M<16;M++)k=P[M],A=65535&(S=j[M]),E=S>>>16,O=65535&k,T=k>>>16,k=P[(M+9)%16],A+=65535&(S=j[(M+9)%16]),E+=S>>>16,O+=65535&k,T+=k>>>16,g=P[(M+1)%16],A+=65535&(S=((w=j[(M+1)%16])>>>1|g<<31)^(w>>>8|g<<24)^(w>>>7|g<<25)),E+=S>>>16,O+=65535&(k=(g>>>1|w<<31)^(g>>>8|w<<24)^g>>>7),T+=k>>>16,g=P[(M+14)%16],E+=(S=((w=j[(M+14)%16])>>>19|g<<13)^(g>>>29|w<<3)^(w>>>6|g<<26))>>>16,O+=65535&(k=(g>>>19|w<<13)^(w>>>29|g<<3)^g>>>6),T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,P[M]=65535&O|T<<16,j[M]=65535&A|E<<16;A=65535&(S=F),E=S>>>16,O=65535&(k=B),T=k>>>16,k=e[0],E+=(S=t[0])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[0]=B=65535&O|T<<16,t[0]=F=65535&A|E<<16,A=65535&(S=D),E=S>>>16,O=65535&(k=R),T=k>>>16,k=e[1],E+=(S=t[1])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[1]=R=65535&O|T<<16,t[1]=D=65535&A|E<<16,A=65535&(S=H),E=S>>>16,O=65535&(k=C),T=k>>>16,k=e[2],E+=(S=t[2])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[2]=C=65535&O|T<<16,t[2]=H=65535&A|E<<16,A=65535&(S=q),E=S>>>16,O=65535&(k=I),T=k>>>16,k=e[3],E+=(S=t[3])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[3]=I=65535&O|T<<16,t[3]=q=65535&A|E<<16,A=65535&(S=K),E=S>>>16,O=65535&(k=L),T=k>>>16,k=e[4],E+=(S=t[4])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[4]=L=65535&O|T<<16,t[4]=K=65535&A|E<<16,A=65535&(S=G),E=S>>>16,O=65535&(k=N),T=k>>>16,k=e[5],E+=(S=t[5])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[5]=N=65535&O|T<<16,t[5]=G=65535&A|E<<16,A=65535&(S=W),E=S>>>16,O=65535&(k=U),T=k>>>16,k=e[6],E+=(S=t[6])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[6]=U=65535&O|T<<16,t[6]=W=65535&A|E<<16,A=65535&(S=V),E=S>>>16,O=65535&(k=z),T=k>>>16,k=e[7],E+=(S=t[7])>>>16,O+=65535&k,T+=k>>>16,T+=(O+=(E+=(A+=65535&S)>>>16)>>>16)>>>16,e[7]=z=65535&O|T<<16,t[7]=V=65535&A|E<<16,Z+=128,n-=128}return n}function Y(e,t,r){var n,a=new Int32Array(8),i=new Int32Array(8),o=new Uint8Array(256),c=r;for(a[0]=1779033703,a[1]=3144134277,a[2]=1013904242,a[3]=2773480762,a[4]=1359893119,a[5]=2600822924,a[6]=528734635,a[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,X(a,i,t,r),r%=128,n=0;n=0;--a)Q(e,t,n=r[a/8|0]>>(7&a)&1),$(t,e),$(e,e),Q(e,t,n)}function re(e,r){var n=[t(),t(),t(),t()];P(n[0],u),P(n[1],b),P(n[2],c),z(n[3],u,b),te(e,n,r)}function ne(e,r,a){var i,o=new Uint8Array(64),c=[t(),t(),t(),t()];for(a||n(r,32),Y(o,r,32),o[0]&=248,o[31]&=127,o[31]|=64,re(c,o),ee(e,c),i=0;i<32;i++)r[i+32]=e[i];return 0}var ae=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ie(e,t){var r,n,a,i;for(n=63;n>=32;--n){for(r=0,a=n-32,i=n-12;a>4)*ae[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;a++)t[a]-=r*ae[a];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function oe(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ie(e,r)}function ce(e,r,n,a){var i,o,c=new Uint8Array(64),f=new Uint8Array(64),d=new Uint8Array(64),s=new Float64Array(64),u=[t(),t(),t(),t()];Y(c,a,32),c[0]&=248,c[31]&=127,c[31]|=64;var b=n+64;for(i=0;i>7&&U(e[0],o,e[0]),z(e[3],e[0],e[1]),0)}(b,a))return-1;for(i=0;i=0},e.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return ne(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(se(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),r=0;r=8.0.0"},"main":"lib/index.js","bugs":{"url":"https://github.com/ethereum/web3.js/issues"},"keywords":["Ethereum","JavaScript","API"],"author":"ethereum.org","types":"types/index.d.ts","scripts":{"compile":"tsc -b tsconfig.json","dtslint":"dtslint --localTs ../../node_modules/typescript/lib types","postinstall":"echo \\"WARNING: the web3-shh and web3-bzz api will be deprecated in the next version\\""},"authors":[{"name":"Fabian Vogelsteller","email":"fabian@ethereum.org","homepage":"http://frozeman.de"},{"name":"Marek Kotewicz","email":"marek@parity.io","url":"https://github.com/debris"},{"name":"Marian Oancea","url":"https://github.com/cubedro"},{"name":"Gav Wood","email":"g@parity.io","homepage":"http://gavwood.com"},{"name":"Jeffery Wilcke","email":"jeffrey.wilcke@ethereum.org","url":"https://github.com/obscuren"}],"dependencies":{"web3-bzz":"1.7.4","web3-core":"1.7.4","web3-eth":"1.7.4","web3-eth-personal":"1.7.4","web3-net":"1.7.4","web3-shh":"1.7.4","web3-utils":"1.7.4"},"devDependencies":{"@types/node":"^12.12.6","dtslint":"^3.4.1","typescript":"^3.9.5","web3-core-helpers":"1.7.4"},"gitHead":"77005c072a64fdd364eace821df0c39388871102"}')},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=r(44).callbackify,i=r(16).errors,o=r(232),c=r(478),f=r(479),d=function e(t,r){this.provider=null,this.providers=e.providers,this.setProvider(t,r),this.subscriptions=new Map};d.givenProvider=f,d.providers={WebsocketProvider:r(480),HttpProvider:r(490),IpcProvider:r(500)},d.prototype.setProvider=function(e,t){var r=this;if(e&&"string"==typeof e&&this.providers)if(/^http(s)?:\/\//i.test(e))e=new this.providers.HttpProvider(e);else if(/^ws(s)?:\/\//i.test(e))e=new this.providers.WebsocketProvider(e);else if(e&&"object"===n(t)&&"function"==typeof t.connect)e=new this.providers.IpcProvider(e,t);else if(e)throw new Error("Can't autodetect provider for \""+e+'"');if(this.provider&&this.provider.connected&&this.clearSubscriptions(),this.provider=e||null,this.provider&&this.provider.on){"function"==typeof e.request?this.provider.on("message",(function(e){if(e&&"eth_subscription"===e.type&&e.data){var t=e.data;t.subscription&&r.subscriptions.has(t.subscription)&&r.subscriptions.get(t.subscription).callback(null,t.result)}})):this.provider.on("data",(function(e,t){(e=e||t).method&&e.params&&e.params.subscription&&r.subscriptions.has(e.params.subscription)&&r.subscriptions.get(e.params.subscription).callback(null,e.params.result)})),this.provider.on("connect",(function(){r.subscriptions.forEach((function(e){e.subscription.resubscribe()}))})),this.provider.on("error",(function(e){r.subscriptions.forEach((function(t){t.callback(e)}))}));this.provider.on("disconnect",(function(e){r._isCleanCloseEvent(e)&&!r._isIpcCloseError(e)||(r.subscriptions.forEach((function(t){t.callback(i.ConnectionCloseError(e)),r.subscriptions.delete(t.subscription.id)})),r.provider&&r.provider.emit&&r.provider.emit("error",i.ConnectionCloseError(e))),r.provider&&r.provider.emit&&r.provider.emit("end",e)}))}},d.prototype.send=function(e,t){if(t=t||function(){},!this.provider)return t(i.InvalidProvider());var r=e.method,n=e.params,c=o.toPayload(r,n),f=this._jsonrpcResultCallback(t,c);if(this.provider.request)a(this.provider.request.bind(this.provider))({method:r,params:n},t);else if(this.provider.sendAsync)this.provider.sendAsync(c,f);else{if(!this.provider.send)throw new Error("Provider does not have a request or send method to use.");this.provider.send(c,f)}},d.prototype.sendBatch=function(e,t){if(!this.provider)return t(i.InvalidProvider());var r=o.toBatchPayload(e);this.provider[this.provider.sendAsync?"sendAsync":"send"](r,(function(e,r){return e?t(e):Array.isArray(r)?void t(null,r):t(i.InvalidResponse(r))}))},d.prototype.addSubscription=function(e,t){if(!this.provider.on)throw new Error("The provider doesn't support subscriptions: "+this.provider.constructor.name);this.subscriptions.set(e.id,{callback:t,subscription:e})},d.prototype.removeSubscription=function(e,t){if(this.subscriptions.has(e)){var r=this.subscriptions.get(e).subscription.options.type;return this.subscriptions.delete(e),void this.send({method:r+"_unsubscribe",params:[e]},t)}"function"==typeof t&&t(null)},d.prototype.clearSubscriptions=function(e){try{var t=this;return this.subscriptions.size>0&&this.subscriptions.forEach((function(r,n){e&&"syncing"===r.name||t.removeSubscription(n)})),this.provider.reset&&this.provider.reset(),!0}catch(e){throw new Error("Error while clearing subscriptions: ".concat(e))}},d.prototype._isCleanCloseEvent=function(e){return"object"===n(e)&&([1e3].includes(e.code)||!0===e.wasClean)},d.prototype._isIpcCloseError=function(e){return"boolean"==typeof e&&e},d.prototype._jsonrpcResultCallback=function(e,t){return function(r,n){return n&&n.id&&t.id!==n.id?e(new Error("Wrong response id ".concat(n.id," (expected: ").concat(t.id,") in ").concat(JSON.stringify(t)))):r?e(r):n&&n.error?e(i.ErrorResponse(n)):o.isValidResponse(n)?void e(null,n.result):e(i.InvalidResponse(n))}},e.exports={Manager:d,BatchManager:c}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports={ErrorResponse:function(e){var t=e&&e.error&&e.error.message?e.error.message:JSON.stringify(e),r=e.error&&e.error.data?e.error.data:null,n=new Error("Returned error: "+t);return n.data=r,n},InvalidNumberOfParams:function(e,t,r){return new Error('Invalid number of parameters for "'+r+'". Got '+e+" expected "+t+"!")},InvalidConnection:function(e,t){return this.ConnectionError("CONNECTION ERROR: Couldn't connect to node "+e+".",t)},InvalidProvider:function(){return new Error("Provider not set or invalid")},InvalidResponse:function(e){var t=e&&e.error&&e.error.message?e.error.message:"Invalid JSON RPC response: "+JSON.stringify(e);return new Error(t)},ConnectionTimeout:function(e){return new Error("CONNECTION TIMEOUT: timeout of "+e+" ms achived")},ConnectionNotOpenError:function(e){return this.ConnectionError("connection not open on send()",e)},ConnectionCloseError:function(e){return"object"===n(e)&&e.code&&e.reason?this.ConnectionError("CONNECTION ERROR: The connection got closed with the close code `"+e.code+"` and the following reason string `"+e.reason+"`",e):new Error("CONNECTION ERROR: The connection closed unexpectedly")},MaxAttemptsReachedOnReconnectingError:function(){return new Error("Maximum number of reconnect attempts reached!")},PendingRequestsOnReconnectingError:function(){return new Error("CONNECTION ERROR: Provider started to reconnect before the response got received!")},ConnectionError:function(e,t){var r=new Error(e);return t&&(r.code=t.code,r.reason=t.reason),r},RevertInstructionError:function(e,t){var r=new Error("Your request got reverted with the following reason string: "+e);return r.reason=e,r.signature=t,r},TransactionRevertInstructionError:function(e,t,r){var n=new Error("Transaction has been reverted by the EVM:\n"+JSON.stringify(r,null,2));return n.reason=e,n.signature=t,n.receipt=r,n},TransactionError:function(e,t){var r=new Error(e);return r.receipt=t,r},NoContractAddressFoundError:function(e){return this.TransactionError("The transaction receipt didn't contain a contract address.",e)},ContractCodeNotStoredError:function(e){return this.TransactionError("The contract code couldn't be stored, please check your gas limit.",e)},TransactionRevertedWithoutReasonError:function(e){return this.TransactionError("Transaction has been reverted by the EVM:\n"+JSON.stringify(e,null,2),e)},TransactionOutOfGasError:function(e){return this.TransactionError("Transaction ran out of gas. Please provide more gas:\n"+JSON.stringify(e,null,2),e)},ResolverMethodMissingError:function(e,t){return new Error("The resolver at "+e+'does not implement requested method: "'+t+'".')},ContractMissingABIError:function(){return new Error("You must provide the json interface of the contract when instantiating a contract object.")},ContractOnceRequiresCallbackError:function(){return new Error("Once requires a callback as the second parameter.")},ContractEventDoesNotExistError:function(e){return new Error('Event "'+e+"\" doesn't exist in this contract.")},ContractReservedEventError:function(e){return new Error('The event "'+e+"\" is a reserved event name, you can't use it.")},ContractMissingDeployDataError:function(){return new Error('No "data" specified in neither the given options, nor the default options.')},ContractNoAddressDefinedError:function(){return new Error("This contract object doesn't have address set yet, please set an address first.")},ContractNoFromAddressDefinedError:function(){return new Error('No "from" address specified in neither the given options, nor the default options.')}}},function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t2)throw new Error("[ethjs-unit] while converting number "+e+" to wei, too many decimal points");var b=u[0],h=u[1];if(b||(b="0"),h||(h="0"),h.length>i)throw new Error("[ethjs-unit] while converting number "+e+" to wei, too many decimal places");for(;h.length=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function d(e,t,r,n){for(var a=0,i=Math.min(e.length,r),o=t;o=49?c-49+10:c>=17?c-17+10:c}return a}o.isBN=function(e){return e instanceof o||null!==e&&"object"===t(e)&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,r,n){if("number"==typeof e)return this._initNumber(e,r,n);if("object"===t(e))return this._initArray(e,r,n);"hex"===r&&(r=16),a(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===r?this._parseHex(e,i):this._parseBase(e,r,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),r,n)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(a(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(a("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);else if("le"===r)for(n=0,i=0;n>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)a=f(e,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==t&&(a=f(e,t,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=t)n++;n--,a=a/t|0;for(var i=e.length-r,o=i%n,c=Math.min(i,i-o)+r,f=0,s=r;s1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var s=["","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"],u=[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],b=[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];function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var a=0|e.words[0],i=0|t.words[0],o=a*i,c=67108863&o,f=o/67108864|0;r.words[0]=c;for(var d=1;d>>26,u=67108863&f,b=Math.min(d,t.length-1),h=Math.max(0,d-e.length+1);h<=b;h++){var l=d-h|0;s+=(o=(a=0|e.words[l])*(i=0|t.words[h])+u)/67108864|0,u=67108863&o}r.words[d]=0|u,f=0|s}return 0!==f?r.words[d]=0|f:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?s[6-f.length]+f+r:f+r,(n+=2)>=26&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=u[e],h=b[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var p=l.modn(h).toString(e);r=(l=l.idivn(h)).isZero()?p+r:s[d-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}a(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return a(void 0!==c),this.toArrayLike(c,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),i=r||Math.max(1,n);a(n<=i,"byte array longer than desired length"),a(i>0,"Requested array length <= 0"),this.strip();var o,c,f="le"===t,d=new e(i),s=this.clone();if(f){for(c=0;!s.isZero();c++)o=s.andln(255),s.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){a("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){a("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,a=this.cmp(e);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,h=0|o[1],l=8191&h,p=h>>>13,m=0|o[2],x=8191&m,y=m>>>13,v=0|o[3],g=8191&v,w=v>>>13,_=0|o[4],M=8191&_,k=_>>>13,S=0|o[5],A=8191&S,E=S>>>13,O=0|o[6],T=8191&O,P=O>>>13,j=0|o[7],B=8191&j,R=j>>>13,C=0|o[8],I=8191&C,L=C>>>13,N=0|o[9],U=8191&N,z=N>>>13,F=0|c[0],D=8191&F,H=F>>>13,q=0|c[1],K=8191&q,G=q>>>13,W=0|c[2],V=8191&W,Z=W>>>13,J=0|c[3],X=8191&J,Y=J>>>13,$=0|c[4],Q=8191&$,ee=$>>>13,te=0|c[5],re=8191&te,ne=te>>>13,ae=0|c[6],ie=8191&ae,oe=ae>>>13,ce=0|c[7],fe=8191&ce,de=ce>>>13,se=0|c[8],ue=8191&se,be=se>>>13,he=0|c[9],le=8191&he,pe=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(d+(n=Math.imul(u,D))|0)+((8191&(a=(a=Math.imul(u,H))+Math.imul(b,D)|0))<<13)|0;d=((i=Math.imul(b,H))+(a>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(l,D),a=(a=Math.imul(l,H))+Math.imul(p,D)|0,i=Math.imul(p,H);var xe=(d+(n=n+Math.imul(u,K)|0)|0)+((8191&(a=(a=a+Math.imul(u,G)|0)+Math.imul(b,K)|0))<<13)|0;d=((i=i+Math.imul(b,G)|0)+(a>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(x,D),a=(a=Math.imul(x,H))+Math.imul(y,D)|0,i=Math.imul(y,H),n=n+Math.imul(l,K)|0,a=(a=a+Math.imul(l,G)|0)+Math.imul(p,K)|0,i=i+Math.imul(p,G)|0;var ye=(d+(n=n+Math.imul(u,V)|0)|0)+((8191&(a=(a=a+Math.imul(u,Z)|0)+Math.imul(b,V)|0))<<13)|0;d=((i=i+Math.imul(b,Z)|0)+(a>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(g,D),a=(a=Math.imul(g,H))+Math.imul(w,D)|0,i=Math.imul(w,H),n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,G)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(l,V)|0,a=(a=a+Math.imul(l,Z)|0)+Math.imul(p,V)|0,i=i+Math.imul(p,Z)|0;var ve=(d+(n=n+Math.imul(u,X)|0)|0)+((8191&(a=(a=a+Math.imul(u,Y)|0)+Math.imul(b,X)|0))<<13)|0;d=((i=i+Math.imul(b,Y)|0)+(a>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(M,D),a=(a=Math.imul(M,H))+Math.imul(k,D)|0,i=Math.imul(k,H),n=n+Math.imul(g,K)|0,a=(a=a+Math.imul(g,G)|0)+Math.imul(w,K)|0,i=i+Math.imul(w,G)|0,n=n+Math.imul(x,V)|0,a=(a=a+Math.imul(x,Z)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,Z)|0,n=n+Math.imul(l,X)|0,a=(a=a+Math.imul(l,Y)|0)+Math.imul(p,X)|0,i=i+Math.imul(p,Y)|0;var ge=(d+(n=n+Math.imul(u,Q)|0)|0)+((8191&(a=(a=a+Math.imul(u,ee)|0)+Math.imul(b,Q)|0))<<13)|0;d=((i=i+Math.imul(b,ee)|0)+(a>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,D),a=(a=Math.imul(A,H))+Math.imul(E,D)|0,i=Math.imul(E,H),n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,G)|0)+Math.imul(k,K)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(g,V)|0,a=(a=a+Math.imul(g,Z)|0)+Math.imul(w,V)|0,i=i+Math.imul(w,Z)|0,n=n+Math.imul(x,X)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(l,Q)|0,a=(a=a+Math.imul(l,ee)|0)+Math.imul(p,Q)|0,i=i+Math.imul(p,ee)|0;var we=(d+(n=n+Math.imul(u,re)|0)|0)+((8191&(a=(a=a+Math.imul(u,ne)|0)+Math.imul(b,re)|0))<<13)|0;d=((i=i+Math.imul(b,ne)|0)+(a>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,D),a=(a=Math.imul(T,H))+Math.imul(P,D)|0,i=Math.imul(P,H),n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,G)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,G)|0,n=n+Math.imul(M,V)|0,a=(a=a+Math.imul(M,Z)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,Z)|0,n=n+Math.imul(g,X)|0,a=(a=a+Math.imul(g,Y)|0)+Math.imul(w,X)|0,i=i+Math.imul(w,Y)|0,n=n+Math.imul(x,Q)|0,a=(a=a+Math.imul(x,ee)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(l,re)|0,a=(a=a+Math.imul(l,ne)|0)+Math.imul(p,re)|0,i=i+Math.imul(p,ne)|0;var _e=(d+(n=n+Math.imul(u,ie)|0)|0)+((8191&(a=(a=a+Math.imul(u,oe)|0)+Math.imul(b,ie)|0))<<13)|0;d=((i=i+Math.imul(b,oe)|0)+(a>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(B,D),a=(a=Math.imul(B,H))+Math.imul(R,D)|0,i=Math.imul(R,H),n=n+Math.imul(T,K)|0,a=(a=a+Math.imul(T,G)|0)+Math.imul(P,K)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(A,V)|0,a=(a=a+Math.imul(A,Z)|0)+Math.imul(E,V)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(M,X)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(k,X)|0,i=i+Math.imul(k,Y)|0,n=n+Math.imul(g,Q)|0,a=(a=a+Math.imul(g,ee)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,ee)|0,n=n+Math.imul(x,re)|0,a=(a=a+Math.imul(x,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(l,ie)|0,a=(a=a+Math.imul(l,oe)|0)+Math.imul(p,ie)|0,i=i+Math.imul(p,oe)|0;var Me=(d+(n=n+Math.imul(u,fe)|0)|0)+((8191&(a=(a=a+Math.imul(u,de)|0)+Math.imul(b,fe)|0))<<13)|0;d=((i=i+Math.imul(b,de)|0)+(a>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,D),a=(a=Math.imul(I,H))+Math.imul(L,D)|0,i=Math.imul(L,H),n=n+Math.imul(B,K)|0,a=(a=a+Math.imul(B,G)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(T,V)|0,a=(a=a+Math.imul(T,Z)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(A,X)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,a=(a=a+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(g,re)|0,a=(a=a+Math.imul(g,ne)|0)+Math.imul(w,re)|0,i=i+Math.imul(w,ne)|0,n=n+Math.imul(x,ie)|0,a=(a=a+Math.imul(x,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(l,fe)|0,a=(a=a+Math.imul(l,de)|0)+Math.imul(p,fe)|0,i=i+Math.imul(p,de)|0;var ke=(d+(n=n+Math.imul(u,ue)|0)|0)+((8191&(a=(a=a+Math.imul(u,be)|0)+Math.imul(b,ue)|0))<<13)|0;d=((i=i+Math.imul(b,be)|0)+(a>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,D),a=(a=Math.imul(U,H))+Math.imul(z,D)|0,i=Math.imul(z,H),n=n+Math.imul(I,K)|0,a=(a=a+Math.imul(I,G)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,G)|0,n=n+Math.imul(B,V)|0,a=(a=a+Math.imul(B,Z)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(T,X)|0,a=(a=a+Math.imul(T,Y)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(A,Q)|0,a=(a=a+Math.imul(A,ee)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(M,re)|0,a=(a=a+Math.imul(M,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(g,ie)|0,a=(a=a+Math.imul(g,oe)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,oe)|0,n=n+Math.imul(x,fe)|0,a=(a=a+Math.imul(x,de)|0)+Math.imul(y,fe)|0,i=i+Math.imul(y,de)|0,n=n+Math.imul(l,ue)|0,a=(a=a+Math.imul(l,be)|0)+Math.imul(p,ue)|0,i=i+Math.imul(p,be)|0;var Se=(d+(n=n+Math.imul(u,le)|0)|0)+((8191&(a=(a=a+Math.imul(u,pe)|0)+Math.imul(b,le)|0))<<13)|0;d=((i=i+Math.imul(b,pe)|0)+(a>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,K),a=(a=Math.imul(U,G))+Math.imul(z,K)|0,i=Math.imul(z,G),n=n+Math.imul(I,V)|0,a=(a=a+Math.imul(I,Z)|0)+Math.imul(L,V)|0,i=i+Math.imul(L,Z)|0,n=n+Math.imul(B,X)|0,a=(a=a+Math.imul(B,Y)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(T,Q)|0,a=(a=a+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(A,re)|0,a=(a=a+Math.imul(A,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(M,ie)|0,a=(a=a+Math.imul(M,oe)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,oe)|0,n=n+Math.imul(g,fe)|0,a=(a=a+Math.imul(g,de)|0)+Math.imul(w,fe)|0,i=i+Math.imul(w,de)|0,n=n+Math.imul(x,ue)|0,a=(a=a+Math.imul(x,be)|0)+Math.imul(y,ue)|0,i=i+Math.imul(y,be)|0;var Ae=(d+(n=n+Math.imul(l,le)|0)|0)+((8191&(a=(a=a+Math.imul(l,pe)|0)+Math.imul(p,le)|0))<<13)|0;d=((i=i+Math.imul(p,pe)|0)+(a>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,V),a=(a=Math.imul(U,Z))+Math.imul(z,V)|0,i=Math.imul(z,Z),n=n+Math.imul(I,X)|0,a=(a=a+Math.imul(I,Y)|0)+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(B,Q)|0,a=(a=a+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,a=(a=a+Math.imul(T,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(A,ie)|0,a=(a=a+Math.imul(A,oe)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,oe)|0,n=n+Math.imul(M,fe)|0,a=(a=a+Math.imul(M,de)|0)+Math.imul(k,fe)|0,i=i+Math.imul(k,de)|0,n=n+Math.imul(g,ue)|0,a=(a=a+Math.imul(g,be)|0)+Math.imul(w,ue)|0,i=i+Math.imul(w,be)|0;var Ee=(d+(n=n+Math.imul(x,le)|0)|0)+((8191&(a=(a=a+Math.imul(x,pe)|0)+Math.imul(y,le)|0))<<13)|0;d=((i=i+Math.imul(y,pe)|0)+(a>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,X),a=(a=Math.imul(U,Y))+Math.imul(z,X)|0,i=Math.imul(z,Y),n=n+Math.imul(I,Q)|0,a=(a=a+Math.imul(I,ee)|0)+Math.imul(L,Q)|0,i=i+Math.imul(L,ee)|0,n=n+Math.imul(B,re)|0,a=(a=a+Math.imul(B,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(T,ie)|0,a=(a=a+Math.imul(T,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(A,fe)|0,a=(a=a+Math.imul(A,de)|0)+Math.imul(E,fe)|0,i=i+Math.imul(E,de)|0,n=n+Math.imul(M,ue)|0,a=(a=a+Math.imul(M,be)|0)+Math.imul(k,ue)|0,i=i+Math.imul(k,be)|0;var Oe=(d+(n=n+Math.imul(g,le)|0)|0)+((8191&(a=(a=a+Math.imul(g,pe)|0)+Math.imul(w,le)|0))<<13)|0;d=((i=i+Math.imul(w,pe)|0)+(a>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,Q),a=(a=Math.imul(U,ee))+Math.imul(z,Q)|0,i=Math.imul(z,ee),n=n+Math.imul(I,re)|0,a=(a=a+Math.imul(I,ne)|0)+Math.imul(L,re)|0,i=i+Math.imul(L,ne)|0,n=n+Math.imul(B,ie)|0,a=(a=a+Math.imul(B,oe)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,oe)|0,n=n+Math.imul(T,fe)|0,a=(a=a+Math.imul(T,de)|0)+Math.imul(P,fe)|0,i=i+Math.imul(P,de)|0,n=n+Math.imul(A,ue)|0,a=(a=a+Math.imul(A,be)|0)+Math.imul(E,ue)|0,i=i+Math.imul(E,be)|0;var Te=(d+(n=n+Math.imul(M,le)|0)|0)+((8191&(a=(a=a+Math.imul(M,pe)|0)+Math.imul(k,le)|0))<<13)|0;d=((i=i+Math.imul(k,pe)|0)+(a>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),a=(a=Math.imul(U,ne))+Math.imul(z,re)|0,i=Math.imul(z,ne),n=n+Math.imul(I,ie)|0,a=(a=a+Math.imul(I,oe)|0)+Math.imul(L,ie)|0,i=i+Math.imul(L,oe)|0,n=n+Math.imul(B,fe)|0,a=(a=a+Math.imul(B,de)|0)+Math.imul(R,fe)|0,i=i+Math.imul(R,de)|0,n=n+Math.imul(T,ue)|0,a=(a=a+Math.imul(T,be)|0)+Math.imul(P,ue)|0,i=i+Math.imul(P,be)|0;var Pe=(d+(n=n+Math.imul(A,le)|0)|0)+((8191&(a=(a=a+Math.imul(A,pe)|0)+Math.imul(E,le)|0))<<13)|0;d=((i=i+Math.imul(E,pe)|0)+(a>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,ie),a=(a=Math.imul(U,oe))+Math.imul(z,ie)|0,i=Math.imul(z,oe),n=n+Math.imul(I,fe)|0,a=(a=a+Math.imul(I,de)|0)+Math.imul(L,fe)|0,i=i+Math.imul(L,de)|0,n=n+Math.imul(B,ue)|0,a=(a=a+Math.imul(B,be)|0)+Math.imul(R,ue)|0,i=i+Math.imul(R,be)|0;var je=(d+(n=n+Math.imul(T,le)|0)|0)+((8191&(a=(a=a+Math.imul(T,pe)|0)+Math.imul(P,le)|0))<<13)|0;d=((i=i+Math.imul(P,pe)|0)+(a>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,fe),a=(a=Math.imul(U,de))+Math.imul(z,fe)|0,i=Math.imul(z,de),n=n+Math.imul(I,ue)|0,a=(a=a+Math.imul(I,be)|0)+Math.imul(L,ue)|0,i=i+Math.imul(L,be)|0;var Be=(d+(n=n+Math.imul(B,le)|0)|0)+((8191&(a=(a=a+Math.imul(B,pe)|0)+Math.imul(R,le)|0))<<13)|0;d=((i=i+Math.imul(R,pe)|0)+(a>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,ue),a=(a=Math.imul(U,be))+Math.imul(z,ue)|0,i=Math.imul(z,be);var Re=(d+(n=n+Math.imul(I,le)|0)|0)+((8191&(a=(a=a+Math.imul(I,pe)|0)+Math.imul(L,le)|0))<<13)|0;d=((i=i+Math.imul(L,pe)|0)+(a>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(d+(n=Math.imul(U,le))|0)+((8191&(a=(a=Math.imul(U,pe))+Math.imul(z,le)|0))<<13)|0;return d=((i=Math.imul(z,pe))+(a>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f[0]=me,f[1]=xe,f[2]=ye,f[3]=ve,f[4]=ge,f[5]=we,f[6]=_e,f[7]=Me,f[8]=ke,f[9]=Se,f[10]=Ae,f[11]=Ee,f[12]=Oe,f[13]=Te,f[14]=Pe,f[15]=je,f[16]=Be,f[17]=Re,f[18]=Ce,0!==d&&(f[19]=d,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(l=h),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?l(this,e,t):r<63?h(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=c,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>a}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,n=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),c=67108863^67108863>>>i<o)for(this.length-=o,d=0;d=0&&(0!==s||d>=n);d--){var u=0|this.words[d];this.words[d]=s<<26-i|u>>>i,s=u&c}return f&&0!==s&&(f.words[f.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return a(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){a("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<=0);var t=e%26,r=(e-t)/26;if(a(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(a("number"==typeof e),a(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===c)return this.strip();for(a(-1===c),c=0,n=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,i=0|a.words[a.length-1];0!==(r=26-this._countBits(i))&&(a=a.ushln(r),n.iushln(r),i=0|a.words[a.length-1]);var c,f=n.length-a.length;if("mod"!==t){(c=new o(null)).length=f+1,c.words=new Array(c.length);for(var d=0;d=0;u--){var b=67108864*(0|n.words[a.length+u])+(0|n.words[a.length+u-1]);for(b=Math.min(b/i|0,67108863),n._ishlnsubmul(a,b,u);0!==n.negative;)b--,n.negative=0,n._ishlnsubmul(a,1,u),n.isZero()||(n.negative^=1);c&&(c.words[u]=b)}return c&&c.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:c||null,mod:n}},o.prototype.divmod=function(e,t,r){return a(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(c=this.neg().divmod(e,t),"mod"!==t&&(n=c.div.neg()),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:n,mod:i}):0===this.negative&&0!==e.negative?(c=this.divmod(e.neg(),t),"mod"!==t&&(n=c.div.neg()),{div:n,mod:c.mod}):0!=(this.negative&e.negative)?(c=this.neg().divmod(e.neg(),t),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:c.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,c},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),a=e.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){a(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},o.prototype.idivn=function(e){a(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),i=new o(0),c=new o(0),f=new o(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var s=r.clone(),u=t.clone();!t.isZero();){for(var b=0,h=1;0==(t.words[0]&h)&&b<26;++b,h<<=1);if(b>0)for(t.iushrn(b);b-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(s),i.isub(u)),n.iushrn(1),i.iushrn(1);for(var l=0,p=1;0==(r.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(u)),c.iushrn(1),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(c),i.isub(f)):(r.isub(t),c.isub(n),f.isub(i))}return{a:c,b:f,gcd:r.iushln(d)}},o.prototype._invmp=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,i=new o(1),c=new o(0),f=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,s=1;0==(t.words[0]&s)&&d<26;++d,s<<=1);if(d>0)for(t.iushrn(d);d-- >0;)i.isOdd()&&i.iadd(f),i.iushrn(1);for(var u=0,b=1;0==(r.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(r.iushrn(u);u-- >0;)c.isOdd()&&c.iadd(f),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(c)):(r.isub(t),c.isub(i))}return(n=0===t.cmpn(1)?i:c).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=t.cmp(r);if(a<0){var i=t;t=r,r=i}else if(0===a||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){a("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,c&=67108863,this.words[o]=c}return 0!==i&&(this.words[o]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),a(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|e.words[r];if(n!==a){na&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new M(e)},o.prototype.toRed=function(e){return a(!this.red,"Already a number in reduction context"),a(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return a(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return a(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var x={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else a(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}y.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):r.strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(v,y),v.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,a=i}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=a,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(x[e])return x[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new g;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return x[e]=t,t},M.prototype._verify1=function(e){a(0===e.negative,"red works only with positives"),a(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){a(0==(e.negative|t.negative),"red works only with positives"),a(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(a(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);a(!n.isZero());var c=new o(1).toRed(this),f=c.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);0!==this.pow(s,d).cmp(f);)s.redIAdd(f);for(var u=this.pow(s,n),b=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),l=i;0!==h.cmp(c);){for(var p=h,m=0;0!==p.cmp(c);m++)p=p.redSqr();a(m=0;n--){for(var d=t.words[n],s=f-1;s>=0;s--){var u=d>>s&1;a!==r[0]&&(a=this.sqr(a)),0!==u||0!==i?(i<<=1,i|=u,(4===++c||0===n&&0===s)&&(a=this.mul(a,r[i]),c=0,i=0)):c=0}f=26}return a},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},i(k,M),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(15)(e))},function(e,t,r){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,n){"use strict";function a(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var c;"object"===t(e)?e.exports=o:n.BN=o,o.BN=o,o.wordSize=26;try{c=r(0).Buffer}catch(e){}function f(e,t,r){for(var n=0,a=Math.min(e.length,r),i=t;i=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function d(e,t,r,n){for(var a=0,i=Math.min(e.length,r),o=t;o=49?c-49+10:c>=17?c-17+10:c}return a}o.isBN=function(e){return e instanceof o||null!==e&&"object"===t(e)&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,r,n){if("number"==typeof e)return this._initNumber(e,r,n);if("object"===t(e))return this._initArray(e,r,n);"hex"===r&&(r=16),a(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===r?this._parseHex(e,i):this._parseBase(e,r,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),r,n)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(a(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(a("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);else if("le"===r)for(n=0,i=0;n>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)a=f(e,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==t&&(a=f(e,t,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=t)n++;n--,a=a/t|0;for(var i=e.length-r,o=i%n,c=Math.min(i,i-o)+r,f=0,s=r;s1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var s=["","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"],u=[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],b=[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];function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var a=0|e.words[0],i=0|t.words[0],o=a*i,c=67108863&o,f=o/67108864|0;r.words[0]=c;for(var d=1;d>>26,u=67108863&f,b=Math.min(d,t.length-1),h=Math.max(0,d-e.length+1);h<=b;h++){var l=d-h|0;s+=(o=(a=0|e.words[l])*(i=0|t.words[h])+u)/67108864|0,u=67108863&o}r.words[d]=0|u,f=0|s}return 0!==f?r.words[d]=0|f:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?s[6-f.length]+f+r:f+r,(n+=2)>=26&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=u[e],h=b[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var p=l.modn(h).toString(e);r=(l=l.idivn(h)).isZero()?p+r:s[d-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}a(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return a(void 0!==c),this.toArrayLike(c,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),i=r||Math.max(1,n);a(n<=i,"byte array longer than desired length"),a(i>0,"Requested array length <= 0"),this.strip();var o,c,f="le"===t,d=new e(i),s=this.clone();if(f){for(c=0;!s.isZero();c++)o=s.andln(255),s.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){a("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){a("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,a=this.cmp(e);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,h=0|o[1],l=8191&h,p=h>>>13,m=0|o[2],x=8191&m,y=m>>>13,v=0|o[3],g=8191&v,w=v>>>13,_=0|o[4],M=8191&_,k=_>>>13,S=0|o[5],A=8191&S,E=S>>>13,O=0|o[6],T=8191&O,P=O>>>13,j=0|o[7],B=8191&j,R=j>>>13,C=0|o[8],I=8191&C,L=C>>>13,N=0|o[9],U=8191&N,z=N>>>13,F=0|c[0],D=8191&F,H=F>>>13,q=0|c[1],K=8191&q,G=q>>>13,W=0|c[2],V=8191&W,Z=W>>>13,J=0|c[3],X=8191&J,Y=J>>>13,$=0|c[4],Q=8191&$,ee=$>>>13,te=0|c[5],re=8191&te,ne=te>>>13,ae=0|c[6],ie=8191&ae,oe=ae>>>13,ce=0|c[7],fe=8191&ce,de=ce>>>13,se=0|c[8],ue=8191&se,be=se>>>13,he=0|c[9],le=8191&he,pe=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(d+(n=Math.imul(u,D))|0)+((8191&(a=(a=Math.imul(u,H))+Math.imul(b,D)|0))<<13)|0;d=((i=Math.imul(b,H))+(a>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(l,D),a=(a=Math.imul(l,H))+Math.imul(p,D)|0,i=Math.imul(p,H);var xe=(d+(n=n+Math.imul(u,K)|0)|0)+((8191&(a=(a=a+Math.imul(u,G)|0)+Math.imul(b,K)|0))<<13)|0;d=((i=i+Math.imul(b,G)|0)+(a>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(x,D),a=(a=Math.imul(x,H))+Math.imul(y,D)|0,i=Math.imul(y,H),n=n+Math.imul(l,K)|0,a=(a=a+Math.imul(l,G)|0)+Math.imul(p,K)|0,i=i+Math.imul(p,G)|0;var ye=(d+(n=n+Math.imul(u,V)|0)|0)+((8191&(a=(a=a+Math.imul(u,Z)|0)+Math.imul(b,V)|0))<<13)|0;d=((i=i+Math.imul(b,Z)|0)+(a>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(g,D),a=(a=Math.imul(g,H))+Math.imul(w,D)|0,i=Math.imul(w,H),n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,G)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(l,V)|0,a=(a=a+Math.imul(l,Z)|0)+Math.imul(p,V)|0,i=i+Math.imul(p,Z)|0;var ve=(d+(n=n+Math.imul(u,X)|0)|0)+((8191&(a=(a=a+Math.imul(u,Y)|0)+Math.imul(b,X)|0))<<13)|0;d=((i=i+Math.imul(b,Y)|0)+(a>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(M,D),a=(a=Math.imul(M,H))+Math.imul(k,D)|0,i=Math.imul(k,H),n=n+Math.imul(g,K)|0,a=(a=a+Math.imul(g,G)|0)+Math.imul(w,K)|0,i=i+Math.imul(w,G)|0,n=n+Math.imul(x,V)|0,a=(a=a+Math.imul(x,Z)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,Z)|0,n=n+Math.imul(l,X)|0,a=(a=a+Math.imul(l,Y)|0)+Math.imul(p,X)|0,i=i+Math.imul(p,Y)|0;var ge=(d+(n=n+Math.imul(u,Q)|0)|0)+((8191&(a=(a=a+Math.imul(u,ee)|0)+Math.imul(b,Q)|0))<<13)|0;d=((i=i+Math.imul(b,ee)|0)+(a>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,D),a=(a=Math.imul(A,H))+Math.imul(E,D)|0,i=Math.imul(E,H),n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,G)|0)+Math.imul(k,K)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(g,V)|0,a=(a=a+Math.imul(g,Z)|0)+Math.imul(w,V)|0,i=i+Math.imul(w,Z)|0,n=n+Math.imul(x,X)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(l,Q)|0,a=(a=a+Math.imul(l,ee)|0)+Math.imul(p,Q)|0,i=i+Math.imul(p,ee)|0;var we=(d+(n=n+Math.imul(u,re)|0)|0)+((8191&(a=(a=a+Math.imul(u,ne)|0)+Math.imul(b,re)|0))<<13)|0;d=((i=i+Math.imul(b,ne)|0)+(a>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,D),a=(a=Math.imul(T,H))+Math.imul(P,D)|0,i=Math.imul(P,H),n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,G)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,G)|0,n=n+Math.imul(M,V)|0,a=(a=a+Math.imul(M,Z)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,Z)|0,n=n+Math.imul(g,X)|0,a=(a=a+Math.imul(g,Y)|0)+Math.imul(w,X)|0,i=i+Math.imul(w,Y)|0,n=n+Math.imul(x,Q)|0,a=(a=a+Math.imul(x,ee)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(l,re)|0,a=(a=a+Math.imul(l,ne)|0)+Math.imul(p,re)|0,i=i+Math.imul(p,ne)|0;var _e=(d+(n=n+Math.imul(u,ie)|0)|0)+((8191&(a=(a=a+Math.imul(u,oe)|0)+Math.imul(b,ie)|0))<<13)|0;d=((i=i+Math.imul(b,oe)|0)+(a>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(B,D),a=(a=Math.imul(B,H))+Math.imul(R,D)|0,i=Math.imul(R,H),n=n+Math.imul(T,K)|0,a=(a=a+Math.imul(T,G)|0)+Math.imul(P,K)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(A,V)|0,a=(a=a+Math.imul(A,Z)|0)+Math.imul(E,V)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(M,X)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(k,X)|0,i=i+Math.imul(k,Y)|0,n=n+Math.imul(g,Q)|0,a=(a=a+Math.imul(g,ee)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,ee)|0,n=n+Math.imul(x,re)|0,a=(a=a+Math.imul(x,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(l,ie)|0,a=(a=a+Math.imul(l,oe)|0)+Math.imul(p,ie)|0,i=i+Math.imul(p,oe)|0;var Me=(d+(n=n+Math.imul(u,fe)|0)|0)+((8191&(a=(a=a+Math.imul(u,de)|0)+Math.imul(b,fe)|0))<<13)|0;d=((i=i+Math.imul(b,de)|0)+(a>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,D),a=(a=Math.imul(I,H))+Math.imul(L,D)|0,i=Math.imul(L,H),n=n+Math.imul(B,K)|0,a=(a=a+Math.imul(B,G)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(T,V)|0,a=(a=a+Math.imul(T,Z)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(A,X)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,a=(a=a+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(g,re)|0,a=(a=a+Math.imul(g,ne)|0)+Math.imul(w,re)|0,i=i+Math.imul(w,ne)|0,n=n+Math.imul(x,ie)|0,a=(a=a+Math.imul(x,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(l,fe)|0,a=(a=a+Math.imul(l,de)|0)+Math.imul(p,fe)|0,i=i+Math.imul(p,de)|0;var ke=(d+(n=n+Math.imul(u,ue)|0)|0)+((8191&(a=(a=a+Math.imul(u,be)|0)+Math.imul(b,ue)|0))<<13)|0;d=((i=i+Math.imul(b,be)|0)+(a>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,D),a=(a=Math.imul(U,H))+Math.imul(z,D)|0,i=Math.imul(z,H),n=n+Math.imul(I,K)|0,a=(a=a+Math.imul(I,G)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,G)|0,n=n+Math.imul(B,V)|0,a=(a=a+Math.imul(B,Z)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(T,X)|0,a=(a=a+Math.imul(T,Y)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(A,Q)|0,a=(a=a+Math.imul(A,ee)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(M,re)|0,a=(a=a+Math.imul(M,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(g,ie)|0,a=(a=a+Math.imul(g,oe)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,oe)|0,n=n+Math.imul(x,fe)|0,a=(a=a+Math.imul(x,de)|0)+Math.imul(y,fe)|0,i=i+Math.imul(y,de)|0,n=n+Math.imul(l,ue)|0,a=(a=a+Math.imul(l,be)|0)+Math.imul(p,ue)|0,i=i+Math.imul(p,be)|0;var Se=(d+(n=n+Math.imul(u,le)|0)|0)+((8191&(a=(a=a+Math.imul(u,pe)|0)+Math.imul(b,le)|0))<<13)|0;d=((i=i+Math.imul(b,pe)|0)+(a>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,K),a=(a=Math.imul(U,G))+Math.imul(z,K)|0,i=Math.imul(z,G),n=n+Math.imul(I,V)|0,a=(a=a+Math.imul(I,Z)|0)+Math.imul(L,V)|0,i=i+Math.imul(L,Z)|0,n=n+Math.imul(B,X)|0,a=(a=a+Math.imul(B,Y)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(T,Q)|0,a=(a=a+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(A,re)|0,a=(a=a+Math.imul(A,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(M,ie)|0,a=(a=a+Math.imul(M,oe)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,oe)|0,n=n+Math.imul(g,fe)|0,a=(a=a+Math.imul(g,de)|0)+Math.imul(w,fe)|0,i=i+Math.imul(w,de)|0,n=n+Math.imul(x,ue)|0,a=(a=a+Math.imul(x,be)|0)+Math.imul(y,ue)|0,i=i+Math.imul(y,be)|0;var Ae=(d+(n=n+Math.imul(l,le)|0)|0)+((8191&(a=(a=a+Math.imul(l,pe)|0)+Math.imul(p,le)|0))<<13)|0;d=((i=i+Math.imul(p,pe)|0)+(a>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,V),a=(a=Math.imul(U,Z))+Math.imul(z,V)|0,i=Math.imul(z,Z),n=n+Math.imul(I,X)|0,a=(a=a+Math.imul(I,Y)|0)+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(B,Q)|0,a=(a=a+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,a=(a=a+Math.imul(T,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(A,ie)|0,a=(a=a+Math.imul(A,oe)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,oe)|0,n=n+Math.imul(M,fe)|0,a=(a=a+Math.imul(M,de)|0)+Math.imul(k,fe)|0,i=i+Math.imul(k,de)|0,n=n+Math.imul(g,ue)|0,a=(a=a+Math.imul(g,be)|0)+Math.imul(w,ue)|0,i=i+Math.imul(w,be)|0;var Ee=(d+(n=n+Math.imul(x,le)|0)|0)+((8191&(a=(a=a+Math.imul(x,pe)|0)+Math.imul(y,le)|0))<<13)|0;d=((i=i+Math.imul(y,pe)|0)+(a>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,X),a=(a=Math.imul(U,Y))+Math.imul(z,X)|0,i=Math.imul(z,Y),n=n+Math.imul(I,Q)|0,a=(a=a+Math.imul(I,ee)|0)+Math.imul(L,Q)|0,i=i+Math.imul(L,ee)|0,n=n+Math.imul(B,re)|0,a=(a=a+Math.imul(B,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(T,ie)|0,a=(a=a+Math.imul(T,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(A,fe)|0,a=(a=a+Math.imul(A,de)|0)+Math.imul(E,fe)|0,i=i+Math.imul(E,de)|0,n=n+Math.imul(M,ue)|0,a=(a=a+Math.imul(M,be)|0)+Math.imul(k,ue)|0,i=i+Math.imul(k,be)|0;var Oe=(d+(n=n+Math.imul(g,le)|0)|0)+((8191&(a=(a=a+Math.imul(g,pe)|0)+Math.imul(w,le)|0))<<13)|0;d=((i=i+Math.imul(w,pe)|0)+(a>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,Q),a=(a=Math.imul(U,ee))+Math.imul(z,Q)|0,i=Math.imul(z,ee),n=n+Math.imul(I,re)|0,a=(a=a+Math.imul(I,ne)|0)+Math.imul(L,re)|0,i=i+Math.imul(L,ne)|0,n=n+Math.imul(B,ie)|0,a=(a=a+Math.imul(B,oe)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,oe)|0,n=n+Math.imul(T,fe)|0,a=(a=a+Math.imul(T,de)|0)+Math.imul(P,fe)|0,i=i+Math.imul(P,de)|0,n=n+Math.imul(A,ue)|0,a=(a=a+Math.imul(A,be)|0)+Math.imul(E,ue)|0,i=i+Math.imul(E,be)|0;var Te=(d+(n=n+Math.imul(M,le)|0)|0)+((8191&(a=(a=a+Math.imul(M,pe)|0)+Math.imul(k,le)|0))<<13)|0;d=((i=i+Math.imul(k,pe)|0)+(a>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),a=(a=Math.imul(U,ne))+Math.imul(z,re)|0,i=Math.imul(z,ne),n=n+Math.imul(I,ie)|0,a=(a=a+Math.imul(I,oe)|0)+Math.imul(L,ie)|0,i=i+Math.imul(L,oe)|0,n=n+Math.imul(B,fe)|0,a=(a=a+Math.imul(B,de)|0)+Math.imul(R,fe)|0,i=i+Math.imul(R,de)|0,n=n+Math.imul(T,ue)|0,a=(a=a+Math.imul(T,be)|0)+Math.imul(P,ue)|0,i=i+Math.imul(P,be)|0;var Pe=(d+(n=n+Math.imul(A,le)|0)|0)+((8191&(a=(a=a+Math.imul(A,pe)|0)+Math.imul(E,le)|0))<<13)|0;d=((i=i+Math.imul(E,pe)|0)+(a>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,ie),a=(a=Math.imul(U,oe))+Math.imul(z,ie)|0,i=Math.imul(z,oe),n=n+Math.imul(I,fe)|0,a=(a=a+Math.imul(I,de)|0)+Math.imul(L,fe)|0,i=i+Math.imul(L,de)|0,n=n+Math.imul(B,ue)|0,a=(a=a+Math.imul(B,be)|0)+Math.imul(R,ue)|0,i=i+Math.imul(R,be)|0;var je=(d+(n=n+Math.imul(T,le)|0)|0)+((8191&(a=(a=a+Math.imul(T,pe)|0)+Math.imul(P,le)|0))<<13)|0;d=((i=i+Math.imul(P,pe)|0)+(a>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,fe),a=(a=Math.imul(U,de))+Math.imul(z,fe)|0,i=Math.imul(z,de),n=n+Math.imul(I,ue)|0,a=(a=a+Math.imul(I,be)|0)+Math.imul(L,ue)|0,i=i+Math.imul(L,be)|0;var Be=(d+(n=n+Math.imul(B,le)|0)|0)+((8191&(a=(a=a+Math.imul(B,pe)|0)+Math.imul(R,le)|0))<<13)|0;d=((i=i+Math.imul(R,pe)|0)+(a>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,ue),a=(a=Math.imul(U,be))+Math.imul(z,ue)|0,i=Math.imul(z,be);var Re=(d+(n=n+Math.imul(I,le)|0)|0)+((8191&(a=(a=a+Math.imul(I,pe)|0)+Math.imul(L,le)|0))<<13)|0;d=((i=i+Math.imul(L,pe)|0)+(a>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(d+(n=Math.imul(U,le))|0)+((8191&(a=(a=Math.imul(U,pe))+Math.imul(z,le)|0))<<13)|0;return d=((i=Math.imul(z,pe))+(a>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f[0]=me,f[1]=xe,f[2]=ye,f[3]=ve,f[4]=ge,f[5]=we,f[6]=_e,f[7]=Me,f[8]=ke,f[9]=Se,f[10]=Ae,f[11]=Ee,f[12]=Oe,f[13]=Te,f[14]=Pe,f[15]=je,f[16]=Be,f[17]=Re,f[18]=Ce,0!==d&&(f[19]=d,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(l=h),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?l(this,e,t):r<63?h(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=c,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>a}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,n=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),c=67108863^67108863>>>i<o)for(this.length-=o,d=0;d=0&&(0!==s||d>=n);d--){var u=0|this.words[d];this.words[d]=s<<26-i|u>>>i,s=u&c}return f&&0!==s&&(f.words[f.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return a(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){a("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<=0);var t=e%26,r=(e-t)/26;if(a(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(a("number"==typeof e),a(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===c)return this.strip();for(a(-1===c),c=0,n=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,i=0|a.words[a.length-1];0!==(r=26-this._countBits(i))&&(a=a.ushln(r),n.iushln(r),i=0|a.words[a.length-1]);var c,f=n.length-a.length;if("mod"!==t){(c=new o(null)).length=f+1,c.words=new Array(c.length);for(var d=0;d=0;u--){var b=67108864*(0|n.words[a.length+u])+(0|n.words[a.length+u-1]);for(b=Math.min(b/i|0,67108863),n._ishlnsubmul(a,b,u);0!==n.negative;)b--,n.negative=0,n._ishlnsubmul(a,1,u),n.isZero()||(n.negative^=1);c&&(c.words[u]=b)}return c&&c.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:c||null,mod:n}},o.prototype.divmod=function(e,t,r){return a(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(c=this.neg().divmod(e,t),"mod"!==t&&(n=c.div.neg()),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:n,mod:i}):0===this.negative&&0!==e.negative?(c=this.divmod(e.neg(),t),"mod"!==t&&(n=c.div.neg()),{div:n,mod:c.mod}):0!=(this.negative&e.negative)?(c=this.neg().divmod(e.neg(),t),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:c.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,c},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),a=e.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){a(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},o.prototype.idivn=function(e){a(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),i=new o(0),c=new o(0),f=new o(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var s=r.clone(),u=t.clone();!t.isZero();){for(var b=0,h=1;0==(t.words[0]&h)&&b<26;++b,h<<=1);if(b>0)for(t.iushrn(b);b-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(s),i.isub(u)),n.iushrn(1),i.iushrn(1);for(var l=0,p=1;0==(r.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(u)),c.iushrn(1),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(c),i.isub(f)):(r.isub(t),c.isub(n),f.isub(i))}return{a:c,b:f,gcd:r.iushln(d)}},o.prototype._invmp=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,i=new o(1),c=new o(0),f=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,s=1;0==(t.words[0]&s)&&d<26;++d,s<<=1);if(d>0)for(t.iushrn(d);d-- >0;)i.isOdd()&&i.iadd(f),i.iushrn(1);for(var u=0,b=1;0==(r.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(r.iushrn(u);u-- >0;)c.isOdd()&&c.iadd(f),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(c)):(r.isub(t),c.isub(i))}return(n=0===t.cmpn(1)?i:c).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=t.cmp(r);if(a<0){var i=t;t=r,r=i}else if(0===a||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){a("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,c&=67108863,this.words[o]=c}return 0!==i&&(this.words[o]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),a(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|e.words[r];if(n!==a){na&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new M(e)},o.prototype.toRed=function(e){return a(!this.red,"Already a number in reduction context"),a(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return a(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return a(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var x={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else a(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){M.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}y.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):r.strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(v,y),v.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,a=i}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=a,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(x[e])return x[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new g;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return x[e]=t,t},M.prototype._verify1=function(e){a(0===e.negative,"red works only with positives"),a(e.red,"red works only with red numbers")},M.prototype._verify2=function(e,t){a(0==(e.negative|t.negative),"red works only with positives"),a(e.red&&e.red===t.red,"red works only with red numbers")},M.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},M.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},M.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},M.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},M.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},M.prototype.isqr=function(e){return this.imul(e,e.clone())},M.prototype.sqr=function(e){return this.mul(e,e)},M.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(a(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);a(!n.isZero());var c=new o(1).toRed(this),f=c.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);0!==this.pow(s,d).cmp(f);)s.redIAdd(f);for(var u=this.pow(s,n),b=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),l=i;0!==h.cmp(c);){for(var p=h,m=0;0!==p.cmp(c);m++)p=p.redSqr();a(m=0;n--){for(var d=t.words[n],s=f-1;s>=0;s--){var u=d>>s&1;a!==r[0]&&(a=this.sqr(a)),0!==u||0!==i?(i<<=1,i|=u,(4===++c||0===n&&0===s)&&(a=this.mul(a,r[i]),c=0,i=0)):c=0}f=26}return a},M.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},M.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},i(k,M),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(15)(e))},function(e,t){},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.isHexString=t.getKeys=t.fromAscii=t.fromUtf8=t.toAscii=t.arrayContainsArray=t.getBinarySize=t.padToEven=t.stripHexPrefix=t.isHexPrefixed=void 0,a(r(229),t),a(r(230),t),a(r(470),t),a(r(142),t),a(r(471),t),a(r(51),t),a(r(472),t),a(r(39),t),a(r(143),t);var i=r(68);Object.defineProperty(t,"isHexPrefixed",{enumerable:!0,get:function(){return i.isHexPrefixed}}),Object.defineProperty(t,"stripHexPrefix",{enumerable:!0,get:function(){return i.stripHexPrefix}}),Object.defineProperty(t,"padToEven",{enumerable:!0,get:function(){return i.padToEven}}),Object.defineProperty(t,"getBinarySize",{enumerable:!0,get:function(){return i.getBinarySize}}),Object.defineProperty(t,"arrayContainsArray",{enumerable:!0,get:function(){return i.arrayContainsArray}}),Object.defineProperty(t,"toAscii",{enumerable:!0,get:function(){return i.toAscii}}),Object.defineProperty(t,"fromUtf8",{enumerable:!0,get:function(){return i.fromUtf8}}),Object.defineProperty(t,"fromAscii",{enumerable:!0,get:function(){return i.fromAscii}}),Object.defineProperty(t,"getKeys",{enumerable:!0,get:function(){return i.getKeys}}),Object.defineProperty(t,"isHexString",{enumerable:!0,get:function(){return i.isHexString}})},function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var a=n(r(14)),i=r(39),o=r(51),c=r(230),f=function(){function t(e){(0,a.default)(20===e.length,"Invalid address length"),this.buf=e}return t.zero=function(){return new t((0,o.zeros)(20))},t.fromString=function(e){return(0,a.default)((0,c.isValidAddress)(e),"Invalid address"),new t((0,o.toBuffer)(e))},t.fromPublicKey=function(r){return(0,a.default)(e.isBuffer(r),"Public key should be Buffer"),new t((0,c.pubToAddress)(r))},t.fromPrivateKey=function(r){return(0,a.default)(e.isBuffer(r),"Private key should be Buffer"),new t((0,c.privateToAddress)(r))},t.generate=function(r,n){return(0,a.default)(i.BN.isBN(n)),new t((0,c.generateAddress)(r.buf,n.toArrayLike(e)))},t.generate2=function(r,n,i){return(0,a.default)(e.isBuffer(n)),(0,a.default)(e.isBuffer(i)),new t((0,c.generateAddress2)(r.buf,n,i))},t.prototype.equals=function(e){return this.buf.equals(e.buf)},t.prototype.isZero=function(){return this.equals(t.zero())},t.prototype.isPrecompileOrSystemAddress=function(){var e=new i.BN(this.buf),t=new i.BN(0),r=new i.BN("ffff","hex");return e.gte(t)&&e.lte(r)},t.prototype.toString=function(){return"0x"+this.buf.toString("hex")},t.prototype.toBuffer=function(){return e.from(this.buf)},t}();t.Address=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var n=r(22),a=r(39),i=r(51),o=r(142),c=r(105),f=r(143);function d(e,t){var r=(0,f.toType)(e,f.TypeOutput.BN);if(r.eqn(0)||r.eqn(1))return(0,f.toType)(e,f.TypeOutput.BN);if(!t)return r.subn(27);var n=(0,f.toType)(t,f.TypeOutput.BN);return r.sub(n.muln(2).addn(35))}function s(e){var t=new a.BN(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function(t,r,a){var i,o,c;if(console.log("ehereumjs-util.signature.ecsign: "+t.toString("hex")),window.jsb&&window.jsb.walletSignTran){var d=t.toString("hex"),s=jsb.walletSignTran(d);if(s.indexOf("|")>=0){var u=s.split("|");s=u[0],c=parseInt(u[1])}var b=Uint8Array.from(e.from(s,"hex"));i=e.from(b.slice(0,32)),o=e.from(b.slice(32,64))}else{var h=(0,n.ecdsaSign)(t,r),l=h.signature;c=h.recid,i=e.from(l.slice(0,32)),o=e.from(l.slice(32,64))}if(!a||"number"==typeof a){if(a&&!Number.isSafeInteger(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:i,s:o,v:a?c+(2*a+35):c+27}}return{r:i,s:o,v:(0,f.toType)(a,f.TypeOutput.BN).muln(2).addn(35).addn(c).toArrayLike(e)}};t.ecrecover=function(t,r,a,o,c){var f=e.concat([(0,i.setLengthLeft)(a,32),(0,i.setLengthLeft)(o,32)],64),u=d(r,c);if(!s(u))throw new Error("Invalid signature v value");var b=(0,n.ecdsaRecover)(f,u.toNumber(),t);return e.from((0,n.publicKeyConvert)(b,!1).slice(1))};t.toRpcSig=function(t,r,n,a){if(!s(d(t,a)))throw new Error("Invalid signature v value");return(0,i.bufferToHex)(e.concat([(0,i.setLengthLeft)(r,32),(0,i.setLengthLeft)(n,32),(0,i.toBuffer)(t)]))};t.toCompactSig=function(t,r,n,a){if(!s(d(t,a)))throw new Error("Invalid signature v value");var o=(0,f.toType)(t,f.TypeOutput.Number),c=n;return(o>28&&o%2==1||1===o||28===o)&&((c=e.from(n))[0]|=128),(0,i.bufferToHex)(e.concat([(0,i.setLengthLeft)(r,32),(0,i.setLengthLeft)(c,32)]))};t.fromRpcSig=function(e){var t,r,n,a=(0,i.toBuffer)(e);if(a.length>=65)t=a.slice(0,32),r=a.slice(32,64),n=(0,i.bufferToInt)(a.slice(64));else{if(64!==a.length)throw new Error("Invalid signature length");t=a.slice(0,32),r=a.slice(32,64),n=(0,i.bufferToInt)(a.slice(32,33))>>7,r[0]&=127}return n<27&&(n+=27),{v:n,r:t,s:r}};t.isValidSignature=function(e,t,r,n,i){void 0===n&&(n=!0);var o=new a.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new a.BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!s(d(e,i)))return!1;var f=new a.BN(t),u=new a.BN(r);return!(f.isZero()||f.gt(c)||u.isZero()||u.gt(c))&&(!n||1!==u.cmp(o))};t.hashPersonalMessage=function(t){(0,c.assertIsBuffer)(t);var r=e.from("Ethereum Signed Message:\n".concat(t.length),"utf-8");return(0,o.keccak)(e.concat([r,t]))}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(e){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var i=a(r(14)),o=r(68),c=r(39),f=r(51);t.defineProperties=function(t,r,a){if(t.raw=[],t._fields=[],t.toJSON=function(e){if(void 0===e&&(e=!1),e){var r={};return t._fields.forEach((function(e){r[e]="0x".concat(t[e].toString("hex"))})),r}return(0,f.baToJSON)(t.raw)},t.serialize=function(){return c.rlp.encode(t.raw)},r.forEach((function(r,n){function a(){return t.raw[n]}function o(a){"00"!==(a=(0,f.toBuffer)(a)).toString("hex")||r.allowZero||(a=e.allocUnsafe(0)),r.allowLess&&r.length?(a=(0,f.unpadBuffer)(a),(0,i.default)(r.length>=a.length,"The field ".concat(r.name," must not have more ").concat(r.length," bytes"))):r.allowZero&&0===a.length||!r.length||(0,i.default)(r.length===a.length,"The field ".concat(r.name," must have byte length of ").concat(r.length)),t.raw[n]=a}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:a,set:o}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:o,get:a})})),a)if("string"==typeof a&&(a=e.from((0,o.stripHexPrefix)(a),"hex")),e.isBuffer(a)&&(a=c.rlp.decode(a)),Array.isArray(a)){if(a.length>t._fields.length)throw new Error("wrong number of fields in data");a.forEach((function(e,r){t[t._fields[r]]=(0,f.toBuffer)(e)}))}else{if("object"!==n(a))throw new Error("invalid data");var d=Object.keys(a);r.forEach((function(e){-1!==d.indexOf(e.name)&&(t[e.name]=a[e.name]),-1!==d.indexOf(e.alias)&&(t[e.alias]=a[e.alias])}))}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(474);function i(e){return"string"==typeof e&&(!!/^(0x)?[0-9a-f]{512}$/i.test(e)&&!(!/^(0x)?[0-9a-f]{512}$/.test(e)&&!/^(0x)?[0-9A-F]{512}$/.test(e)))}function o(e,t){"object"===n(t)&&t.constructor===Uint8Array&&(t=a.bytesToHex(t));for(var r=a.keccak256(t).replace("0x",""),i=0;i<12;i+=4){var o=(parseInt(r.substr(i,2),16)<<8)+parseInt(r.substr(i+2,2),16)&2047,f=1<=48&&e<=57)return e-48;if(e>=65&&e<=70)return e-55;if(e>=97&&e<=102)return e-87;throw new Error("invalid bloom")}function f(e){return"string"==typeof e&&(!!/^(0x)?[0-9a-f]{64}$/i.test(e)&&!(!/^(0x)?[0-9a-f]{64}$/.test(e)&&!/^(0x)?[0-9A-F]{64}$/.test(e)))}function d(e){return"string"==typeof e&&(!!e.match(/^(0x)?[0-9a-fA-F]{40}$/)||!!e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/))}t.isBloom=i,t.isInBloom=o,t.isUserEthereumAddressInBloom=function(e,t){if(!i(e))throw new Error("Invalid bloom given");if(!d(t))throw new Error('Invalid ethereum address given: "'.concat(t,'"'));return o(e,a.padLeft(t,64))},t.isContractAddressInBloom=function(e,t){if(!i(e))throw new Error("Invalid bloom given");if(!d(t))throw new Error('Invalid contract address given: "'.concat(t,'"'));return o(e,t)},t.isTopicInBloom=function(e,t){if(!i(e))throw new Error("Invalid bloom given");if(!f(t))throw new Error("Invalid topic");return o(e,t)},t.isTopic=f,t.isAddress=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(97);function a(e){if(null==e)throw new Error("cannot convert null value to array");if("string"==typeof e){var t=e.match(/^(0x)?[0-9a-fA-F]*$/);if(!t)throw new Error("invalid hexidecimal string");if("0x"!==t[1])throw new Error("hex string must have 0x prefix");(e=e.substring(2)).length%2&&(e="0"+e);for(var r=[],n=0;n=256||parseInt(String(r))!=r)return!1}return!0}(e))return i(new Uint8Array(e));throw new Error("invalid arrayify value")}function i(e){var t=arguments;return void 0!==e.slice||(e.slice=function(){var r=Array.prototype.slice.call(t);return i(new Uint8Array(Array.prototype.slice.apply(e,r)))}),e}t.keccak256=function(e){return"0x"+n.keccak_256(a(e))},t.padLeft=function(e,t){var r=/^0x/i.test(e)||"number"==typeof e,n=t-(e=e.toString().replace(/^0x/i,"")).length+1>=0?t-e.length+1:0;return(r?"0x":"")+new Array(n).join("0")+e},t.bytesToHex=function(e){for(var t=[],r=0;r>>4).toString(16)),t.push((15&e[r]).toString(16));return"0x".concat(t.join("").replace(/^0+/,""))},t.toByteArray=a},function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=r(104),i=r(227),o=function(e){var t=n(e);if("string"===t)return i.isHexStrict(e)?new a(e.replace(/0x/i,""),16):new a(e,10);if("number"===t)return new a(e);if(i.isBigNumber(e))return new a(e.toString(10));if(i.isBN(e))return e;throw new Error(e+" is not a number")},c=function(e,t,r){var n,c;if("bytes"===(e=function(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}(e))){if(t.replace(/^0x/i,"").length%2!=0)throw new Error("Invalid bytes characters "+t.length);return t}if("string"===e)return i.utf8ToHex(t);if("bool"===e)return t?"01":"00";if(e.startsWith("address")){if(n=r?64:40,!i.isAddress(t))throw new Error(t+" is not a valid address, or the checksum is invalid.");return i.leftPad(t.toLowerCase(),n)}if(n=function(e){var t=/^\D+(\d+).*$/.exec(e);return t?parseInt(t[1],10):null}(e),e.startsWith("bytes")){if(!n)throw new Error("bytes[] not yet supported in solidity");if(r&&(n=32),n<1||n>32||n256)throw new Error("Invalid uint"+n+" size");if((c=o(t)).bitLength()>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+c.bitLength());if(c.lt(new a(0)))throw new Error("Supplied uint "+c.toString()+" is negative");return n?i.leftPad(c.toString("hex"),n/8*2):c}if(e.startsWith("int")){if(n%8||n<8||n>256)throw new Error("Invalid int"+n+" size");if((c=o(t)).bitLength()>n)throw new Error("Supplied int exceeds width: "+n+" vs "+c.bitLength());return c.lt(new a(0))?c.toTwos(n).toString("hex"):n?i.leftPad(c.toString("hex"),n/8*2):c}throw new Error("Unsupported or invalid type: "+e)},f=function(e){if(Array.isArray(e))throw new Error("Autodetection of array types is not supported.");var t,r,o="";if(e&&"object"===n(e)&&(e.hasOwnProperty("v")||e.hasOwnProperty("t")||e.hasOwnProperty("value")||e.hasOwnProperty("type"))?(t=e.hasOwnProperty("t")?e.t:e.type,o=e.hasOwnProperty("v")?e.v:e.value):(t=i.toHex(e,!0),o=i.toHex(e),t.startsWith("int")||t.startsWith("uint")||(t="bytes")),!t.startsWith("int")&&!t.startsWith("uint")||"string"!=typeof o||/^(-)?0x/i.test(o)||(o=new a(o)),Array.isArray(o)){if((r=function(e){var t=/^\D+\d*\[(\d+)\]$/.exec(e);return t?parseInt(t[1],10):null}(t))&&o.length!==r)throw new Error(t+" is not matching the given array "+JSON.stringify(o));r=o.length}return Array.isArray(o)?o.map((function(e){return c(t,e,r).toString("hex").replace("0x","")})).join(""):c(t,o,r).toString("hex").replace("0x","")};e.exports={soliditySha3:function(){var e=Array.prototype.slice.call(arguments),t=e.map(f);return i.sha3("0x"+t.join(""))},soliditySha3Raw:function(){return i.sha3Raw("0x"+Array.prototype.slice.call(arguments).map(f).join(""))},encodePacked:function(){var e=Array.prototype.slice.call(arguments),t=e.map(f);return"0x"+t.join("").toLowerCase()}}},function(e,t,r){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,n){"use strict";function a(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var c;"object"===t(e)?e.exports=o:n.BN=o,o.BN=o,o.wordSize=26;try{c="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(477).Buffer}catch(e){}function f(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void a(!1,"Invalid character in "+e)}function d(e,t,r){var n=f(e,r);return r-1>=t&&(n|=f(e,r-1)<<4),n}function s(e,t,r,n){for(var i=0,o=0,c=Math.min(e.length,r),f=t;f=49?d-49+10:d>=17?d-17+10:d,a(d>=0&&o0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,r,n){if("number"==typeof e)return this._initNumber(e,r,n);if("object"===t(e))return this._initArray(e,r,n);"hex"===r&&(r=16),a(r===(0|r)&&r>=2&&r<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);else if("le"===r)for(n=0,i=0;n>>26-c&67108863,(c+=24)>=26&&(c-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)a=d(e,t,n)<=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=t)n++;n--,a=a/t|0;for(var i=e.length-r,o=i%n,c=Math.min(i,i-o)+r,f=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=b}catch(e){o.prototype.inspect=b}else o.prototype.inspect=b;function b(){return(this.red?""}var h=["","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"],l=[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],p=[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];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==i||o!==this.length-1?h[6-f.length]+f+r:f+r}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],s=p[e];r="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(s).toString(e);r=(u=u.idivn(s)).isZero()?b+r:h[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}a(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},c&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var a=0|e.words[0],i=0|t.words[0],o=a*i,c=67108863&o,f=o/67108864|0;r.words[0]=c;for(var d=1;d>>26,u=67108863&f,b=Math.min(d,t.length-1),h=Math.max(0,d-e.length+1);h<=b;h++){var l=d-h|0;s+=(o=(a=0|e.words[l])*(i=0|t.words[h])+u)/67108864|0,u=67108863&o}r.words[d]=0|u,f=0|s}return 0!==f?r.words[d]=0|f:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),i=r||Math.max(1,n);a(n<=i,"byte array longer than desired length"),a(i>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,a=0,i=0;a>8&255),r>16&255),6===i?(r>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===i?(r>=0&&(e[r--]=o>>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){a("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){a("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,a=this.cmp(e);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,h=0|o[1],l=8191&h,p=h>>>13,m=0|o[2],x=8191&m,y=m>>>13,v=0|o[3],g=8191&v,w=v>>>13,_=0|o[4],M=8191&_,k=_>>>13,S=0|o[5],A=8191&S,E=S>>>13,O=0|o[6],T=8191&O,P=O>>>13,j=0|o[7],B=8191&j,R=j>>>13,C=0|o[8],I=8191&C,L=C>>>13,N=0|o[9],U=8191&N,z=N>>>13,F=0|c[0],D=8191&F,H=F>>>13,q=0|c[1],K=8191&q,G=q>>>13,W=0|c[2],V=8191&W,Z=W>>>13,J=0|c[3],X=8191&J,Y=J>>>13,$=0|c[4],Q=8191&$,ee=$>>>13,te=0|c[5],re=8191&te,ne=te>>>13,ae=0|c[6],ie=8191&ae,oe=ae>>>13,ce=0|c[7],fe=8191&ce,de=ce>>>13,se=0|c[8],ue=8191&se,be=se>>>13,he=0|c[9],le=8191&he,pe=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(d+(n=Math.imul(u,D))|0)+((8191&(a=(a=Math.imul(u,H))+Math.imul(b,D)|0))<<13)|0;d=((i=Math.imul(b,H))+(a>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(l,D),a=(a=Math.imul(l,H))+Math.imul(p,D)|0,i=Math.imul(p,H);var xe=(d+(n=n+Math.imul(u,K)|0)|0)+((8191&(a=(a=a+Math.imul(u,G)|0)+Math.imul(b,K)|0))<<13)|0;d=((i=i+Math.imul(b,G)|0)+(a>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(x,D),a=(a=Math.imul(x,H))+Math.imul(y,D)|0,i=Math.imul(y,H),n=n+Math.imul(l,K)|0,a=(a=a+Math.imul(l,G)|0)+Math.imul(p,K)|0,i=i+Math.imul(p,G)|0;var ye=(d+(n=n+Math.imul(u,V)|0)|0)+((8191&(a=(a=a+Math.imul(u,Z)|0)+Math.imul(b,V)|0))<<13)|0;d=((i=i+Math.imul(b,Z)|0)+(a>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(g,D),a=(a=Math.imul(g,H))+Math.imul(w,D)|0,i=Math.imul(w,H),n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,G)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(l,V)|0,a=(a=a+Math.imul(l,Z)|0)+Math.imul(p,V)|0,i=i+Math.imul(p,Z)|0;var ve=(d+(n=n+Math.imul(u,X)|0)|0)+((8191&(a=(a=a+Math.imul(u,Y)|0)+Math.imul(b,X)|0))<<13)|0;d=((i=i+Math.imul(b,Y)|0)+(a>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(M,D),a=(a=Math.imul(M,H))+Math.imul(k,D)|0,i=Math.imul(k,H),n=n+Math.imul(g,K)|0,a=(a=a+Math.imul(g,G)|0)+Math.imul(w,K)|0,i=i+Math.imul(w,G)|0,n=n+Math.imul(x,V)|0,a=(a=a+Math.imul(x,Z)|0)+Math.imul(y,V)|0,i=i+Math.imul(y,Z)|0,n=n+Math.imul(l,X)|0,a=(a=a+Math.imul(l,Y)|0)+Math.imul(p,X)|0,i=i+Math.imul(p,Y)|0;var ge=(d+(n=n+Math.imul(u,Q)|0)|0)+((8191&(a=(a=a+Math.imul(u,ee)|0)+Math.imul(b,Q)|0))<<13)|0;d=((i=i+Math.imul(b,ee)|0)+(a>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,D),a=(a=Math.imul(A,H))+Math.imul(E,D)|0,i=Math.imul(E,H),n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,G)|0)+Math.imul(k,K)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(g,V)|0,a=(a=a+Math.imul(g,Z)|0)+Math.imul(w,V)|0,i=i+Math.imul(w,Z)|0,n=n+Math.imul(x,X)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(l,Q)|0,a=(a=a+Math.imul(l,ee)|0)+Math.imul(p,Q)|0,i=i+Math.imul(p,ee)|0;var we=(d+(n=n+Math.imul(u,re)|0)|0)+((8191&(a=(a=a+Math.imul(u,ne)|0)+Math.imul(b,re)|0))<<13)|0;d=((i=i+Math.imul(b,ne)|0)+(a>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(T,D),a=(a=Math.imul(T,H))+Math.imul(P,D)|0,i=Math.imul(P,H),n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,G)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,G)|0,n=n+Math.imul(M,V)|0,a=(a=a+Math.imul(M,Z)|0)+Math.imul(k,V)|0,i=i+Math.imul(k,Z)|0,n=n+Math.imul(g,X)|0,a=(a=a+Math.imul(g,Y)|0)+Math.imul(w,X)|0,i=i+Math.imul(w,Y)|0,n=n+Math.imul(x,Q)|0,a=(a=a+Math.imul(x,ee)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(l,re)|0,a=(a=a+Math.imul(l,ne)|0)+Math.imul(p,re)|0,i=i+Math.imul(p,ne)|0;var _e=(d+(n=n+Math.imul(u,ie)|0)|0)+((8191&(a=(a=a+Math.imul(u,oe)|0)+Math.imul(b,ie)|0))<<13)|0;d=((i=i+Math.imul(b,oe)|0)+(a>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(B,D),a=(a=Math.imul(B,H))+Math.imul(R,D)|0,i=Math.imul(R,H),n=n+Math.imul(T,K)|0,a=(a=a+Math.imul(T,G)|0)+Math.imul(P,K)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(A,V)|0,a=(a=a+Math.imul(A,Z)|0)+Math.imul(E,V)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(M,X)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(k,X)|0,i=i+Math.imul(k,Y)|0,n=n+Math.imul(g,Q)|0,a=(a=a+Math.imul(g,ee)|0)+Math.imul(w,Q)|0,i=i+Math.imul(w,ee)|0,n=n+Math.imul(x,re)|0,a=(a=a+Math.imul(x,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(l,ie)|0,a=(a=a+Math.imul(l,oe)|0)+Math.imul(p,ie)|0,i=i+Math.imul(p,oe)|0;var Me=(d+(n=n+Math.imul(u,fe)|0)|0)+((8191&(a=(a=a+Math.imul(u,de)|0)+Math.imul(b,fe)|0))<<13)|0;d=((i=i+Math.imul(b,de)|0)+(a>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,D),a=(a=Math.imul(I,H))+Math.imul(L,D)|0,i=Math.imul(L,H),n=n+Math.imul(B,K)|0,a=(a=a+Math.imul(B,G)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(T,V)|0,a=(a=a+Math.imul(T,Z)|0)+Math.imul(P,V)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(A,X)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,a=(a=a+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(g,re)|0,a=(a=a+Math.imul(g,ne)|0)+Math.imul(w,re)|0,i=i+Math.imul(w,ne)|0,n=n+Math.imul(x,ie)|0,a=(a=a+Math.imul(x,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(l,fe)|0,a=(a=a+Math.imul(l,de)|0)+Math.imul(p,fe)|0,i=i+Math.imul(p,de)|0;var ke=(d+(n=n+Math.imul(u,ue)|0)|0)+((8191&(a=(a=a+Math.imul(u,be)|0)+Math.imul(b,ue)|0))<<13)|0;d=((i=i+Math.imul(b,be)|0)+(a>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,D),a=(a=Math.imul(U,H))+Math.imul(z,D)|0,i=Math.imul(z,H),n=n+Math.imul(I,K)|0,a=(a=a+Math.imul(I,G)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,G)|0,n=n+Math.imul(B,V)|0,a=(a=a+Math.imul(B,Z)|0)+Math.imul(R,V)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(T,X)|0,a=(a=a+Math.imul(T,Y)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(A,Q)|0,a=(a=a+Math.imul(A,ee)|0)+Math.imul(E,Q)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(M,re)|0,a=(a=a+Math.imul(M,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(g,ie)|0,a=(a=a+Math.imul(g,oe)|0)+Math.imul(w,ie)|0,i=i+Math.imul(w,oe)|0,n=n+Math.imul(x,fe)|0,a=(a=a+Math.imul(x,de)|0)+Math.imul(y,fe)|0,i=i+Math.imul(y,de)|0,n=n+Math.imul(l,ue)|0,a=(a=a+Math.imul(l,be)|0)+Math.imul(p,ue)|0,i=i+Math.imul(p,be)|0;var Se=(d+(n=n+Math.imul(u,le)|0)|0)+((8191&(a=(a=a+Math.imul(u,pe)|0)+Math.imul(b,le)|0))<<13)|0;d=((i=i+Math.imul(b,pe)|0)+(a>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,K),a=(a=Math.imul(U,G))+Math.imul(z,K)|0,i=Math.imul(z,G),n=n+Math.imul(I,V)|0,a=(a=a+Math.imul(I,Z)|0)+Math.imul(L,V)|0,i=i+Math.imul(L,Z)|0,n=n+Math.imul(B,X)|0,a=(a=a+Math.imul(B,Y)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(T,Q)|0,a=(a=a+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(A,re)|0,a=(a=a+Math.imul(A,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(M,ie)|0,a=(a=a+Math.imul(M,oe)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,oe)|0,n=n+Math.imul(g,fe)|0,a=(a=a+Math.imul(g,de)|0)+Math.imul(w,fe)|0,i=i+Math.imul(w,de)|0,n=n+Math.imul(x,ue)|0,a=(a=a+Math.imul(x,be)|0)+Math.imul(y,ue)|0,i=i+Math.imul(y,be)|0;var Ae=(d+(n=n+Math.imul(l,le)|0)|0)+((8191&(a=(a=a+Math.imul(l,pe)|0)+Math.imul(p,le)|0))<<13)|0;d=((i=i+Math.imul(p,pe)|0)+(a>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,V),a=(a=Math.imul(U,Z))+Math.imul(z,V)|0,i=Math.imul(z,Z),n=n+Math.imul(I,X)|0,a=(a=a+Math.imul(I,Y)|0)+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(B,Q)|0,a=(a=a+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(T,re)|0,a=(a=a+Math.imul(T,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(A,ie)|0,a=(a=a+Math.imul(A,oe)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,oe)|0,n=n+Math.imul(M,fe)|0,a=(a=a+Math.imul(M,de)|0)+Math.imul(k,fe)|0,i=i+Math.imul(k,de)|0,n=n+Math.imul(g,ue)|0,a=(a=a+Math.imul(g,be)|0)+Math.imul(w,ue)|0,i=i+Math.imul(w,be)|0;var Ee=(d+(n=n+Math.imul(x,le)|0)|0)+((8191&(a=(a=a+Math.imul(x,pe)|0)+Math.imul(y,le)|0))<<13)|0;d=((i=i+Math.imul(y,pe)|0)+(a>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(U,X),a=(a=Math.imul(U,Y))+Math.imul(z,X)|0,i=Math.imul(z,Y),n=n+Math.imul(I,Q)|0,a=(a=a+Math.imul(I,ee)|0)+Math.imul(L,Q)|0,i=i+Math.imul(L,ee)|0,n=n+Math.imul(B,re)|0,a=(a=a+Math.imul(B,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(T,ie)|0,a=(a=a+Math.imul(T,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(A,fe)|0,a=(a=a+Math.imul(A,de)|0)+Math.imul(E,fe)|0,i=i+Math.imul(E,de)|0,n=n+Math.imul(M,ue)|0,a=(a=a+Math.imul(M,be)|0)+Math.imul(k,ue)|0,i=i+Math.imul(k,be)|0;var Oe=(d+(n=n+Math.imul(g,le)|0)|0)+((8191&(a=(a=a+Math.imul(g,pe)|0)+Math.imul(w,le)|0))<<13)|0;d=((i=i+Math.imul(w,pe)|0)+(a>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,Q),a=(a=Math.imul(U,ee))+Math.imul(z,Q)|0,i=Math.imul(z,ee),n=n+Math.imul(I,re)|0,a=(a=a+Math.imul(I,ne)|0)+Math.imul(L,re)|0,i=i+Math.imul(L,ne)|0,n=n+Math.imul(B,ie)|0,a=(a=a+Math.imul(B,oe)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,oe)|0,n=n+Math.imul(T,fe)|0,a=(a=a+Math.imul(T,de)|0)+Math.imul(P,fe)|0,i=i+Math.imul(P,de)|0,n=n+Math.imul(A,ue)|0,a=(a=a+Math.imul(A,be)|0)+Math.imul(E,ue)|0,i=i+Math.imul(E,be)|0;var Te=(d+(n=n+Math.imul(M,le)|0)|0)+((8191&(a=(a=a+Math.imul(M,pe)|0)+Math.imul(k,le)|0))<<13)|0;d=((i=i+Math.imul(k,pe)|0)+(a>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),a=(a=Math.imul(U,ne))+Math.imul(z,re)|0,i=Math.imul(z,ne),n=n+Math.imul(I,ie)|0,a=(a=a+Math.imul(I,oe)|0)+Math.imul(L,ie)|0,i=i+Math.imul(L,oe)|0,n=n+Math.imul(B,fe)|0,a=(a=a+Math.imul(B,de)|0)+Math.imul(R,fe)|0,i=i+Math.imul(R,de)|0,n=n+Math.imul(T,ue)|0,a=(a=a+Math.imul(T,be)|0)+Math.imul(P,ue)|0,i=i+Math.imul(P,be)|0;var Pe=(d+(n=n+Math.imul(A,le)|0)|0)+((8191&(a=(a=a+Math.imul(A,pe)|0)+Math.imul(E,le)|0))<<13)|0;d=((i=i+Math.imul(E,pe)|0)+(a>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,ie),a=(a=Math.imul(U,oe))+Math.imul(z,ie)|0,i=Math.imul(z,oe),n=n+Math.imul(I,fe)|0,a=(a=a+Math.imul(I,de)|0)+Math.imul(L,fe)|0,i=i+Math.imul(L,de)|0,n=n+Math.imul(B,ue)|0,a=(a=a+Math.imul(B,be)|0)+Math.imul(R,ue)|0,i=i+Math.imul(R,be)|0;var je=(d+(n=n+Math.imul(T,le)|0)|0)+((8191&(a=(a=a+Math.imul(T,pe)|0)+Math.imul(P,le)|0))<<13)|0;d=((i=i+Math.imul(P,pe)|0)+(a>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(U,fe),a=(a=Math.imul(U,de))+Math.imul(z,fe)|0,i=Math.imul(z,de),n=n+Math.imul(I,ue)|0,a=(a=a+Math.imul(I,be)|0)+Math.imul(L,ue)|0,i=i+Math.imul(L,be)|0;var Be=(d+(n=n+Math.imul(B,le)|0)|0)+((8191&(a=(a=a+Math.imul(B,pe)|0)+Math.imul(R,le)|0))<<13)|0;d=((i=i+Math.imul(R,pe)|0)+(a>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(U,ue),a=(a=Math.imul(U,be))+Math.imul(z,ue)|0,i=Math.imul(z,be);var Re=(d+(n=n+Math.imul(I,le)|0)|0)+((8191&(a=(a=a+Math.imul(I,pe)|0)+Math.imul(L,le)|0))<<13)|0;d=((i=i+Math.imul(L,pe)|0)+(a>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ce=(d+(n=Math.imul(U,le))|0)+((8191&(a=(a=Math.imul(U,pe))+Math.imul(z,le)|0))<<13)|0;return d=((i=Math.imul(z,pe))+(a>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,f[0]=me,f[1]=xe,f[2]=ye,f[3]=ve,f[4]=ge,f[5]=we,f[6]=_e,f[7]=Me,f[8]=ke,f[9]=Se,f[10]=Ae,f[11]=Ee,f[12]=Oe,f[13]=Te,f[14]=Pe,f[15]=je,f[16]=Be,f[17]=Re,f[18]=Ce,0!==d&&(f[19]=d,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=c,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r._strip()}function v(e,t,r){return y(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(x=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?x(this,e,t):r<63?m(this,e,t):r<1024?y(this,e,t):v(this,e,t)},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,r+=i/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>a&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,n=(e-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0),n=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),c=67108863^67108863>>>i<o)for(this.length-=o,d=0;d=0&&(0!==s||d>=n);d--){var u=0|this.words[d];this.words[d]=s<<26-i|u>>>i,s=u&c}return f&&0!==s&&(f.words[f.length++]=s),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return a(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){a("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<=0);var t=e%26,r=(e-t)/26;if(a(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(a("number"==typeof e),a(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===c)return this._strip();for(a(-1===c),c=0,n=0;n>26,this.words[n]=67108863&i;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,i=0|a.words[a.length-1];0!==(r=26-this._countBits(i))&&(a=a.ushln(r),n.iushln(r),i=0|a.words[a.length-1]);var c,f=n.length-a.length;if("mod"!==t){(c=new o(null)).length=f+1,c.words=new Array(c.length);for(var d=0;d=0;u--){var b=67108864*(0|n.words[a.length+u])+(0|n.words[a.length+u-1]);for(b=Math.min(b/i|0,67108863),n._ishlnsubmul(a,b,u);0!==n.negative;)b--,n.negative=0,n._ishlnsubmul(a,1,u),n.isZero()||(n.negative^=1);c&&(c.words[u]=b)}return c&&c._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:c||null,mod:n}},o.prototype.divmod=function(e,t,r){return a(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(c=this.neg().divmod(e,t),"mod"!==t&&(n=c.div.neg()),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.iadd(e)),{div:n,mod:i}):0===this.negative&&0!==e.negative?(c=this.divmod(e.neg(),t),"mod"!==t&&(n=c.div.neg()),{div:n,mod:c.mod}):0!=(this.negative&e.negative)?(c=this.neg().divmod(e.neg(),t),"div"!==t&&(i=c.mod.neg(),r&&0!==i.negative&&i.isub(e)),{div:c.div,mod:i}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,i,c},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),a=e.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(r*n+(0|this.words[i]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),a(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*r;this.words[n]=i/e|0,r=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),i=new o(0),c=new o(0),f=new o(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var s=r.clone(),u=t.clone();!t.isZero();){for(var b=0,h=1;0==(t.words[0]&h)&&b<26;++b,h<<=1);if(b>0)for(t.iushrn(b);b-- >0;)(n.isOdd()||i.isOdd())&&(n.iadd(s),i.isub(u)),n.iushrn(1),i.iushrn(1);for(var l=0,p=1;0==(r.words[0]&p)&&l<26;++l,p<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(c.isOdd()||f.isOdd())&&(c.iadd(s),f.isub(u)),c.iushrn(1),f.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(c),i.isub(f)):(r.isub(t),c.isub(n),f.isub(i))}return{a:c,b:f,gcd:r.iushln(d)}},o.prototype._invmp=function(e){a(0===e.negative),a(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,i=new o(1),c=new o(0),f=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,s=1;0==(t.words[0]&s)&&d<26;++d,s<<=1);if(d>0)for(t.iushrn(d);d-- >0;)i.isOdd()&&i.iadd(f),i.iushrn(1);for(var u=0,b=1;0==(r.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(r.iushrn(u);u-- >0;)c.isOdd()&&c.iadd(f),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(c)):(r.isub(t),c.isub(i))}return(n=0===t.cmpn(1)?i:c).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=t.cmp(r);if(a<0){var i=t;t=r,r=i}else if(0===a||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){a("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<>>26,c&=67108863,this.words[o]=c}return 0!==i&&(this.words[o]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),a(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:ne.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|e.words[r];if(n!==a){na&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new E(e)},o.prototype.toRed=function(e){return a(!this.red,"Already a number in reduction context"),a(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return a(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return a(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else a(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}_.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},i(M,_),M.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,a=i}a>>>=22,e.words[n-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},M.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=a,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new M;else if("p224"===e)t=new k;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return w[e]=t,t},E.prototype._verify1=function(e){a(0===e.negative,"red works only with positives"),a(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){a(0==(e.negative|t.negative),"red works only with positives"),a(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(a(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);a(!n.isZero());var c=new o(1).toRed(this),f=c.redNeg(),d=this.m.subn(1).iushrn(1),s=this.m.bitLength();for(s=new o(2*s*s).toRed(this);0!==this.pow(s,d).cmp(f);)s.redIAdd(f);for(var u=this.pow(s,n),b=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),l=i;0!==h.cmp(c);){for(var p=h,m=0;0!==p.cmp(c);m++)p=p.redSqr();a(m=0;n--){for(var d=t.words[n],s=f-1;s>=0;s--){var u=d>>s&1;a!==r[0]&&(a=this.sqr(a)),0!==u||0!==i?(i<<=1,i|=u,(4===++c||0===n&&0===s)&&(a=this.mul(a,r[i]),c=0,i=0)):c=0}f=26}return a},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,E),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(15)(e))},function(e,t){},function(e,t,r){"use strict";var n=r(232),a=r(16).errors,i=function(e){this.requestManager=e,this.requests=[]};i.prototype.add=function(e){this.requests.push(e)},i.prototype.execute=function(){var e=this.requests,t=this._sortResponses.bind(this);this.requestManager.sendBatch(e,(function(r,i){i=t(i),e.map((function(e,t){return i[t]||{}})).forEach((function(t,r){if(e[r].callback){if(t&&t.error)return e[r].callback(a.ErrorResponse(t));if(!n.isValidResponse(t))return e[r].callback(a.InvalidResponse(t));try{e[r].callback(null,e[r].format?e[r].format(t.result):t.result)}catch(t){e[r].callback(t)}}}))}))},i.prototype._sortResponses=function(e){return(e||[]).sort((function(e,t){return e.id-t.id}))},e.exports=i},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=null,i="object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis:void 0;if(!i)try{i=Function("return this")()}catch(e){i=self}void 0!==i.ethereum?a=i.ethereum:void 0!==i.web3&&i.web3.currentProvider&&(i.web3.currentProvider.sendAsync&&(i.web3.currentProvider.send=i.web3.currentProvider.sendAsync,delete i.web3.currentProvider.sendAsync),!i.web3.currentProvider.on&&i.web3.currentProvider.connection&&"ipcProviderWrapper"===i.web3.currentProvider.connection.constructor.name&&(i.web3.currentProvider.on=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");switch(e){case"data":this.connection.on("data",(function(e){var r="";e=e.toString();try{r=JSON.parse(e)}catch(r){return t(new Error("Couldn't parse response data"+e))}r.id||-1===r.method.indexOf("_subscription")||t(null,r)}));break;default:this.connection.on(e,t)}}),a=i.web3.currentProvider),e.exports=a},function(e,t,r){"use strict";var n=r(145),a=r(481),i=r(16).errors,o=r(486).w3cwebsocket,c=function(e,t){n.call(this),t=t||{},this.url=e,this._customTimeout=t.timeout||15e3,this.headers=t.headers||{},this.protocol=t.protocol||void 0,this.reconnectOptions=Object.assign({auto:!1,delay:5e3,maxAttempts:!1,onTimeout:!1},t.reconnect),this.clientConfig=t.clientConfig||void 0,this.requestOptions=t.requestOptions||void 0,this.DATA="data",this.CLOSE="close",this.ERROR="error",this.CONNECT="connect",this.RECONNECT="reconnect",this.connection=null,this.requestQueue=new Map,this.responseQueue=new Map,this.reconnectAttempts=0,this.reconnecting=!1;var r=a.parseURL(e);r.username&&r.password&&(this.headers.authorization="Basic "+a.btoa(r.username+":"+r.password)),r.auth&&(this.headers.authorization="Basic "+a.btoa(r.auth)),Object.defineProperty(this,"connected",{get:function(){return this.connection&&this.connection.readyState===this.connection.OPEN},enumerable:!0}),this.connect()};(c.prototype=Object.create(n.prototype)).constructor=c,c.prototype.connect=function(){this.connection=new o(this.url,this.protocol,void 0,this.headers,this.requestOptions,this.clientConfig),this._addSocketListeners()},c.prototype._onMessage=function(e){var t=this;this._parseResponse("string"==typeof e.data?e.data:"").forEach((function(e){if(e.method&&-1!==e.method.indexOf("_subscription"))t.emit(t.DATA,e);else{var r=e.id;Array.isArray(e)&&(r=e[0].id),t.responseQueue.has(r)&&(void 0!==t.responseQueue.get(r).callback&&t.responseQueue.get(r).callback(!1,e),t.responseQueue.delete(r))}}))},c.prototype._onConnect=function(){if(this.emit(this.CONNECT),this.reconnectAttempts=0,this.reconnecting=!1,this.requestQueue.size>0){var e=this;this.requestQueue.forEach((function(t,r){e.send(t.payload,t.callback),e.requestQueue.delete(r)}))}},c.prototype._onClose=function(e){var t=this;!this.reconnectOptions.auto||[1e3,1001].includes(e.code)&&!1!==e.wasClean?(this.emit(this.CLOSE,e),this.requestQueue.size>0&&this.requestQueue.forEach((function(r,n){r.callback(i.ConnectionNotOpenError(e)),t.requestQueue.delete(n)})),this.responseQueue.size>0&&this.responseQueue.forEach((function(r,n){r.callback(i.InvalidConnection("on WS",e)),t.responseQueue.delete(n)})),this._removeSocketListeners(),this.removeAllListeners()):this.reconnect()},c.prototype._addSocketListeners=function(){this.connection.addEventListener("message",this._onMessage.bind(this)),this.connection.addEventListener("open",this._onConnect.bind(this)),this.connection.addEventListener("close",this._onClose.bind(this))},c.prototype._removeSocketListeners=function(){this.connection.removeEventListener("message",this._onMessage),this.connection.removeEventListener("open",this._onConnect),this.connection.removeEventListener("close",this._onClose)},c.prototype._parseResponse=function(e){var t=this,r=[];return e.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach((function(e){t.lastChunk&&(e=t.lastChunk+e);var n=null;try{n=JSON.parse(e)}catch(r){return t.lastChunk=e,clearTimeout(t.lastChunkTimeout),void(t.lastChunkTimeout=setTimeout((function(){t.reconnectOptions.auto&&t.reconnectOptions.onTimeout?t.reconnect():(t.emit(t.ERROR,i.ConnectionTimeout(t._customTimeout)),t.requestQueue.size>0&&t.requestQueue.forEach((function(e,r){e.callback(i.ConnectionTimeout(t._customTimeout)),t.requestQueue.delete(r)})))}),t._customTimeout))}clearTimeout(t.lastChunkTimeout),t.lastChunk=null,n&&r.push(n)})),r},c.prototype.send=function(e,t){var r=e.id,n={payload:e,callback:t};if(Array.isArray(e)&&(r=e[0].id),this.connection.readyState===this.connection.CONNECTING||this.reconnecting)this.requestQueue.set(r,n);else{if(this.connection.readyState!==this.connection.OPEN)return this.requestQueue.delete(r),this.emit(this.ERROR,i.ConnectionNotOpenError()),void n.callback(i.ConnectionNotOpenError());this.responseQueue.set(r,n),this.requestQueue.delete(r);try{this.connection.send(JSON.stringify(n.payload))}catch(e){n.callback(e),this.responseQueue.delete(r)}}},c.prototype.reset=function(){this.responseQueue.clear(),this.requestQueue.clear(),this.removeAllListeners(),this._removeSocketListeners(),this._addSocketListeners()},c.prototype.disconnect=function(e,t){this._removeSocketListeners(),this.connection.close(e||1e3,t)},c.prototype.supportsSubscriptions=function(){return!0},c.prototype.reconnect=function(){var e=this;this.reconnecting=!0,this.responseQueue.size>0&&this.responseQueue.forEach((function(t,r){t.callback(i.PendingRequestsOnReconnectingError()),e.responseQueue.delete(r)})),!this.reconnectOptions.maxAttempts||this.reconnectAttempts0&&this.requestQueue.forEach((function(t,r){t.callback(i.MaxAttemptsReachedOnReconnectingError()),e.requestQueue.delete(r)})))},e.exports=c},function(e,t,r){(function(t,n){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i="[object process]"===Object.prototype.toString.call(void 0!==t?t:0),o="undefined"!=typeof navigator&&"ReactNative"===navigator.product,c=null,f=null;if(i||o){c=function(e){return n.from(e).toString("base64")};var d=r(85);if(d.URL){var s=d.URL;f=function(e){return new s(e)}}else f=r(85).parse}else c=btoa.bind("object"===("undefined"==typeof globalThis?"undefined":a(globalThis))?globalThis:self),f=function(e){return new URL(e)};e.exports={parseURL:f,btoa:c}}).call(this,r(11),r(0).Buffer)},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"===n(e)&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";t.decode=t.parse=r(484),t.encode=t.stringify=r(485)},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,i){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var c=/\+/g;e=e.split(t);var f=1e3;i&&"number"==typeof i.maxKeys&&(f=i.maxKeys);var d=e.length;f>0&&d>f&&(d=f);for(var s=0;s=0?(u=p.substr(0,m),b=p.substr(m+1)):(u=p,b=""),h=decodeURIComponent(u),l=decodeURIComponent(b),n(o,h)?a(o[h])?o[h].push(l):o[h]=[o[h],l]:o[h]=l}return o};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=function(e){switch(n(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,f){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"===n(e)?o(c(e),(function(n){var c=encodeURIComponent(a(n))+r;return i(e[n])?o(e[n],(function(e){return c+encodeURIComponent(a(e))})).join(t):c+encodeURIComponent(a(e[n]))})).join(t):f?encodeURIComponent(a(f))+r+encodeURIComponent(a(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n (https://github.com/theturtle32)","contributors":["Iñaki Baz Castillo (http://dev.sipdoc.net)"],"version":"1.0.34","repository":{"type":"git","url":"https://github.com/theturtle32/WebSocket-Node.git"},"homepage":"https://github.com/theturtle32/WebSocket-Node","engines":{"node":">=4.0.0"},"dependencies":{"bufferutil":"^4.0.1","debug":"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2","yaeti":"^0.0.6"},"devDependencies":{"buffer-equal":"^1.0.0","gulp":"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1","jshint":"^2.0.0","tape":"^4.9.1"},"config":{"verbose":false},"scripts":{"test":"tape test/unit/*.js","gulp":"gulp"},"main":"index","directories":{"lib":"./lib"},"browser":"lib/browser.js","license":"Apache-2.0"}')},function(e,t,r){var n=r(16).errors,a=r(194).XMLHttpRequest,i=r(146),o=r(237),c=function(e,t){t=t||{},this.withCredentials=t.withCredentials||!1,this.timeout=t.timeout||15e3,this.headers=t.headers,this.agent=t.agent,this.connected=!1;var r=!1!==t.keepAlive;this.host=e||"http://localhost:8545",this.agent||("https"===this.host.substring(0,5)?this.httpsAgent=new o.Agent({keepAlive:r}):this.httpAgent=new i.Agent({keepAlive:r}))};c.prototype._prepareRequest=function(){var e;if("undefined"!=typeof XMLHttpRequest)e=new XMLHttpRequest;else{e=new a;var t={httpsAgent:this.httpsAgent,httpAgent:this.httpAgent,baseUrl:this.baseUrl};this.agent&&(t.httpsAgent=this.agent.https,t.httpAgent=this.agent.http,t.baseUrl=this.agent.baseUrl),e.nodejsSet(t)}return e.open("POST",this.host,!0),e.setRequestHeader("Content-Type","application/json"),e.timeout=this.timeout,e.withCredentials=this.withCredentials,this.headers&&this.headers.forEach((function(t){e.setRequestHeader(t.name,t.value)})),e},c.prototype.send=function(e,t){var r=this,a=this._prepareRequest();a.onreadystatechange=function(){if(4===a.readyState&&1!==a.timeout){var e=a.responseText,i=null;try{e=JSON.parse(e)}catch(e){i=n.InvalidResponse(a.responseText)}r.connected=!0,t(i,e)}},a.ontimeout=function(){r.connected=!1,t(n.ConnectionTimeout(this.timeout))},window.debug&&console.log(JSON.stringify(e));try{a.send(JSON.stringify(e))}catch(e){this.connected=!1,t(n.InvalidConnection(this.host))}},c.prototype.disconnect=function(){},c.prototype.supportsSubscriptions=function(){return!1},e.exports=c},function(e,t,r){"use strict";(function(e,n){var a,i=this&&this.__extends||(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0)return this._url=this._parseUrl(t.headers.location),this._method="GET",this._loweredHeaders["content-type"]&&(delete this._headers[this._loweredHeaders["content-type"]],delete this._loweredHeaders["content-type"]),null!=this._headers["Content-Type"]&&delete this._headers["Content-Type"],delete this._headers["Content-Length"],this.upload._reset(),this._finalizeHeaders(),void this._sendHxxpRequest();this._response=t,this._response.on("data",(function(e){return n._onHttpResponseData(t,e)})),this._response.on("end",(function(){return n._onHttpResponseEnd(t)})),this._response.on("close",(function(){return n._onHttpResponseClose(t)})),this.responseUrl=this._url.href.split("#")[0],this.status=t.statusCode,this.statusText=c.STATUS_CODES[this.status],this._parseResponseHeaders(t);var a=this._responseHeaders["content-length"]||"";this._totalBytes=+a,this._lengthComputable=!!a,this._setReadyState(r.HEADERS_RECEIVED)}},r.prototype._onHttpResponseData=function(e,t){this._response===e&&(this._responseParts.push(new n(t)),this._loadedBytes+=t.length,this.readyState!==r.LOADING&&this._setReadyState(r.LOADING),this._dispatchProgress("progress"))},r.prototype._onHttpResponseEnd=function(e){this._response===e&&(this._parseResponse(),this._request=null,this._response=null,this._setReadyState(r.DONE),this._dispatchProgress("load"),this._dispatchProgress("loadend"))},r.prototype._onHttpResponseClose=function(e){if(this._response===e){var t=this._request;this._setError(),t.abort(),this._setReadyState(r.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend")}},r.prototype._onHttpTimeout=function(e){this._request===e&&(this._setError(),e.abort(),this._setReadyState(r.DONE),this._dispatchProgress("timeout"),this._dispatchProgress("loadend"))},r.prototype._onHttpRequestError=function(e,t){this._request===e&&(this._setError(),e.abort(),this._setReadyState(r.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend"))},r.prototype._dispatchProgress=function(e){var t=new r.ProgressEvent(e);t.lengthComputable=this._lengthComputable,t.loaded=this._loadedBytes,t.total=this._totalBytes,this.dispatchEvent(t)},r.prototype._setError=function(){this._request=null,this._response=null,this._responseHeaders=null,this._responseParts=null},r.prototype._parseUrl=function(e,t,r){var n=null==this.nodejsBaseUrl?e:s.resolve(this.nodejsBaseUrl,e),a=s.parse(n,!1,!0);a.hash=null;var i=(a.auth||"").split(":"),o=i[0],c=i[1];return(o||c||t||r)&&(a.auth=(t||o||"")+":"+(r||c||"")),a},r.prototype._parseResponseHeaders=function(e){for(var t in this._responseHeaders={},e.headers){var r=t.toLowerCase();this._privateHeaders[r]||(this._responseHeaders[r]=e.headers[t])}null!=this._mimeOverride&&(this._responseHeaders["content-type"]=this._mimeOverride)},r.prototype._parseResponse=function(){var e=n.concat(this._responseParts);switch(this._responseParts=null,this.responseType){case"json":this.responseText=null;try{this.response=JSON.parse(e.toString("utf-8"))}catch(e){this.response=null}return;case"buffer":return this.responseText=null,void(this.response=e);case"arraybuffer":this.responseText=null;for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),a=0;a +//android.applicationVariants.all { variant -> // delete previous files first - delete "${buildDir}/intermediates/merged_assets/${variant.dirName}" - - variant.mergeAssetsProvider.get().doLast { - def sourceDir = rootProject.ext.cfgs.jsFilePath - - copy{ - from "${sourceDir}" - include "Data/js/**" - into outputDir - } - copy { - from "${sourceDir}/cert/cacert.pem" - into outputDir - } - } -} +// delete "${buildDir}/intermediates/merged_assets/${variant.dirName}" +// +// variant.mergeAssetsProvider.get().doLast { +// def sourceDir = rootProject.ext.cfgs.jsFilePath +// +// copy{ +// from "${sourceDir}" +// include "Data/js/**" +// into outputDir +// } +// copy { +// from "${sourceDir}/cert/cacert.pem" +// into outputDir +// } +// } +//} dependencies { diff --git a/app/src/com/cege/games/release/MainActivity.java b/app/src/com/cege/games/release/MainActivity.java index 8da3d54..951e641 100644 --- a/app/src/com/cege/games/release/MainActivity.java +++ b/app/src/com/cege/games/release/MainActivity.java @@ -77,6 +77,7 @@ import org.cocos2dx.lib.Cocos2dxHelper; import org.cocos2dx.lib.CocosJSHelper; import org.json.JSONException; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -156,10 +157,6 @@ public class MainActivity extends UnityPlayerActivity private FirebaseAnalytics mFirebaseAnalytics; private AppEventsLogger fbLogger; - protected String updateUnityCommandLineArguments(String cmdLine) { - return cmdLine; - } - @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); @@ -168,9 +165,6 @@ public class MainActivity extends UnityPlayerActivity // Obtain the FirebaseAnalytics instance. mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); - String cmdLine = updateUnityCommandLineArguments(getIntent().getStringExtra("unity")); - getIntent().putExtra("unity", cmdLine); - onLoadNativeLibraries(); app = this; Cocos2dxHelper.init(this); diff --git a/gradle.properties b/gradle.properties index 204a030..9837e73 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,10 +22,10 @@ android.enableJetifier=true PROP_COMPILE_SDK_VERSION=30 # Android SDK version that will be used as the earliest version of android this application can run on -PROP_MIN_SDK_VERSION=22 +PROP_MIN_SDK_VERSION=26 # Android SDK version that will be used as the latest version of android this application has been tested on -PROP_TARGET_SDK_VERSION=31 +PROP_TARGET_SDK_VERSION=30 # Android Build Tools version that will be used as the compile project PROP_BUILD_TOOLS_VERSION=30.0.2 diff --git a/install-time-asset_pack/.gitignore b/install-time-asset_pack/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/install-time-asset_pack/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/install-time-asset_pack/build.gradle b/install-time-asset_pack/build.gradle deleted file mode 100644 index 24f4159..0000000 --- a/install-time-asset_pack/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id 'com.android.library' -} - -apply plugin: 'com.android.asset-pack' - -assetPack{ - packName = "install_time_asset_pack" - dynamicDelivery{ - deliveryType = "install-time" //PAD资源分发 安装时分发 - } -} - -android { - compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 32 - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - - implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'com.google.android.material:material:1.4.0' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} \ No newline at end of file diff --git a/install-time-asset_pack/consumer-rules.pro b/install-time-asset_pack/consumer-rules.pro deleted file mode 100644 index e69de29..0000000 diff --git a/install-time-asset_pack/proguard-rules.pro b/install-time-asset_pack/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/install-time-asset_pack/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/install-time-asset_pack/src/androidTest/java/com/example/mylibrary/ExampleInstrumentedTest.java b/install-time-asset_pack/src/androidTest/java/com/example/mylibrary/ExampleInstrumentedTest.java deleted file mode 100644 index 81d0e70..0000000 --- a/install-time-asset_pack/src/androidTest/java/com/example/mylibrary/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.mylibrary; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("com.example.mylibrary.test", appContext.getPackageName()); - } -} \ No newline at end of file diff --git a/install-time-asset_pack/src/main/AndroidManifest.xml b/install-time-asset_pack/src/main/AndroidManifest.xml deleted file mode 100644 index ed91afc..0000000 --- a/install-time-asset_pack/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/install-time-asset_pack/src/test/java/com/example/mylibrary/ExampleUnitTest.java b/install-time-asset_pack/src/test/java/com/example/mylibrary/ExampleUnitTest.java deleted file mode 100644 index 0c3b084..0000000 --- a/install-time-asset_pack/src/test/java/com/example/mylibrary/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.example.mylibrary; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index c46288c..da113be 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,7 +3,9 @@ include ':app' rootProject.name = "HeadlessCocos" include ':libcocos2dx' project(':libcocos2dx').projectDir = new File(ext.cfgs.cocos2dxBasePath + '/cocos/platform/android/libcocos2dx') -include ':install-time-asset_pack' + +include ':UnityDataAssetPack' +project(':UnityDataAssetPack').projectDir = new File(ext.cfgs.unityAndroidProject + '/UnityDataAssetPack') include ':unityLibrary' project(':unityLibrary').projectDir = new File(ext.cfgs.unityAndroidProject + '/unityLibrary') \ No newline at end of file