!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SlpWallet=t()}}((function(){for(var define,module,exports,createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$defaults_172=createModuleFactory((function(t,e){(function(e){(function(){"use strict";var r={"Content-Type":"application/x-www-form-urlencoded"};function i(t,e){!_$utils_185.isUndefined(t)&&_$utils_185.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var n,o={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==e&&"[object process]"===Object.prototype.toString.call(e))&&(n=_$xhr_158({})),n),transformRequest:[function(t,e){return _$normalizeHeaderName_181(e,"Accept"),_$normalizeHeaderName_181(e,"Content-Type"),_$utils_185.isFormData(t)||_$utils_185.isArrayBuffer(t)||_$utils_185.isBuffer(t)||_$utils_185.isStream(t)||_$utils_185.isFile(t)||_$utils_185.isBlob(t)?t:_$utils_185.isArrayBufferView(t)?t.buffer:_$utils_185.isURLSearchParams(t)?(i(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_$utils_185.isObject(t)||e&&"application/json"===e["Content-Type"]?(i(e,"application/json"),function(t,e,r){if(_$utils_185.isString(t))try{return(0,JSON.parse)(t),_$utils_185.trim(t)}catch(i){if("SyntaxError"!==i.name)throw i}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||o.transitional,r=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||i&&_$utils_185.isString(t)&&t.length)try{return JSON.parse(t)}catch(a){if(n){if("SyntaxError"===a.name)throw _$enhanceError_168(a,this,"E_JSON_PARSE");throw a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_$utils_185.forEach(["delete","get","head"],(function(t){o.headers[t]={}})),_$utils_185.forEach(["post","put","patch"],(function(t){o.headers[t]=_$utils_185.merge(r)})),t.exports=o}).call(this)}).call(this,_$browser_401)})),_$xhr_158=createModuleFactory((function(t,e){"use strict";var r=_$defaults_172({});t.exports=function(t){return new Promise((function(e,i){var n,o=t.data,a=t.headers,s=t.responseType;function u(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}_$utils_185.isFormData(o)&&delete a["Content-Type"];var h=new XMLHttpRequest;if(t.auth){var f=t.auth.username||"",c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+c)}var l=_$buildFullPath_165(t.baseURL,t.url);function d(){if(h){var r="getAllResponseHeaders"in h?_$parseHeaders_182(h.getAllResponseHeaders()):null,n={data:s&&"text"!==s&&"json"!==s?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:t,request:h};_$settle_170((function(t){e(t),u()}),(function(t){i(t),u()}),n),h=null}}if(h.open(t.method.toUpperCase(),_$buildURL_175(l,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,"onloadend"in h?h.onloadend=d:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(d)},h.onabort=function(){h&&(i(_$createError_166("Request aborted",t,"ECONNABORTED",h)),h=null)},h.onerror=function(){i(_$createError_166("Network Error",t,null,h)),h=null},h.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||r.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),i(_$createError_166(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",h)),h=null},_$utils_185.isStandardBrowserEnv()){var p=(t.withCredentials||_$isURLSameOrigin_180(l))&&t.xsrfCookieName?_$cookies_177.read(t.xsrfCookieName):void 0;p&&(a[t.xsrfHeaderName]=p)}"setRequestHeader"in h&&_$utils_185.forEach(a,(function(t,e){void 0===o&&"content-type"===e.toLowerCase()?delete a[e]:h.setRequestHeader(e,t)})),_$utils_185.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),s&&"json"!==s&&(h.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){h&&(i(!t||t&&t.type?new _$Cancel_160("canceled"):t),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),o||(o=null),h.send(o)}))}})),_$cryptoBrowserify_266=createModuleFactory((function(t,e){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=_$browser_415,e.createHash=e.Hash=_$browser_262,e.createHmac=e.Hmac=_$browser_264;var r=Object.keys(_$algos_238),i=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);e.getHashes=function(){return i},e.pbkdf2=_$browser_394.pbkdf2,e.pbkdf2Sync=_$browser_394.pbkdf2Sync,e.Cipher=_$browser_234.Cipher,e.createCipher=_$browser_234.createCipher,e.Cipheriv=_$browser_234.Cipheriv,e.createCipheriv=_$browser_234.createCipheriv,e.Decipher=_$browser_234.Decipher,e.createDecipher=_$browser_234.createDecipher,e.Decipheriv=_$browser_234.Decipheriv,e.createDecipheriv=_$browser_234.createDecipheriv,e.getCiphers=_$browser_234.getCiphers,e.listCiphers=_$browser_234.listCiphers,e.DiffieHellmanGroup=_$browser_308.DiffieHellmanGroup,e.createDiffieHellmanGroup=_$browser_308.createDiffieHellmanGroup,e.getDiffieHellman=_$browser_308.getDiffieHellman,e.createDiffieHellman=_$browser_308.createDiffieHellman,e.DiffieHellman=_$browser_308.DiffieHellman,e.createSign=_$browser_241.createSign,e.Sign=_$browser_241.Sign,e.createVerify=_$browser_241.createVerify,e.Verify=_$browser_241.Verify,e.createECDH=_$browser_260,e.publicEncrypt=_$browser_402.publicEncrypt,e.privateEncrypt=_$browser_402.privateEncrypt,e.publicDecrypt=_$browser_402.publicDecrypt,e.privateDecrypt=_$browser_402.privateDecrypt,e.randomFill=_$browser_416.randomFill,e.randomFillSync=_$browser_416.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),_$asn1_105=createModuleFactory((function(t,e){var r=e;r.bignum=_$bn_119,r.define=_$api_106({}).define,r.base=_$base_108({}),r.constants=_$constants_112({}),r.decoders=_$decoders_114({}),r.encoders=_$encoders_117({})})),_$encoders_117=createModuleFactory((function(t,e){var r=e;r.der=_$der_116({}),r.pem=_$pem_118({})})),_$pem_118=createModuleFactory((function(t,e){var r=_$der_116({});function i(t){r.call(this,t),this.enc="pem"}_$inherits_browser_375(i,r),t.exports=i,i.prototype.encode=function(t,e){for(var i=r.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"],o=0;o=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|o.tagClassByName[r||"universal"]<<6)}(t,e,i,this.reporter);if(n.length<128)return(a=new r(2))[0]=s,a[1]=n.length,this._createEncoderBuffer([a,n]);for(var u=1,h=n.length;h>=256;h>>=8)u++;(a=new r(2+u))[0]=s,a[1]=128|u,h=1+u;for(var f=n.length;f>0;h--,f>>=8)a[h]=255&f;return this._createEncoderBuffer([a,n])},s.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var i=new r(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n=128;a>>=7)o++}var s=new r(o),u=s.length-1;for(n=t.length-1;n>=0;n--)for(a=t[n],s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a;return this._createEncoderBuffer(s)},s.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!r.isBuffer(t)){var i=t.toArray();!t.sign&&128&i[0]&&i.unshift(0),t=new r(i)}if(r.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new r(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var a=t;a>=256;a>>=8)n++;for(a=(o=new Array(n)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new r(o))},s.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},s.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i>6],n=0==(32&r);if(31==(31&r)){var a=r;for(r=0;128==(128&a);){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:o.tag[r]}}function h(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var o=0;o0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),i?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?_(t,u,e,!1):b(t,u)):_(t,u,e,!1))):i||(u.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function g(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_$processNextickArgs_400.nextTick(y,t):y(t))}function y(t){f("emit readable"),t.emit("readable"),$(t)}function b(t,e){e.readingMore||(e.readingMore=!0,_$processNextickArgs_400.nextTick(v,t,e))}function v(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;return to.length?o.length:t;if(a===o.length?n+=o:n+=o.slice(0,t),0==(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=o.allocUnsafe(t),i=e.head,n=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var a=i.data,s=t>a.length?a.length:t;if(a.copy(r,r.length-t,0,s),0==(t-=s)){s===a.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(s));break}++n}return e.length-=n,r}(t,e),i}(t,e.buffer,e.decoder),r);var r}function S(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_$processNextickArgs_400.nextTick(A,e,t))}function A(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function B(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?S(this):g(this),null;if(0===(t=m(t,e))&&e.ended)return 0===e.length&&S(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?E(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&S(this)),null!==i&&this.emit("data",i),i},d.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},d.prototype.pipe=function(t,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,f("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||t===e.stdout||t===e.stderr?m:s;function s(){f("onend"),t.end()}o.endEmitted?_$processNextickArgs_400.nextTick(a):i.once("end",a),t.on("unpipe",(function e(r,n){f("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),t.removeListener("close",p),t.removeListener("finish",_),t.removeListener("drain",u),t.removeListener("error",d),t.removeListener("unpipe",e),i.removeListener("end",s),i.removeListener("end",m),i.removeListener("data",l),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}));var u=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,$(t))}}(i);t.on("drain",u);var h=!1,c=!1;function l(e){f("ondata"),c=!1,!1!==t.write(e)||c||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==B(o.pipes,t))&&!h&&(f("false write response, pause",o.awaitDrain),o.awaitDrain++,c=!0),i.pause())}function d(e){f("onerror",e),m(),t.removeListener("error",d),0===n(t,"error")&&t.emit("error",e)}function p(){t.removeListener("finish",_),m()}function _(){f("onfinish"),t.removeListener("close",p),m()}function m(){f("unpipe"),i.unpipe(t)}return i.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?_$isarray_377(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,d),t.once("close",p),t.once("finish",_),t.emit("pipe",i),o.flowing||(f("pipe resume"),i.resume()),t},d.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}})),_$Duplex_417=createModuleFactory((function(t,e){"use strict";var r=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var i=Object.create(_$util_259);i.inherits=_$inherits_browser_375;var n=_$Readable_419({}),o=_$Writable_421({});i.inherits(h,n);for(var a=r(o.prototype),s=0;s-1?i:_$processNextickArgs_400.nextTick;p.WritableState=d;var s=Object.create(_$util_259);s.inherits=_$inherits_browser_375;var u,h={deprecate:_$browser_482},f=_$safeBuffer_431.Buffer,c=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};function l(){}function d(t,e){o=o||_$Duplex_417({}),t=t||{};var r=e instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,s=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(_$processNextickArgs_400.nextTick(n,i),_$processNextickArgs_400.nextTick(v,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),v(t,e))}(t,r,i,e,n);else{var o=y(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||g(t,r),i?a(m,t,r,o,n):m(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function p(t){if(o=o||_$Duplex_417({}),!(u.call(p,this)||this instanceof o))return new p(t);this._writableState=new d(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),_$streamBrowser_424.call(this)}function _(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function m(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),v(t,e)}function g(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,o=new Array(i),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,_(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new n(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,c=r.callback;if(_(t,e,!1,e.objectMode?1:h.length,h,f,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function y(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function b(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),v(t,e)}))}function v(t,e){var r=y(e);return r&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,_$processNextickArgs_400.nextTick(b,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}s.inherits(p,_$streamBrowser_424),d.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(d.prototype,"buffer",{get:h.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!u.call(this,t)||this===p&&t&&t._writableState instanceof d}})):u=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,a=!n.objectMode&&(i=t,f.isBuffer(i)||i instanceof c);return a&&!f.isBuffer(t)&&(t=function(t){return f.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=l),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),_$processNextickArgs_400.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),_$processNextickArgs_400.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.pendingcb++,o=function(t,e,r,i,n,o){if(!r){var a=function(t,e,r){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=f.from(e,r)),e}(e,i,n);i!==a&&(r=!0,n="buffer",i=a)}var s=e.objectMode?1:i.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,v(t,e),r&&(e.finished?_$processNextickArgs_400.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=_$destroy_423.destroy,p.prototype._undestroy=_$destroy_423.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this)}).call(this,_$browser_401,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_$main_477({}).setImmediate)})),_$main_477=createModuleFactory((function(t,e){(function(t,r){(function(){var i=_$browser_401.nextTick,n=(Function.prototype.apply,Array.prototype.slice),o={},a=0;function s(t,e){this._id=t,this._clearFn=e}s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(window,this._id)},e.setImmediate="function"==typeof t?t:function(t){var r=a++,s=!(arguments.length<2)&&n.call(arguments,1);return o[r]=!0,i((function(){o[r]&&(s?t.apply(null,s):t.call(null),e.clearImmediate(r))})),r},e.clearImmediate="function"==typeof r?r:function(t){delete o[t]}}).call(this)}).call(this,_$main_477({}).setImmediate,_$main_477({}).clearImmediate)})),_$_stream_readable_464=createModuleFactory((function(t,e){(function(e,r){(function(){"use strict";var i;t.exports=w,w.ReadableState=v,_$events_349.EventEmitter;var n,o=function(t,e){return t.listeners(e).length},a=_$buffer_251({}).Buffer,s=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},u=_$empty_216({});n=u&&u.debuglog?u.debuglog("stream"):function(){};var h,f,c,l=_$state_473.getHighWaterMark,d=_$errorsBrowser_461.codes,p=d.ERR_INVALID_ARG_TYPE,_=d.ERR_STREAM_PUSH_AFTER_EOF,m=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;_$inherits_browser_375(w,_$streamBrowser_474);var y=_$destroy_469.errorOrDestroy,b=["error","close","destroy","pause","resume"];function v(t,e,r){i=i||_$Duplex_462({}),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=l(this,t,"readableHighWaterMark",r),this.buffer=new _$buffer_list_468,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=_$string_decoder_475({}).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function w(t){if(i=i||_$Duplex_462({}),!(this instanceof w))return new w(t);var e=this instanceof i;this._readableState=new v(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_474.call(this)}function M(t,e,r,i,o){n("readableAddChunk",e);var u,h=t._readableState;if(null===e)h.reading=!1,function(t,e){if(n("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?S(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,A(t)))}}(t,h);else if(o||(u=function(t,e){var r,i;return i=e,a.isBuffer(i)||i instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new p("chunk",["string","Buffer","Uint8Array"],e)),r}(h,e)),u)y(t,u);else if(h.objectMode||e&&e.length>0)if("string"==typeof e||h.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)h.endEmitted?y(t,new g):$(t,h,e,!0);else if(h.ended)y(t,new _);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!r?(e=h.decoder.write(e),h.objectMode||0!==e.length?$(t,h,e,!1):B(t,h)):$(t,h,e,!1)}else i||(h.reading=!1,B(t,h));return!h.ended&&(h.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var r=t._readableState;n("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(n("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(A,t))}function A(t){var e=t._readableState;n("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,P(t)}function B(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(k,t,r))}function k(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function x(t){n("readable nexttick read 0"),t.read(0)}function I(t,e){n("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),P(t),e.flowing&&!e.reading&&t.read(0)}function P(t){var e=t._readableState;for(n("flow",e.flowing);e.flowing&&null!==t.read(););}function R(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function C(t){var r=t._readableState;n("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(O,r,t))}function O(t,e){if(n("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function N(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return n("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):S(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&C(this),null;var i,o=e.needReadable;return n("need readable",o),(0===e.length||e.length-t0?R(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&C(this)),null!==i&&this.emit("data",i),i},w.prototype._read=function(t){y(this,new m("_read()"))},w.prototype.pipe=function(t,r){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,n("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===e.stdout||t===e.stderr?_:u;function u(){n("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",(function e(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",h),t.removeListener("error",l),t.removeListener("unpipe",e),i.removeListener("end",u),i.removeListener("end",_),i.removeListener("data",c),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,P(t))}}(i);t.on("drain",h);var f=!1;function c(e){n("ondata");var r=t.write(e);n("dest.write",r),!1===r&&((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==N(a.pipes,t))&&!f&&(n("false write response, pause",a.awaitDrain),a.awaitDrain++),i.pause())}function l(e){n("onerror",e),_(),t.removeListener("error",l),0===o(t,"error")&&y(t,e)}function d(){t.removeListener("finish",p),_()}function p(){n("onfinish"),t.removeListener("close",d),_()}function _(){n("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,l),t.once("close",d),t.once("finish",p),t.emit("pipe",i),a.flowing||(n("pipe resume"),i.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==o.flowing&&this.resume()):"readable"===t&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,n("on readable",o.length,o.reading),o.length?S(this):o.reading||e.nextTick(x,this))),i},w.prototype.addListener=w.prototype.on,w.prototype.removeListener=function(t,r){var i=_$streamBrowser_474.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(T,this),i},w.prototype.removeAllListeners=function(t){var r=_$streamBrowser_474.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(T,this),r},w.prototype.resume=function(){var t=this._readableState;return t.flowing||(n("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(I,t,r))}(this,t)),t.paused=!1,this},w.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},w.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var o in t.on("end",(function(){if(n("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){n("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(e.push(o)||(i=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var a=0;a>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}})),_$Duplex_462=createModuleFactory((function(t,e){(function(e){(function(){"use strict";var r=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=u;var i=_$_stream_readable_464({}),n=_$_stream_writable_466({});_$inherits_browser_375(u,i);for(var o=r(n.prototype),a=0;a-1))throw new y(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(t,e,r){r(new l("_write()"))},M.prototype._writev=null,M.prototype.end=function(t,r,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,r=null):"function"==typeof r&&(i=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,i){r.ending=!0,k(t,r),i&&(r.finished?e.nextTick(i):t.once("finish",i)),r.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),M.prototype.destroy=_$destroy_469.destroy,M.prototype._undestroy=_$destroy_469.undestroy,M.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,_$browser_401,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$empty_216=createModuleFactory((function(t,e){})),_$buffer_251=createModuleFactory((function(t,e){(function(t){(function(){"use strict";e.Buffer=r,e.SlowBuffer=function(t){return+t!=t&&(t=0),r.alloc(+t)},e.INSPECT_MAX_BYTES=50;function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=r.prototype,e}function r(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return o(t)}return i(t,e,r)}function i(e,i,n){if("string"==typeof e)return function(e,i){if("string"==typeof i&&""!==i||(i="utf8"),!r.isEncoding(i))throw new TypeError("Unknown encoding: "+i);var n=0|u(e,i),o=t(n),a=o.write(e,i);return a!==n&&(o=o.slice(0,a)),o}(e,i);if(ArrayBuffer.isView(e))return a(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer))return function(t,e,i){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function u(t,e){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||O(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var i=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return P(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return R(t).length;default:if(o)return n?-1:P(t).length;e=(""+e).toLowerCase(),o=!0}}function h(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function f(t,e,i,n,o){if(0===t.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),N(i=+i)&&(i=o?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(o)return-1;i=t.length-1}else if(i<0){if(!o)return-1;i=0}if("string"==typeof e&&(e=r.from(e,n)),r.isBuffer(e))return 0===e.length?-1:c(t,e,i,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):c(t,[e],i,n,o);throw new TypeError("val must be string, number or Buffer")}function c(t,e,r,i,n){var o,a=1,s=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function h(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var f=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var c=!0,l=0;ln&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var a=0;a>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function y(t,e,r){return 0===e&&r===t.length?_$base64Js_151.fromByteArray(t):_$base64Js_151.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[n+1]))&&(u=(31&h)<<6|63&o)>127&&(f=u);break;case 3:o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(u=(15&h)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&h)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=c}return function(t){var e=t.length;if(e<=v)return String.fromCharCode.apply(String,t);for(var r="",i=0;ithis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return $(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return w(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return y(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),""},r.prototype.compare=function(t,e,i,n,o){if(O(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||i>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=i)return 0;if(n>=o)return-1;if(e>=i)return 1;if(this===t)return 0;for(var a=(o>>>=0)-(n>>>=0),s=(i>>>=0)-(e>>>=0),u=Math.min(a,s),h=this.slice(n,o),f=t.slice(e,i),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return l(this,t,e,r);case"utf8":case"utf-8":return d(this,t,e,r);case"ascii":return p(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var v=4096;function w(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function A(t,e,i,n,o,a){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function B(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function k(t,e,r,i,n){return e=+e,r>>>=0,n||B(t,0,r,4),_$ieee754_374.write(t,e,r,i,23,4),r+4}function T(t,e,r,i,n){return e=+e,r>>>=0,n||B(t,0,r,8),_$ieee754_374.write(t,e,r,i,52,8),r+8}r.prototype.slice=function(t,e){var i=this.length;(t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e>>=0,e>>>=0,r||S(t,e,this.length);for(var i=this[t],n=1,o=0;++o>>=0,e>>>=0,r||S(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},r.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},r.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),_$ieee754_374.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),_$ieee754_374.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),_$ieee754_374.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),_$ieee754_374.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||A(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,i||A(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},r.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,1,255,0),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},r.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);A(this,t,e,r,n-1,-n)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},r.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);A(this,t,e,r,n-1,-n)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},r.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},r.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeFloatLE=function(t,e,r){return k(this,t,e,!0,r)},r.prototype.writeFloatBE=function(t,e,r){return k(this,t,e,!1,r)},r.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},r.prototype.writeDoubleBE=function(t,e,r){return T(this,t,e,!1,r)},r.prototype.copy=function(t,e,i,n){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+i];else Uint8Array.prototype.set.call(t,this.subarray(i,n),e);return o},r.prototype.fill=function(t,e,i,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,i=this.length):"string"==typeof i&&(n=i,i=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function R(t){return _$base64Js_151.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function C(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function O(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function N(t){return t!=t}}).call(this)}).call(this,_$buffer_251({}).Buffer)})),_$base64Js_151={toByteArray:function(t){var e,r,i=getLens(t),n=i[0],o=i[1],a=new Arr(function(t,e,r){return 3*(e+r)/4-r}(0,n,o)),s=0,u=o>0?n-4:n;for(r=0;r>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===o&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,a[s++]=255&e),1===o&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a},fromByteArray:function(t){for(var e,r=t.length,i=r%3,n=[],o=0,a=r-i;oa?a:o+16383));return 1===i?(e=t[r-1],n.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],n.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),n.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function encodeChunk(t,e,r){for(var i,n,o=[],a=e;a>18&63]+lookup[n>>12&63]+lookup[n>>6&63]+lookup[63&n]);return o.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_374={read:function(t,e,r,i,n){var o,a,s=8*n-i-1,u=(1<>1,f=-7,c=r?n-1:0,l=r?-1:1,d=t[e+c];for(c+=l,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+t[e+c],c+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=i;f>0;a=256*a+t[e+c],c+=l,f-=8);if(0===o)o=1-h;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,i),o-=h}return(d?-1:1)*a*Math.pow(2,o-i)},write:function(t,e,r,i,n,o){var a,s,u,h=8*o-n-1,f=(1<>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,p=i?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=f?(s=0,a=f):a+c>=1?(s=(e*u-1)*Math.pow(2,n),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;t[r+d]=255&s,d+=p,s/=256,n-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,h-=8);t[r+d-p]|=128*_}},_$safeBuffer_431={},buffer=_$buffer_251({}),Buffer=buffer.Buffer;function copyProps(t,e){for(var r in t)e[r]=t[r]}function SafeBuffer(t,e,r){return Buffer(t,e,r)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?_$safeBuffer_431=buffer:(copyProps(buffer,_$safeBuffer_431),_$safeBuffer_431.Buffer=SafeBuffer),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return Buffer(t,e,r)},SafeBuffer.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=Buffer(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return Buffer(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(t)};var __Buffer_212=_$safeBuffer_431.Buffer,_$bip66_212={check:function(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 e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;var r=t[5+e];return!(0===r||6+e+r!==t.length||128&t[4]||e>1&&0===t[4]&&!(128&t[5])||128&t[e+6]||r>1&&0===t[e+6]&&!(128&t[e+7]))},decode:function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");var e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");var r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},encode:function(t,e){var r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");var n=__Buffer_212.allocUnsafe(6+r+i);return n[0]=48,n[1]=n.length-2,n[2]=2,n[3]=t.length,t.copy(n,4),n[4+r]=2,n[5+r]=e.length,e.copy(n,6+r),n}},_$index_45={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKDATASIG:186,OP_CHECKDATASIGVERIFY:187,OP_REVERSEBYTES:188,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};function encodingLength(t){return t<_$index_45.OP_PUSHDATA1?1:t<=255?2:t<=65535?3:5}var _$pushdataBitcoin_104={encodingLength:encodingLength,encode:function(t,e,r){var i=encodingLength(e);return 1===i?t.writeUInt8(e,r):2===i?(t.writeUInt8(_$index_45.OP_PUSHDATA1,r),t.writeUInt8(e,r+1)):3===i?(t.writeUInt8(_$index_45.OP_PUSHDATA2,r),t.writeUInt16LE(e,r+1)):(t.writeUInt8(_$index_45.OP_PUSHDATA4,r),t.writeUInt32LE(e,r+1)),i},decode:function(t,e){var r,i,n=t.readUInt8(e);if(n<_$index_45.OP_PUSHDATA1)r=n,i=1;else if(n===_$index_45.OP_PUSHDATA1){if(e+2>t.length)return null;r=t.readUInt8(e+1),i=2}else if(n===_$index_45.OP_PUSHDATA2){if(e+3>t.length)return null;r=t.readUInt16LE(e+1),i=3}else{if(e+5>t.length)return null;if(n!==_$index_45.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=t.readUInt32LE(e+1),i=5}return{opcode:n,number:r,size:i}}},types={Array:function(t){return null!=t&&t.constructor===Array},Boolean:function(t){return"boolean"==typeof t},Function:function(t){return"function"==typeof t},Nil:function(t){return null==t},Number:function(t){return"number"==typeof t},Object:function(t){return"object"==typeof t},String:function(t){return"string"==typeof t},"":function(){return!0}};for(var typeName in types.Null=types.Nil,types)types[typeName].toJSON=function(t){return t}.bind(null,typeName);var _$types_481=types,_$errors_478={};function getTypeName(t){return t.name||t.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName(t){return _$types_481.Nil(t)?"":getTypeName(t.constructor)}function captureStackTrace(t,e){Error.captureStackTrace&&Error.captureStackTrace(t,e)}function tfJSON(t){return _$types_481.Function(t)?t.toJSON?t.toJSON():getTypeName(t):_$types_481.Array(t)?"Array":t&&_$types_481.Object(t)?"Object":void 0!==t?t:""}function tfErrorString(t,e,r){var i=function(t){return _$types_481.Function(t)?"":_$types_481.String(t)?JSON.stringify(t):t&&_$types_481.Object(t)?"":t}(e);return"Expected "+tfJSON(t)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function TfTypeError(t,e,r){r=r||getValueTypeName(e),this.message=tfErrorString(t,e,r),captureStackTrace(this,TfTypeError),this.__type=t,this.__value=e,this.__valueTypeName=r}function TfPropertyTypeError(t,e,r,i,n){t?(n=n||getValueTypeName(i),this.message=function(t,e,r,i,n){var o='" of type ';return"key"===e&&(o='" with key type '),tfErrorString('property "'+tfJSON(r)+o+tfJSON(t),i,n)}(t,r,e,i,n)):this.message='Unexpected property "'+e+'"',captureStackTrace(this,TfTypeError),this.__label=r,this.__property=e,this.__type=t,this.__value=i,this.__valueTypeName=n}function isBuffer(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}TfTypeError.prototype=Object.create(Error.prototype),TfTypeError.prototype.constructor=TfTypeError,TfPropertyTypeError.prototype=Object.create(Error.prototype),TfPropertyTypeError.prototype.constructor=TfTypeError,_$errors_478={TfTypeError:TfTypeError,TfPropertyTypeError:TfPropertyTypeError,tfCustomError:function(t,e){return new TfTypeError(t,{},e)},tfSubError:function(t,e,r){return t instanceof TfPropertyTypeError?(e=e+"."+t.__property,t=new TfPropertyTypeError(t.__type,e,t.__label,t.__value,t.__valueTypeName)):t instanceof TfTypeError&&(t=new TfPropertyTypeError(t.__type,e,r,t.__value,t.__valueTypeName)),captureStackTrace(t),t},tfJSON:tfJSON,getValueTypeName:getValueTypeName};var _$isBuffer_376=function(t){return null!=t&&(isBuffer(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&isBuffer(t.slice(0,0))}(t)||!!t._isBuffer)},_$types_479={};(function(t){(function(){function e(e){return t.isBuffer(e)}function r(t){return"string"==typeof t&&/^([0-9a-f]{2})+$/i.test(t)}function i(t,e){var r=t.toJSON();function i(i){if(!t(i))return!1;if(i.length===e)return!0;throw _$errors_478.tfCustomError(r+"(Length: "+e+")",r+"(Length: "+i.length+")")}return i.toJSON=function(){return r},i}var n=i.bind(null,_$types_481.Array),o=i.bind(null,e),a=i.bind(null,r),s=i.bind(null,_$types_481.String),u=Math.pow(2,53)-1,h={ArrayN:n,Buffer:e,BufferN:o,Finite:function(t){return"number"==typeof t&&isFinite(t)},Hex:r,HexN:a,Int8:function(t){return t<<24>>24===t},Int16:function(t){return t<<16>>16===t},Int32:function(t){return(0|t)===t},Int53:function(t){return"number"==typeof t&&t>=-u&&t<=u&&Math.floor(t)===t},Range:function(t,e,r){function i(i,n){return r(i,n)&&i>t&&i>>0===t},UInt53:function(t){return"number"==typeof t&&t>=0&&t<=u&&Math.floor(t)===t}};for(var f in h)h[f].toJSON=function(t){return t}.bind(null,f);_$types_479=h}).call(this)}).call(this,{isBuffer:_$isBuffer_376});var _$typeforce_480={},__tfJSON_480=_$errors_478.tfJSON,__TfTypeError_480=_$errors_478.TfTypeError,__TfPropertyTypeError_480=_$errors_478.TfPropertyTypeError,tfSubError=_$errors_478.tfSubError,__getValueTypeName_480=_$errors_478.getValueTypeName,TYPES={arrayOf:function(t,e){function r(r,i){return!!_$types_481.Array(r)&&!_$types_481.Nil(r)&&!(void 0!==e.minLength&&r.lengthe.maxLength)&&(void 0===e.length||r.length===e.length)&&r.every((function(e,r){try{return typeforce(t,e,i)}catch(n){throw tfSubError(n,r)}}))}return t=compile(t),e=e||{},r.toJSON=function(){var r="["+__tfJSON_480(t)+"]";return void 0!==e.length?r+="{"+e.length+"}":void 0===e.minLength&&void 0===e.maxLength||(r+="{"+(void 0===e.minLength?0:e.minLength)+","+(void 0===e.maxLength?1/0:e.maxLength)+"}"),r},r},maybe:function t(e){function r(r,i){return _$types_481.Nil(r)||e(r,i,t)}return e=compile(e),r.toJSON=function(){return"?"+__tfJSON_480(e)},r},map:function(t,e){function r(r,i){if(!_$types_481.Object(r))return!1;if(_$types_481.Nil(r))return!1;for(var n in r){try{e&&typeforce(e,n,i)}catch(a){throw tfSubError(a,n,"key")}try{var o=r[n];typeforce(t,o,i)}catch(a){throw tfSubError(a,n)}}return!0}return t=compile(t),e&&(e=compile(e)),r.toJSON=e?function(){return"{"+__tfJSON_480(e)+": "+__tfJSON_480(t)+"}"}:function(){return"{"+__tfJSON_480(t)+"}"},r},object:function(t){var e={};for(var r in t)e[r]=compile(t[r]);function i(t,r){if(!_$types_481.Object(t))return!1;if(_$types_481.Nil(t))return!1;var i;try{for(i in e)typeforce(e[i],t[i],r)}catch(n){throw tfSubError(n,i)}if(r)for(i in t)if(!e[i])throw new __TfPropertyTypeError_480(void 0,i);return!0}return i.toJSON=function(){return __tfJSON_480(e)},i},anyOf:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return t.some((function(t){try{return typeforce(t,e,r)}catch(i){return!1}}))}return e.toJSON=function(){return t.map(__tfJSON_480).join("|")},e},allOf:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return t.every((function(t){try{return typeforce(t,e,r)}catch(i){return!1}}))}return e.toJSON=function(){return t.map(__tfJSON_480).join(" & ")},e},quacksLike:function(t){function e(e){return t===__getValueTypeName_480(e)}return e.toJSON=function(){return t},e},tuple:function(){var t=[].slice.call(arguments).map(compile);function e(e,r){return!_$types_481.Nil(e)&&!_$types_481.Nil(e.length)&&(!r||e.length===t.length)&&t.every((function(t,i){try{return typeforce(t,e[i],r)}catch(n){throw tfSubError(n,i)}}))}return e.toJSON=function(){return"("+t.map(__tfJSON_480).join(", ")+")"},e},value:function(t){function e(e){return e===t}return e.toJSON=function(){return t},e}};function compile(t){if(_$types_481.String(t))return"?"===t[0]?TYPES.maybe(t.slice(1)):_$types_481[t]||TYPES.quacksLike(t);if(t&&_$types_481.Object(t)){if(_$types_481.Array(t)){if(1!==t.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(t[0])}return TYPES.object(t)}return _$types_481.Function(t)?t:TYPES.value(t)}function typeforce(t,e,r,i){if(_$types_481.Function(t)){if(t(e,r))return!0;throw new __TfTypeError_480(i||t,e)}return typeforce(compile(t),e,r)}for(var __typeName_480 in TYPES.oneOf=TYPES.anyOf,_$types_481)typeforce[__typeName_480]=_$types_481[__typeName_480];for(__typeName_480 in TYPES)typeforce[__typeName_480]=TYPES[__typeName_480];for(__typeName_480 in _$types_479)typeforce[__typeName_480]=_$types_479[__typeName_480];typeforce.compile=compile,typeforce.TfTypeError=__TfTypeError_480,typeforce.TfPropertyTypeError=__TfPropertyTypeError_480,_$typeforce_480=typeforce;var UINT31_MAX=Math.pow(2,31)-1;function BIP32Path(t){return _$typeforce_480.String(t)&&t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}BIP32Path.toJSON=function(){return"BIP32 derivation path"};var SATOSHI_MAX=21e14,__BigInt_85=_$typeforce_480.quacksLike("BigInteger"),ECPoint=_$typeforce_480.quacksLike("Point"),ECSignature=_$typeforce_480.compile({r:__BigInt_85,s:__BigInt_85}),Network=_$typeforce_480.compile({messagePrefix:_$typeforce_480.oneOf(_$typeforce_480.Buffer,_$typeforce_480.String),bip32:{public:_$typeforce_480.UInt32,private:_$typeforce_480.UInt32},pubKeyHash:_$typeforce_480.UInt8,scriptHash:_$typeforce_480.UInt8,wif:_$typeforce_480.UInt8}),__types_85={BigInt:__BigInt_85,BIP32Path:BIP32Path,Buffer256bit:_$typeforce_480.BufferN(32),ECPoint:ECPoint,ECSignature:ECSignature,Hash160bit:_$typeforce_480.BufferN(20),Hash256bit:_$typeforce_480.BufferN(32),Network:Network,Satoshi:function(t){return _$typeforce_480.UInt53(t)&&t<=SATOSHI_MAX},UInt31:function(t){return _$typeforce_480.UInt32(t)&&t<=UINT31_MAX}};for(var __typeName_85 in _$typeforce_480)__types_85[__typeName_85]=_$typeforce_480[__typeName_85];var _$types_85=__types_85,map={};for(var op in _$index_45)map[_$index_45[op]]=op;var _$map_46=map,__Buffer_60=_$safeBuffer_431.Buffer,_$script_number_60={decode:function(t,e,r){e=e||4,r=void 0===r||r;var i=t.length;if(0===i)return 0;if(i>e)throw new TypeError("Script number overflow");if(r&&0==(127&t[i-1])&&(i<=1||0==(128&t[i-2])))throw new Error("Non-minimally encoded script number");if(5===i){var n=t.readUInt32LE(0),o=t.readUInt8(4);return 128&o?-(4294967296*(-129&o)+n):4294967296*o+n}for(var a=0,s=0;s2147483647?5:t>8388607?4:t>32767?3:t>127?2:t>0?1:0}(e),i=__Buffer_60.allocUnsafe(r),n=t<0,o=0;o>=8;return 128&i[r-1]?i.writeUInt8(n?128:0,r-1):n&&(i[r-1]|=128),i}},__Buffer_59=_$safeBuffer_431.Buffer,OP_INT_BASE=_$index_45.OP_RESERVED;function isPushOnlyChunk(t){return _$types_85.Buffer(t)||function(t){return _$types_85.Number(t)&&(t===_$index_45.OP_0||t>=_$index_45.OP_1&&t<=_$index_45.OP_16||t===_$index_45.OP_1NEGATE)}(t)}function isPushOnly(t){return _$types_85.Array(t)&&t.every(isPushOnlyChunk)}function asMinimalOP(t){return 0===t.length?_$index_45.OP_0:1===t.length?t[0]>=1&&t[0]<=16?OP_INT_BASE+t[0]:129===t[0]?_$index_45.OP_1NEGATE:void 0:void 0}function __compile_59(t){if(__Buffer_59.isBuffer(t))return t;_$typeforce_480(_$types_85.Array,t);var e=t.reduce((function(t,e){return __Buffer_59.isBuffer(e)?1===e.length&&void 0!==asMinimalOP(e)?t+1:t+_$pushdataBitcoin_104.encodingLength(e.length)+e.length:t+1}),0),r=__Buffer_59.allocUnsafe(e),i=0;if(t.forEach((function(t){if(__Buffer_59.isBuffer(t)){var e=asMinimalOP(t);if(void 0!==e)return r.writeUInt8(e,i),void(i+=1);i+=_$pushdataBitcoin_104.encode(r,t.length,i),t.copy(r,i),i+=t.length}else r.writeUInt8(t,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function decompile(t){if(_$types_85.Array(t))return t;_$typeforce_480(_$types_85.Buffer,t);for(var e=[],r=0;r_$index_45.OP_0&&i<=_$index_45.OP_PUSHDATA4){var n=_$pushdataBitcoin_104.decode(t,r);if(null===n)return[];r+=n.size;var o=t.slice(r,r+n.number);r+=n.number;var a=asMinimalOP(o);void 0!==a?e.push(a):e.push(o)}else e.push(i),r+=1}return e}function isDefinedHashType(t){var e=-193&t;return e>0&&e<4}var _$script_59={compile:__compile_59,compile2:function(t){if(__Buffer_59.isBuffer(t))return t;var e=t.reduce((function(t,e){return __Buffer_59.isBuffer(e)?t+_$pushdataBitcoin_104.encodingLength(e.length)+e.length:t+1}),0),r=__Buffer_59.allocUnsafe(e),i=0;if(t.forEach((function(t,e){__Buffer_59.isBuffer(t)?(i+=_$pushdataBitcoin_104.encode(r,t.length,i),t.copy(r,i),i+=t.length):(r.writeUInt8(t,i),i+=1)})),i!==r.length)throw new Error("Could not decode chunks");return r},decompile:decompile,fromASM:function(t){return _$typeforce_480(_$types_85.String,t),__compile_59(t.split(" ").map((function(t){return void 0!==_$index_45[t]?_$index_45[t]:__Buffer_59.from(t,"hex")})))},toASM:function(t){return __Buffer_59.isBuffer(t)&&(t=decompile(t)),t.map((function(t){if(__Buffer_59.isBuffer(t)){var e=asMinimalOP(t);if(void 0===e)return t.toString("hex");t=e}return _$map_46[t]})).join(" ")},toStack:function(t){return t=decompile(t),_$typeforce_480(isPushOnly,t),t.map((function(t){return __Buffer_59.isBuffer(t)?t:t===_$index_45.OP_0?__Buffer_59.allocUnsafe(0):_$script_number_60.encode(t-OP_INT_BASE)}))},number:_$script_number_60,isCanonicalPubKey:function(t){if(!__Buffer_59.isBuffer(t))return!1;if(t.length<33)return!1;switch(t[0]){case 2:case 3:return 33===t.length;case 4:return 65===t.length}return!1},isCanonicalSignature:function(t){return!!__Buffer_59.isBuffer(t)&&!!isDefinedHashType(t[t.length-1])&&(65===t.length||_$bip66_212.check(t.slice(0,-1)))},isPushOnly:isPushOnly,isDefinedHashType:isDefinedHashType},_$output_64={},__OP_INT_BASE_64=_$index_45.OP_RESERVED;function check(t,e){var r=_$script_59.decompile(t);if(r.length<4)return!1;if(r[r.length-1]!==_$index_45.OP_CHECKMULTISIG)return!1;if(!_$types_85.Number(r[0]))return!1;if(!_$types_85.Number(r[r.length-2]))return!1;var i=r[0]-__OP_INT_BASE_64,n=r[r.length-2]-__OP_INT_BASE_64;return!(i<=0)&&!(n>16)&&!(i>n)&&n===r.length-3&&(!!e||r.slice(1,-2).every(_$script_59.isCanonicalPubKey))}check.toJSON=function(){return"multi-sig output"},_$output_64={check:check,decode:function(t,e){var r=_$script_59.decompile(t);return _$typeforce_480(check,r,e),{m:r[0]-__OP_INT_BASE_64,pubKeys:r.slice(1,-2)}},encode:function(t,e){_$typeforce_480({m:_$types_85.Number,pubKeys:[_$script_59.isCanonicalPubKey]},{m:t,pubKeys:e});var r=e.length;if(rr.pubKeys.length)throw new TypeError("Too many signatures provided")}return[].concat(EMPTY_BUFFER,t.map((function(t){return t===_$index_45.OP_0?EMPTY_BUFFER:t})))}function decodeStack(t,e){return _$typeforce_480(_$typeforce_480.Array,t),_$typeforce_480(__check_63,t,e),t.slice(1)}var _$input_63={check:__check_63,decode:function(t,e){return decodeStack(_$script_59.decompile(t),e)},decodeStack:decodeStack,encode:function(t,e){return _$script_59.compile(encodeStack(t,e))},encodeStack:encodeStack},_$multisig_62={input:_$input_63,output:_$output_64},_$nulldata_65={};function __check_65(t){var e=_$script_59.compile(t);return e.length>1&&e[0]===_$index_45.OP_RETURN}__check_65.toJSON=function(){return"null data output"},_$nulldata_65={output:{check:__check_65,decode:function(t){return _$typeforce_480(__check_65,t),t.slice(2)},encode:function(t){return _$typeforce_480(_$types_85.Buffer,t),_$script_59.compile([_$index_45.OP_RETURN,t])}}};var _$input_67={};function __check_67(t){var e=_$script_59.decompile(t);return 1===e.length&&_$script_59.isCanonicalSignature(e[0])}function __encodeStack_67(t){return _$typeforce_480(_$script_59.isCanonicalSignature,t),[t]}function __decodeStack_67(t){return _$typeforce_480(_$typeforce_480.Array,t),_$typeforce_480(__check_67,t),t[0]}__check_67.toJSON=function(){return"pubKey input"},_$input_67={check:__check_67,decode:function(t){return __decodeStack_67(_$script_59.decompile(t))},decodeStack:__decodeStack_67,encode:function(t){return _$script_59.compile(__encodeStack_67(t))},encodeStack:__encodeStack_67};var _$output_68={};function __check_68(t){var e=_$script_59.decompile(t);return 2===e.length&&_$script_59.isCanonicalPubKey(e[0])&&e[1]===_$index_45.OP_CHECKSIG}__check_68.toJSON=function(){return"pubKey output"},_$output_68={check:__check_68,decode:function(t){var e=_$script_59.decompile(t);return _$typeforce_480(__check_68,e),e[0]},encode:function(t){return _$typeforce_480(_$script_59.isCanonicalPubKey,t),_$script_59.compile([t,_$index_45.OP_CHECKSIG])}};var _$pubkey_66={input:_$input_67,output:_$output_68},_$input_70={};function __check_70(t){var e=_$script_59.decompile(t);return 2===e.length&&_$script_59.isCanonicalSignature(e[0])&&_$script_59.isCanonicalPubKey(e[1])}function __encodeStack_70(t,e){return _$typeforce_480({signature:_$script_59.isCanonicalSignature,pubKey:_$script_59.isCanonicalPubKey},{signature:t,pubKey:e}),[t,e]}function __decodeStack_70(t){return _$typeforce_480(_$typeforce_480.Array,t),_$typeforce_480(__check_70,t),{signature:t[0],pubKey:t[1]}}__check_70.toJSON=function(){return"pubKeyHash input"},_$input_70={check:__check_70,decode:function(t){return __decodeStack_70(_$script_59.decompile(t))},decodeStack:__decodeStack_70,encode:function(t,e){return _$script_59.compile(__encodeStack_70(t,e))},encodeStack:__encodeStack_70};var _$output_71={};function __check_71(t){var e=_$script_59.compile(t);return 25===e.length&&e[0]===_$index_45.OP_DUP&&e[1]===_$index_45.OP_HASH160&&20===e[2]&&e[23]===_$index_45.OP_EQUALVERIFY&&e[24]===_$index_45.OP_CHECKSIG}__check_71.toJSON=function(){return"pubKeyHash output"},_$output_71={check:__check_71,decode:function(t){return _$typeforce_480(__check_71,t),t.slice(3,23)},encode:function(t){return _$typeforce_480(_$types_85.Hash160bit,t),_$script_59.compile([_$index_45.OP_DUP,_$index_45.OP_HASH160,t,_$index_45.OP_EQUALVERIFY,_$index_45.OP_CHECKSIG])}};var _$pubkeyhash_69={input:_$input_70,output:_$output_71},_$output_79={};function __check_79(t){var e=_$script_59.compile(t);return 22===e.length&&e[0]===_$index_45.OP_0&&20===e[1]}__check_79.toJSON=function(){return"Witness pubKeyHash output"},_$output_79={check:__check_79,decode:function(t){return _$typeforce_480(__check_79,t),t.slice(2)},encode:function(t){return _$typeforce_480(_$types_85.Hash160bit,t),_$script_59.compile([_$index_45.OP_0,t])}};var _$output_82={};function __check_82(t){var e=_$script_59.compile(t);return 34===e.length&&e[0]===_$index_45.OP_0&&32===e[1]}__check_82.toJSON=function(){return"Witness scriptHash output"},_$output_82={check:__check_82,decode:function(t){return _$typeforce_480(__check_82,t),t.slice(2)},encode:function(t){return _$typeforce_480(_$types_85.Hash256bit,t),_$script_59.compile([_$index_45.OP_0,t])}};var _$input_73={},__Buffer_73=_$safeBuffer_431.Buffer;function __check_73(t,e){var r=_$script_59.decompile(t);if(r.length<1)return!1;var i=r[r.length-1];if(!__Buffer_73.isBuffer(i))return!1;var n=_$script_59.decompile(_$script_59.compile(r.slice(0,-1))),o=_$script_59.decompile(i);return 0!==o.length&&!!_$script_59.isPushOnly(n)&&(1===r.length?_$output_82.check(o)||_$output_79.check(o):!(!_$pubkeyhash_69.input.check(n)||!_$pubkeyhash_69.output.check(o))||!(!_$multisig_62.input.check(n,e)||!_$multisig_62.output.check(o))||!(!_$pubkey_66.input.check(n)||!_$pubkey_66.output.check(o)))}function __encodeStack_73(t,e){var r=_$script_59.compile(e);return[].concat(t,r)}function __decodeStack_73(t){return _$typeforce_480(_$typeforce_480.Array,t),_$typeforce_480(__check_73,t),{redeemScriptStack:t.slice(0,-1),redeemScript:t[t.length-1]}}__check_73.toJSON=function(){return"scriptHash input"},_$input_73={check:__check_73,decode:function(t){var e=__decodeStack_73(_$script_59.decompile(t));return e.redeemScriptSig=_$script_59.compile(e.redeemScriptStack),delete e.redeemScriptStack,e},decodeStack:__decodeStack_73,encode:function(t,e){var r=_$script_59.decompile(t);return _$script_59.compile(__encodeStack_73(r,e))},encodeStack:__encodeStack_73};var _$output_74={};function __check_74(t){var e=_$script_59.compile(t);return 23===e.length&&e[0]===_$index_45.OP_HASH160&&20===e[1]&&e[22]===_$index_45.OP_EQUAL}__check_74.toJSON=function(){return"scriptHash output"},_$output_74={check:__check_74,decode:function(t){return _$typeforce_480(__check_74,t),t.slice(2,22)},encode:function(t){return _$typeforce_480(_$types_85.Hash160bit,t),_$script_59.compile([_$index_45.OP_HASH160,t,_$index_45.OP_EQUAL])}};var _$scripthash_72={input:_$input_73,output:_$output_74},_$input_78={};function isCompressedCanonicalPubKey(t){return _$script_59.isCanonicalPubKey(t)&&33===t.length}function __check_78(t){var e=_$script_59.decompile(t);return 2===e.length&&_$script_59.isCanonicalSignature(e[0])&&isCompressedCanonicalPubKey(e[1])}__check_78.toJSON=function(){return"witnessPubKeyHash input"},_$input_78={check:__check_78,decodeStack:function(t){return _$typeforce_480(_$typeforce_480.Array,t),_$typeforce_480(__check_78,t),{signature:t[0],pubKey:t[1]}},encodeStack:function(t,e){return _$typeforce_480({signature:_$script_59.isCanonicalSignature,pubKey:isCompressedCanonicalPubKey},{signature:t,pubKey:e}),[t,e]}};var _$witnesspubkeyhash_77={input:_$input_78,output:_$output_79},_$input_81={};(function(t){(function(){function e(e,r){if(_$typeforce_480(_$types_85.Array,e),e.length<1)return!1;var i=e[e.length-1];if(!t.isBuffer(i))return!1;var n=_$script_59.decompile(i);if(0===n.length)return!1;var o=_$script_59.compile(e.slice(0,-1));return!(!_$pubkeyhash_69.input.check(o)||!_$pubkeyhash_69.output.check(n))||!(!_$multisig_62.input.check(o,r)||!_$multisig_62.output.check(n))||!(!_$pubkey_66.input.check(o)||!_$pubkey_66.output.check(n))}e.toJSON=function(){return"witnessScriptHash input"},_$input_81={check:e,decodeStack:function(t){return _$typeforce_480(_$typeforce_480.Array,t),_$typeforce_480(e,t),{witnessData:t.slice(0,-1),witnessScript:t[t.length-1]}},encodeStack:function(t,e){return _$typeforce_480({witnessData:[_$types_85.Buffer],witnessScript:_$types_85.Buffer},{witnessData:t,witnessScript:e}),[].concat(t,e)}}}).call(this)}).call(this,{isBuffer:_$isBuffer_376});var _$witnessscripthash_80={input:_$input_81,output:_$output_82},_$output_76={},__Buffer_76=_$safeBuffer_431.Buffer,HEADER=__Buffer_76.from("aa21a9ed","hex");function __check_76(t){var e=_$script_59.compile(t);return e.length>37&&e[0]===_$index_45.OP_RETURN&&36===e[1]&&e.slice(2,6).equals(HEADER)}__check_76.toJSON=function(){return"Witness commitment output"},_$output_76={check:__check_76,decode:function(t){return _$typeforce_480(__check_76,t),_$script_59.decompile(t)[1].slice(4,36)},encode:function(t){_$typeforce_480(_$types_85.Hash256bit,t);var e=__Buffer_76.allocUnsafe(36);return HEADER.copy(e,0),t.copy(e,4),_$script_59.compile([_$index_45.OP_RETURN,e])}};for(var _$witnesscommitment_75={output:_$output_76},__decompile_61=_$script_59.decompile,__types_61={MULTISIG:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"},_$templates_61={classifyInput:function(t,e){var r=__decompile_61(t);return _$pubkeyhash_69.input.check(r)?__types_61.P2PKH:_$scripthash_72.input.check(r,e)?__types_61.P2SH:_$multisig_62.input.check(r,e)?__types_61.MULTISIG:_$pubkey_66.input.check(r)?__types_61.P2PK:__types_61.NONSTANDARD},classifyOutput:function(t){if(_$witnesspubkeyhash_77.output.check(t))return __types_61.P2WPKH;if(_$witnessscripthash_80.output.check(t))return __types_61.P2WSH;if(_$pubkeyhash_69.output.check(t))return __types_61.P2PKH;if(_$scripthash_72.output.check(t))return __types_61.P2SH;var e=__decompile_61(t);return _$multisig_62.output.check(e)?__types_61.MULTISIG:_$pubkey_66.output.check(e)?__types_61.P2PK:_$witnesscommitment_75.output.check(e)?__types_61.WITNESS_COMMITMENT:_$nulldata_65.output.check(e)?__types_61.NULLDATA:__types_61.NONSTANDARD},classifyWitness:function(t,e){var r=__decompile_61(t);return _$witnesspubkeyhash_77.input.check(r)?__types_61.P2WPKH:_$witnessscripthash_80.input.check(r,e)?__types_61.P2WSH:__types_61.NONSTANDARD},multisig:_$multisig_62,nullData:_$nulldata_65,pubKey:_$pubkey_66,pubKeyHash:_$pubkeyhash_69,scriptHash:_$scripthash_72,witnessPubKeyHash:_$witnesspubkeyhash_77,witnessScriptHash:_$witnessscripthash_80,witnessCommitment:_$witnesscommitment_75,types:__types_61},ALPHABET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={},z=0;z>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function prefixChk(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=polymodStep(e)^i>>5}for(e=polymodStep(e),r=0;re)return"Exceeds length limit";var r=t.toLowerCase(),i=t.toUpperCase();if(t!==r&&t!==i)return"Mixed-case string "+t;var n=(t=r).lastIndexOf("1");if(-1===n)return"No separator character for "+t;if(0===n)return"Missing prefix for "+t;var o=t.slice(0,n),a=t.slice(n+1);if(a.length<6)return"Data too short";var s=prefixChk(o);if("string"==typeof s)return s;for(var u=[],h=0;h=a.length||u.push(c)}return 1!==s?"Invalid checksum for "+t:{prefix:o,words:u}}function convert(t,e,r,i){for(var n=0,o=0,a=(1<=r;)o-=r,s.push(n>>o&a);if(i)o>0&&s.push(n<=e)return"Excess padding";if(n<r)throw new TypeError("Exceeds length limit");var i=prefixChk(t=t.toLowerCase());if("string"==typeof i)throw new Error(i);for(var n=t+"1",o=0;o>5!=0)throw new Error("Non 5-bit word");i=polymodStep(i)^a,n+=ALPHABET.charAt(a)}for(o=0;o<6;++o)i=polymodStep(i);for(i^=1,o=0;o<6;++o){var s=i>>5*(5-o)&31;n+=ALPHABET.charAt(s)}return n},toWords:function(t){var e=convert(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWords:function(t){var e=convert(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}},_$inherits_browser_375={};_$inherits_browser_375="function"==typeof Object.create?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var _$events_349={},ReflectOwnKeys,R="object"==typeof Reflect?Reflect:null,ReflectApply=R&&"function"==typeof R.apply?R.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};ReflectOwnKeys=R&&"function"==typeof R.ownKeys?R.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var NumberIsNaN=Number.isNaN||function(t){return t!=t};function EventEmitter(){EventEmitter.init.call(this)}_$events_349=EventEmitter,_$events_349.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,o),i(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}eventTargetAgnosticAddListener(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&eventTargetAgnosticAddListener(t,"error",e,{once:!0})}(t,n)}))},EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function _getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function _addListener(t,e,r,i){var n,o,a,s;if(checkListener(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]),void 0===a)a=o[e]=r,++t._eventsCount;else if("function"==typeof a?a=o[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(n=_getMaxListeners(t))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function _onceWrap(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(i);return n.listener=r,i.wrapFn=n,n}function _listeners(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=n[t];if(void 0===s)return!1;if("function"==typeof s)ReflectApply(s,this,e);else{var u=s.length,h=arrayClone(s,u);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},EventEmitter.prototype.listeners=function(t){return _listeners(this,t,!0)},EventEmitter.prototype.rawListeners=function(t){return _listeners(this,t,!1)},EventEmitter.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):listenerCount.call(t,e)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};var _$streamBrowser_474=_$events_349.EventEmitter;function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function _objectSpread(t){for(var e=1;e0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return __Buffer_468.alloc(0);for(var e,r,i,n=__Buffer_468.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=n,i=a,__Buffer_468.prototype.copy.call(e,r,i),a+=o.data.length,o=o.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(o===n.length?i+=n:i+=n.slice(0,t),0==(t-=o)){o===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(o));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=__Buffer_468.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,o=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,o),0==(t-=o)){o===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(o));break}++i}return this.length-=i,e}},{key:custom,value:function(t,e){return inspect(this,_objectSpread(_objectSpread({},e),{},{depth:0,customInspect:!1}))}}])&&_defineProperties(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),_$browser_401={},cachedSetTimeout,cachedClearTimeout,process=_$browser_401={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(t){if(cachedSetTimeout===setTimeout)return setTimeout(t,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(t,0);try{return cachedSetTimeout(t,0)}catch(e){try{return cachedSetTimeout.call(null,t,0)}catch(e){return cachedSetTimeout.call(this,t,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(t){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(t){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var t=runTimeout(cleanUpNextTick);draining=!0;for(var e=queue.length;e;){for(currentQueue=queue,queue=[];++queueIndex1)for(var r=1;r2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}createErrorType("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,a;if("string"==typeof e&&("not ","not "===e.substr(0,"not ".length))?(i="must not be",e=e.replace(/^not /,"")):i="must be",o=t,(void 0===a||a>o.length)&&(a=o.length)," argument"===o.substring(a-" argument".length,a))n="The ".concat(t," ").concat(i," ").concat(oneOf(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+".".length>t.length)&&-1!==t.indexOf(".",r)}(t)?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(oneOf(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),_$errorsBrowser_461.codes=codes;var ERR_INVALID_OPT_VALUE=_$errorsBrowser_461.codes.ERR_INVALID_OPT_VALUE,_$state_473={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new ERR_INVALID_OPT_VALUE(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},_$browser_482={};(function(t){(function(){function e(e){try{if(!t.localStorage)return!1}catch(i){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}_$browser_482=function(t,r){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$safeBuffer_476={},__buffer_476=_$buffer_251({}),__Buffer_476=__buffer_476.Buffer;function __copyProps_476(t,e){for(var r in t)e[r]=t[r]}function __SafeBuffer_476(t,e,r){return __Buffer_476(t,e,r)}__Buffer_476.from&&__Buffer_476.alloc&&__Buffer_476.allocUnsafe&&__Buffer_476.allocUnsafeSlow?_$safeBuffer_476=__buffer_476:(__copyProps_476(__buffer_476,_$safeBuffer_476),_$safeBuffer_476.Buffer=__SafeBuffer_476),__SafeBuffer_476.prototype=Object.create(__Buffer_476.prototype),__copyProps_476(__Buffer_476,__SafeBuffer_476),__SafeBuffer_476.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return __Buffer_476(t,e,r)},__SafeBuffer_476.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=__Buffer_476(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},__SafeBuffer_476.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __Buffer_476(t)},__SafeBuffer_476.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __buffer_476.SlowBuffer(t)};var _$Transform_465=Transform,_require$codes=_$errorsBrowser_461.codes,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_TRANSFORM_ALREADY_TRANSFORMING=_require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,ERR_TRANSFORM_WITH_LENGTH_0=_require$codes.ERR_TRANSFORM_WITH_LENGTH_0,Duplex=_$Duplex_462({});function afterTransform(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new ERR_MULTIPLE_CALLBACK);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length0,(function(t){i||(i=t),t&&o.forEach(call),a||(o.forEach(call),n(i))}))}));return e.reduce(pipe)},_$Stream_460=Stream,EE=_$events_349.EventEmitter;function Stream(){EE.call(this)}_$inherits_browser_375(Stream,EE),Stream.Readable=_$_stream_readable_464({}),Stream.Writable=_$_stream_writable_466({}),Stream.Duplex=_$Duplex_462({}),Stream.Transform=_$Transform_465,Stream.PassThrough=_$PassThrough_463,Stream.finished=_$eos_470({}),Stream.pipeline=_$pipeline_472,Stream.Stream=Stream,Stream.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function n(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",n),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",s));var o=!1;function a(){o||(o=!0,t.end())}function s(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(h(),0===EE.listenerCount(this,"error"))throw t}function h(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",h),r.removeListener("close",h),t.removeListener("close",h)}return r.on("error",u),t.on("error",u),r.on("end",h),r.on("close",h),t.on("close",h),t.emit("pipe",r),t};var _$hashBase_359={},__Buffer_359=_$safeBuffer_431.Buffer,__Transform_359=_$Stream_460.Transform;function HashBase(t){__Transform_359.call(this),this._block=__Buffer_359.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}_$inherits_browser_375(HashBase,__Transform_359),HashBase.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(n){i=n}r(i)},HashBase.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(r){e=r}t(e)},HashBase.prototype.update=function(t,e){if(function(t,e){if(!__Buffer_359.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer")}(t),this._finalized)throw new Error("Digest already called");__Buffer_359.isBuffer(t)||(t=__Buffer_359.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var n=this._blockOffset;n0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},_$hashBase_359=HashBase;var _$md5Js_379={},__Buffer_379=_$safeBuffer_431.Buffer,ARRAY16=new Array(16);function MD5(){_$hashBase_359.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(t,e){return t<>>32-e}function fnF(t,e,r,i,n,o,a){return rotl(t+(e&r|~e&i)+n+o|0,a)+e|0}function fnG(t,e,r,i,n,o,a){return rotl(t+(e&i|r&~i)+n+o|0,a)+e|0}function fnH(t,e,r,i,n,o,a){return rotl(t+(e^r^i)+n+o|0,a)+e|0}function fnI(t,e,r,i,n,o,a){return rotl(t+(r^(e|~i))+n+o|0,a)+e|0}_$inherits_browser_375(MD5,_$hashBase_359),MD5.prototype._update=function(){for(var t=ARRAY16,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,o=this._d;r=fnF(r,i,n,o,t[0],3614090360,7),o=fnF(o,r,i,n,t[1],3905402710,12),n=fnF(n,o,r,i,t[2],606105819,17),i=fnF(i,n,o,r,t[3],3250441966,22),r=fnF(r,i,n,o,t[4],4118548399,7),o=fnF(o,r,i,n,t[5],1200080426,12),n=fnF(n,o,r,i,t[6],2821735955,17),i=fnF(i,n,o,r,t[7],4249261313,22),r=fnF(r,i,n,o,t[8],1770035416,7),o=fnF(o,r,i,n,t[9],2336552879,12),n=fnF(n,o,r,i,t[10],4294925233,17),i=fnF(i,n,o,r,t[11],2304563134,22),r=fnF(r,i,n,o,t[12],1804603682,7),o=fnF(o,r,i,n,t[13],4254626195,12),n=fnF(n,o,r,i,t[14],2792965006,17),r=fnG(r,i=fnF(i,n,o,r,t[15],1236535329,22),n,o,t[1],4129170786,5),o=fnG(o,r,i,n,t[6],3225465664,9),n=fnG(n,o,r,i,t[11],643717713,14),i=fnG(i,n,o,r,t[0],3921069994,20),r=fnG(r,i,n,o,t[5],3593408605,5),o=fnG(o,r,i,n,t[10],38016083,9),n=fnG(n,o,r,i,t[15],3634488961,14),i=fnG(i,n,o,r,t[4],3889429448,20),r=fnG(r,i,n,o,t[9],568446438,5),o=fnG(o,r,i,n,t[14],3275163606,9),n=fnG(n,o,r,i,t[3],4107603335,14),i=fnG(i,n,o,r,t[8],1163531501,20),r=fnG(r,i,n,o,t[13],2850285829,5),o=fnG(o,r,i,n,t[2],4243563512,9),n=fnG(n,o,r,i,t[7],1735328473,14),r=fnH(r,i=fnG(i,n,o,r,t[12],2368359562,20),n,o,t[5],4294588738,4),o=fnH(o,r,i,n,t[8],2272392833,11),n=fnH(n,o,r,i,t[11],1839030562,16),i=fnH(i,n,o,r,t[14],4259657740,23),r=fnH(r,i,n,o,t[1],2763975236,4),o=fnH(o,r,i,n,t[4],1272893353,11),n=fnH(n,o,r,i,t[7],4139469664,16),i=fnH(i,n,o,r,t[10],3200236656,23),r=fnH(r,i,n,o,t[13],681279174,4),o=fnH(o,r,i,n,t[0],3936430074,11),n=fnH(n,o,r,i,t[3],3572445317,16),i=fnH(i,n,o,r,t[6],76029189,23),r=fnH(r,i,n,o,t[9],3654602809,4),o=fnH(o,r,i,n,t[12],3873151461,11),n=fnH(n,o,r,i,t[15],530742520,16),r=fnI(r,i=fnH(i,n,o,r,t[2],3299628645,23),n,o,t[0],4096336452,6),o=fnI(o,r,i,n,t[7],1126891415,10),n=fnI(n,o,r,i,t[14],2878612391,15),i=fnI(i,n,o,r,t[5],4237533241,21),r=fnI(r,i,n,o,t[12],1700485571,6),o=fnI(o,r,i,n,t[3],2399980690,10),n=fnI(n,o,r,i,t[10],4293915773,15),i=fnI(i,n,o,r,t[1],2240044497,21),r=fnI(r,i,n,o,t[8],1873313359,6),o=fnI(o,r,i,n,t[15],4264355552,10),n=fnI(n,o,r,i,t[6],2734768916,15),i=fnI(i,n,o,r,t[13],1309151649,21),r=fnI(r,i,n,o,t[4],4149444226,6),o=fnI(o,r,i,n,t[11],3174756917,10),n=fnI(n,o,r,i,t[2],718787259,15),i=fnI(i,n,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=__Buffer_379.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},_$md5Js_379=MD5;var _$ripemd160_430={},__Buffer_430=_$buffer_251({}).Buffer,__ARRAY16_430=new Array(16),zl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],zr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sl=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hl=[0,1518500249,1859775393,2400959708,2840853838],hr=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){_$hashBase_359.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function __rotl_430(t,e){return t<>>32-e}function fn1(t,e,r,i,n,o,a,s){return __rotl_430(t+(e^r^i)+o+a|0,s)+n|0}function fn2(t,e,r,i,n,o,a,s){return __rotl_430(t+(e&r|~e&i)+o+a|0,s)+n|0}function fn3(t,e,r,i,n,o,a,s){return __rotl_430(t+((e|~r)^i)+o+a|0,s)+n|0}function fn4(t,e,r,i,n,o,a,s){return __rotl_430(t+(e&i|r&~i)+o+a|0,s)+n|0}function fn5(t,e,r,i,n,o,a,s){return __rotl_430(t+(e^(r|~i))+o+a|0,s)+n|0}_$inherits_browser_375(RIPEMD160,_$hashBase_359),RIPEMD160.prototype._update=function(){for(var t=__ARRAY16_430,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,h=0|this._c,f=0|this._d,c=0|this._e,l=0;l<80;l+=1){var d,p;l<16?(d=fn1(r,i,n,o,a,t[zl[l]],hl[0],sl[l]),p=fn5(s,u,h,f,c,t[zr[l]],hr[0],sr[l])):l<32?(d=fn2(r,i,n,o,a,t[zl[l]],hl[1],sl[l]),p=fn4(s,u,h,f,c,t[zr[l]],hr[1],sr[l])):l<48?(d=fn3(r,i,n,o,a,t[zl[l]],hl[2],sl[l]),p=fn3(s,u,h,f,c,t[zr[l]],hr[2],sr[l])):l<64?(d=fn4(r,i,n,o,a,t[zl[l]],hl[3],sl[l]),p=fn2(s,u,h,f,c,t[zr[l]],hr[3],sr[l])):(d=fn5(r,i,n,o,a,t[zl[l]],hl[4],sl[l]),p=fn1(s,u,h,f,c,t[zr[l]],hr[4],sr[l])),r=a,a=o,o=__rotl_430(n,10),n=i,i=d,s=c,c=f,f=__rotl_430(h,10),h=u,u=p}var _=this._b+n+f|0;this._b=this._c+o+c|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+i+h|0,this._a=_},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=__Buffer_430.alloc?__Buffer_430.alloc(20):new __Buffer_430(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},_$ripemd160_430=RIPEMD160;var _$hash_446={},__Buffer_446=_$safeBuffer_431.Buffer;function Hash(t,e){this._block=__Buffer_446.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Hash.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=__Buffer_446.from(t,e));for(var r=this._block,i=this._blockSize,n=t.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},_$hash_446=Hash;var _$sha_448={},__Buffer_448=_$safeBuffer_431.Buffer,K=[1518500249,1859775393,-1894007588,-899497514],W=new Array(80);function Sha(){this.init(),this._w=W,_$hash_446.call(this,64,56)}function rotl30(t){return t<<30|t>>>2}function ft(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_375(Sha,_$hash_446),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var h=0;h<80;++h){var f=~~(h/20),c=0|((e=i)<<5|e>>>27)+ft(f,n,o,a)+s+r[h]+K[f];s=a,a=o,o=rotl30(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Sha.prototype._hash=function(){var t=__Buffer_448.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},_$sha_448=Sha;var _$sha1_449={},__Buffer_449=_$safeBuffer_431.Buffer,__K_449=[1518500249,1859775393,-1894007588,-899497514],__W_449=new Array(80);function Sha1(){this.init(),this._w=__W_449,_$hash_446.call(this,64,56)}function rotl5(t){return t<<5|t>>>27}function __rotl30_449(t){return t<<30|t>>>2}function __ft_449(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}_$inherits_browser_375(Sha1,_$hash_446),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=t.readInt32BE(4*u);for(;u<80;++u)r[u]=(e=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|e>>>31;for(var h=0;h<80;++h){var f=~~(h/20),c=rotl5(i)+__ft_449(f,n,o,a)+s+r[h]+__K_449[f]|0;s=a,a=o,o=__rotl30_449(n),n=i,i=c}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Sha1.prototype._hash=function(){var t=__Buffer_449.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},_$sha1_449=Sha1;var _$sha256_451={},__Buffer_451=_$safeBuffer_431.Buffer,__K_451=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],__W_451=new Array(64);function Sha256(){this.init(),this._w=__W_451,_$hash_446.call(this,64,56)}function ch(t,e,r){return r^t&(e^r)}function maj(t,e,r){return t&e|r&(t|e)}function sigma0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function sigma1(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function gamma0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}_$inherits_browser_375(Sha256,_$hash_446),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,h=0|this._g,f=0|this._h,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<64;++c)r[c]=0|(((e=r[c-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[c-7]+gamma0(r[c-15])+r[c-16];for(var l=0;l<64;++l){var d=f+sigma1(s)+ch(s,u,h)+__K_451[l]+r[l]|0,p=sigma0(i)+maj(i,n,o)|0;f=h,h=u,u=s,s=a+d|0,a=o,o=n,n=i,i=d+p|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=f+this._h|0},Sha256.prototype._hash=function(){var t=__Buffer_451.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},_$sha256_451=Sha256;var _$sha224_450={},__Buffer_450=_$safeBuffer_431.Buffer,__W_450=new Array(64);function Sha224(){this.init(),this._w=__W_450,_$hash_446.call(this,64,56)}_$inherits_browser_375(Sha224,_$sha256_451),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var t=__Buffer_450.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},_$sha224_450=Sha224;var _$sha512_453={},__Buffer_453=_$safeBuffer_431.Buffer,__K_453=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],__W_453=new Array(160);function Sha512(){this.init(),this._w=__W_453,_$hash_446.call(this,128,112)}function Ch(t,e,r){return r^t&(e^r)}function __maj_453(t,e,r){return t&e|r&(t|e)}function __sigma0_453(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function __sigma1_453(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Gamma0(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Gamma0l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function Gamma1(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Gamma1l(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function getCarry(t,e){return t>>>0>>0?1:0}_$inherits_browser_375(Sha512,_$hash_446),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,h=0|this._hh,f=0|this._al,c=0|this._bl,l=0|this._cl,d=0|this._dl,p=0|this._el,_=0|this._fl,m=0|this._gl,g=0|this._hl,y=0;y<32;y+=2)e[y]=t.readInt32BE(4*y),e[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var b=e[y-30],v=e[y-30+1],w=Gamma0(b,v),M=Gamma0l(v,b),$=Gamma1(b=e[y-4],v=e[y-4+1]),E=Gamma1l(v,b),S=e[y-14],A=e[y-14+1],B=e[y-32],k=e[y-32+1],T=M+A|0,x=w+S+getCarry(T,M)|0;x=(x=x+$+getCarry(T=T+E|0,E)|0)+B+getCarry(T=T+k|0,k)|0,e[y]=x,e[y+1]=T}for(var I=0;I<160;I+=2){x=e[I],T=e[I+1];var P=__maj_453(r,i,n),R=__maj_453(f,c,l),C=__sigma0_453(r,f),O=__sigma0_453(f,r),N=__sigma1_453(a,p),L=__sigma1_453(p,a),D=__K_453[I],U=__K_453[I+1],j=Ch(a,s,u),H=Ch(p,_,m),z=g+L|0,q=h+N+getCarry(z,g)|0;q=(q=(q=q+j+getCarry(z=z+H|0,H)|0)+D+getCarry(z=z+U|0,U)|0)+x+getCarry(z=z+T|0,T)|0;var K=O+R|0,F=C+P+getCarry(K,O)|0;h=u,g=m,u=s,m=_,s=a,_=p,a=o+q+getCarry(p=d+z|0,d)|0,o=n,d=l,n=i,l=c,i=r,c=f,r=q+F+getCarry(f=z+K|0,z)|0}this._al=this._al+f|0,this._bl=this._bl+c|0,this._cl=this._cl+l|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+_|0,this._gl=this._gl+m|0,this._hl=this._hl+g|0,this._ah=this._ah+r+getCarry(this._al,f)|0,this._bh=this._bh+i+getCarry(this._bl,c)|0,this._ch=this._ch+n+getCarry(this._cl,l)|0,this._dh=this._dh+o+getCarry(this._dl,d)|0,this._eh=this._eh+a+getCarry(this._el,p)|0,this._fh=this._fh+s+getCarry(this._fl,_)|0,this._gh=this._gh+u+getCarry(this._gl,m)|0,this._hh=this._hh+h+getCarry(this._hl,g)|0},Sha512.prototype._hash=function(){var t=__Buffer_453.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},_$sha512_453=Sha512;var _$sha384_452={},__Buffer_452=_$safeBuffer_431.Buffer,__W_452=new Array(160);function Sha384(){this.init(),this._w=__W_452,_$hash_446.call(this,128,112)}_$inherits_browser_375(Sha384,_$sha512_453),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){var t=__Buffer_452.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},_$sha384_452=Sha384;var _$shaJs_447={},exports=_$shaJs_447=function(t){t=t.toLowerCase();var e=exports[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};exports.sha=_$sha_448,exports.sha1=_$sha1_449,exports.sha224=_$sha224_450,exports.sha256=_$sha256_451,exports.sha384=_$sha384_452,exports.sha512=_$sha512_453;var _$cipherBase_258={},__Buffer_258=_$safeBuffer_431.Buffer,__Transform_258=_$Stream_460.Transform,__StringDecoder_258=_$string_decoder_475({}).StringDecoder;function CipherBase(t){__Transform_258.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}_$inherits_browser_375(CipherBase,__Transform_258),CipherBase.prototype.update=function(t,e,r){"string"==typeof t&&(t=__Buffer_258.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},CipherBase.prototype.setAutoPadding=function(){},CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},CipherBase.prototype._transform=function(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(n){i=n}finally{r(i)}},CipherBase.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(r){e=r}t(e)},CipherBase.prototype._finalOrDigest=function(t){var e=this.__final()||__Buffer_258.alloc(0);return t&&(e=this._toString(e,t,!0)),e},CipherBase.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new __StringDecoder_258(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},_$cipherBase_258=CipherBase;var _$browser_262={};function __Hash_262(t){_$cipherBase_258.call(this,"digest"),this._hash=t}_$inherits_browser_375(__Hash_262,_$cipherBase_258),__Hash_262.prototype._update=function(t){this._hash.update(t)},__Hash_262.prototype._final=function(){return this._hash.digest()},_$browser_262=function(t){return"md5"===(t=t.toLowerCase())?new _$md5Js_379:"rmd160"===t||"ripemd160"===t?new _$ripemd160_430:new __Hash_262(_$shaJs_447(t))};var _Buffer=_$safeBuffer_431.Buffer,_$src_150=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(o);r>>0,h[l]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");n=c,r++}for(var d=o-n;d!==o&&0===h[d];)d++;var p=_Buffer.allocUnsafe(i+(o-d));p.fill(0,0,i);for(var _=i;d!==o;)p[_++]=h[d++];return p}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=_Buffer.from(e)),!_Buffer.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,n=0,o=e.length;n!==o&&0===e[n];)n++,r++;for(var u=(o-n)*h+1>>>0,f=new Uint8Array(u);n!==o;){for(var c=e[n],l=0,d=u-1;(0!==c||l>>0,f[d]=c%a>>>0,c=c/a>>>0;if(0!==c)throw new Error("Non-zero carry");i=l,n++}for(var p=u-i;p!==u&&0===f[p];)p++;for(var _=s.repeat(r);p21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function fromBech32(t){var e=_$bech32_188.decode(t),r=_$bech32_188.fromWords(e.words.slice(1));return{version:e.words[0],prefix:e.prefix,data:__Buffer_47.from(r)}}function toBase58Check(t,e){_$typeforce_480(_$types_85.tuple(_$types_85.Hash160bit,_$types_85.UInt8),arguments);var r=__Buffer_47.allocUnsafe(21);return r.writeUInt8(e,0),t.copy(r,1),_$bs58check_247.encode(r)}function toBech32(t,e,r){var i=_$bech32_188.toWords(t);return i.unshift(e),_$bech32_188.encode(r,i)}var _$address_47={fromBase58Check:fromBase58Check,fromBech32:fromBech32,fromOutputScript:function(t,e){if(e=e||_$networks_56.bitcoin,_$templates_61.pubKeyHash.output.check(t))return toBase58Check(_$script_59.compile(t).slice(3,23),e.pubKeyHash);if(_$templates_61.scriptHash.output.check(t))return toBase58Check(_$script_59.compile(t).slice(2,22),e.scriptHash);if(_$templates_61.witnessPubKeyHash.output.check(t))return toBech32(_$script_59.compile(t).slice(2,22),0,e.bech32);if(_$templates_61.witnessScriptHash.output.check(t))return toBech32(_$script_59.compile(t).slice(2,34),0,e.bech32);throw new Error(_$script_59.toASM(t)+" has no matching Address")},toBase58Check:toBase58Check,toBech32:toBech32,toOutputScript:function(t,e){var r;e=e||_$networks_56.bitcoin;try{r=fromBase58Check(t)}catch(i){}if(r){if(r.version===e.pubKeyHash)return _$templates_61.pubKeyHash.output.encode(r.hash);if(r.version===e.scriptHash)return _$templates_61.scriptHash.output.encode(r.hash)}else{try{r=fromBech32(t)}catch(i){}if(r){if(r.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return _$templates_61.witnessPubKeyHash.output.encode(r.data);if(32===r.data.length)return _$templates_61.witnessScriptHash.output.encode(r.data)}}}throw new Error(t+" has no matching Script")}};function ripemd160(t){return _$browser_262("ripemd160").update(t).digest()}function sha256(t){return _$browser_262("sha256").update(t).digest()}var _$crypto_50={hash160:function(t){return ripemd160(sha256(t))},hash256:function(t){return sha256(sha256(t))},ripemd160:ripemd160,sha1:function(t){return _$browser_262("sha1").update(t).digest()},sha256:sha256},_$package_193={version:"1.4.2"},_$bigi_190={};function BigInteger(t,e,r){if(!(this instanceof BigInteger))return new BigInteger(t,e,r);null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}var proto=BigInteger.prototype;proto.__bigi=_$package_193.version,BigInteger.isBigInteger=function(t,e){return t&&t.__bigi&&(!e||t.__bigi===proto.__bigi)},BigInteger.prototype.am=function(t,e,r,i,n,o){for(;--o>=0;){var a=e*this[t++]+r[i]+n;n=Math.floor(a/67108864),r[i++]=67108863&a}return n},BigInteger.prototype.DB=26,BigInteger.prototype.DM=67108863;var DV=BigInteger.prototype.DV=1<<26;BigInteger.prototype.FV=Math.pow(2,52),BigInteger.prototype.F1=26,BigInteger.prototype.F2=0;var rr,vv,BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array;for(rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){var r=BI_RC[t.charCodeAt(e)];return null==r?-1:r}function nbv(t){var e=new BigInteger;return e.fromInt(t),e}function nbits(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function Classic(t){this.m=t}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function cbit(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function NullExp(){}function nNop(t){return t}function Barrett(t){this.r2=new BigInteger,this.q3=new BigInteger,BigInteger.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}Classic.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},Classic.prototype.revert=function(t){return t},Classic.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},Classic.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Classic.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},Montgomery.prototype.convert=function(t){var e=new BigInteger;return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(BigInteger.ZERO)>0&&this.m.subTo(e,e),e},Montgomery.prototype.revert=function(t){var e=new BigInteger;return t.copyTo(e),this.reduce(e),e},Montgomery.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},Montgomery.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Montgomery.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},proto.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},proto.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0},proto.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var a=8==r?255&t[i]:intAt(t,i);a<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-o):this[this.t-1]|=a<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},proto.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},proto.drShiftTo=function(t,e){for(var r=t;r=0;--r)e[r+a+1]=this[r]>>n|s,s=(this[r]&o)<=0;--r)e[r]=0;e[a]=s,e.t=this.t+a+1,e.s=this.s,e.clamp()},proto.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<>i;for(var a=r+1;a>i;i>0&&(e[this.t-r-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()},proto.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},proto.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(u,o),n.lShiftTo(u,r)):(i.copyTo(o),n.copyTo(r));var h=o.t,f=o[h-1];if(0!=f){var c=f*(1<1?o[h-2]>>this.F2:0),l=this.FV/c,d=(1<=0&&(r[r.t++]=1,r.subTo(g,r)),BigInteger.ONE.dlShiftTo(h,g),g.subTo(o,o);o.t=0;){var y=r[--_]==f?this.DM:Math.floor(r[_]*l+(r[_-1]+p)*d);if((r[_]+=o.am(0,y,r,m,0,h))0&&r.rShiftTo(u,r),a<0&&BigInteger.ZERO.subTo(r,r)}}},proto.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},proto.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},proto.exp=function(t,e){if(t>4294967295||t<1)return BigInteger.ONE;var r=new BigInteger,i=new BigInteger,n=e.convert(this),o=nbits(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var a=r;r=i,i=a}return e.revert(r)},proto.toString=function(t){var e;if(this.s<0)return"-"+this.negate().toString(t);if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<0)for(s>s)>0&&(n=!0,o=int2char(r));a>=0;)s>(s+=this.DB-e)):(r=this[a]>>(s-=e)&i,s<=0&&(s+=this.DB,--a)),r>0&&(n=!0),n&&(o+=int2char(r));return n?o:"0"},proto.negate=function(){var t=new BigInteger;return BigInteger.ZERO.subTo(this,t),t},proto.abs=function(){return this.s<0?this.negate():this},proto.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},proto.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)},proto.byteLength=function(){return this.bitLength()>>3},proto.mod=function(t){var e=new BigInteger;return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(BigInteger.ZERO)>0&&t.subTo(e,e),e},proto.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new Classic(e):new Montgomery(e),this.exp(t,r)},NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},NullExp.prototype.sqrTo=function(t,e){t.squareTo(e)},Barrett.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=new BigInteger;return t.copyTo(e),this.reduce(e),e},Barrett.prototype.revert=function(t){return t},Barrett.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},Barrett.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},Barrett.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];proto.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},proto.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=nbv(r),n=new BigInteger,o=new BigInteger,a="";for(this.divRemTo(i,n,o);n.signum()>0;)a=(r+o.intValue()).toString(t).substr(1)+a,n.divRemTo(i,n,o);return o.intValue().toString(t)+a},proto.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,a=0,s=0;s=r&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(a,0)),n&&BigInteger.ZERO.subTo(this,this)},proto.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()},proto.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},proto.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},proto.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n=0;)r[i]=0;for(i=Math.max(e-this.t,0);i0)if(0==e)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r},proto.millerRabin=function(t){var e=this.subtract(BigInteger.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);(t=t+1>>1)>lowprimes.length&&(t=lowprimes.length);for(var n=new BigInteger(null),o=[],a=0;a>24},proto.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},proto.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},proto.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<=0;)i<8?(r=(this[t]&(1<>(i+=this.DB-8)):(r=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0===n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},proto.equals=function(t){return 0==this.compareTo(t)},proto.min=function(t){return this.compareTo(t)<0?this:t},proto.max=function(t){return this.compareTo(t)>0?this:t},proto.and=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_and,e),e},proto.or=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_or,e),e},proto.xor=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_xor,e),e},proto.andNot=function(t){var e=new BigInteger;return this.bitwiseTo(t,op_andnot,e),e},proto.not=function(){for(var t=new BigInteger,e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var f=new BigInteger;for(i.sqrTo(a[1],f);s<=h;)a[s]=new BigInteger,i.mulTo(f,a[s-2],a[s]),s+=2}var c,l,d=t.t-1,p=!0,_=new BigInteger;for(n=nbits(t[d])-1;d>=0;){for(n>=u?c=t[d]>>n-u&h:(c=(t[d]&(1<0&&(c|=t[d-1]>>this.DB+n-u)),s=r;0==(1&c);)c>>=1,--s;if((n-=s)<0&&(n+=this.DB,--d),p)a[c].copyTo(o),p=!1;else{for(;s>1;)i.sqrTo(o,_),i.sqrTo(_,o),s-=2;s>0?i.sqrTo(o,_):(l=o,o=_,_=l),i.mulTo(_,a[c],o)}for(;d>=0&&0==(t[d]&1<=0?(r.subTo(i,r),e&&n.subTo(a,n),o.subTo(s,o)):(i.subTo(r,i),e&&a.subTo(n,a),s.subTo(o,s))}if(0!=i.compareTo(BigInteger.ONE))return BigInteger.ZERO;for(;s.compareTo(t)>=0;)s.subTo(t,s);for(;s.signum()<0;)s.addTo(t,s);return s},proto.pow=function(t){return this.exp(t,new NullExp)},proto.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(n0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},proto.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=lowprimes[lowprimes.length-1]){for(e=0;e=4)throw new Error("Invalid hashType "+r);return{signature:e.fromDER(t.slice(0,-1)),hashType:r}},e.prototype.toCompact=function(e,r){r&&(e+=4),e+=27;var i=t.alloc(65);return i.writeUInt8(e,0),this.toRSBuffer(i,1),i},e.prototype.toDER=function(){var e=t.from(this.r.toDERInteger()),r=t.from(this.s.toDERInteger());return _$bip66_212.encode(e,r)},e.prototype.toRSBuffer=function(e,r){return r||(r=0),e=e||t.alloc(64),this.r.toBuffer(32).copy(e,r),this.s.toBuffer(32).copy(e,r+32),e},e.prototype.toScriptSignature=function(r,i){i||(i=e.ECDSA);var n=-193&r;if(n<=0||n>=4)throw new Error("Invalid hashType "+r);var o=t.alloc(1);if(o.writeUInt8(r,0),i===e.ECDSA)return t.concat([this.toDER(),o]);if(i===e.SCHNORR)return t.concat([this.toRSBuffer(),o]);throw new Error("Invalid signature Algorithm")},_$ecsignature_53=e}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$point_322={},__Buffer_322=_$safeBuffer_431.Buffer,THREE=_$lib_192.valueOf(3);function Point(t,e,r,i){this.curve=t,this.x=e,this.y=r,this.z=i,this._zInv=null,this.compressed=!0}Object.defineProperty(Point.prototype,"zInv",{get:function(){return null===this._zInv&&(this._zInv=this.z.modInverse(this.curve.p)),this._zInv}}),Object.defineProperty(Point.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(Point.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),Point.fromAffine=function(t,e,r){return new Point(t,e,r,_$lib_192.ONE)},Point.prototype.equals=function(t){return t===this||(this.curve.isInfinity(this)?this.curve.isInfinity(t):this.curve.isInfinity(t)?this.curve.isInfinity(this):0===t.y.multiply(this.z).subtract(this.y.multiply(t.z)).mod(this.curve.p).signum()&&0===t.x.multiply(this.z).subtract(this.x.multiply(t.z)).mod(this.curve.p).signum())},Point.prototype.negate=function(){var t=this.curve.p.subtract(this.y);return new Point(this.curve,this.x,t,this.z)},Point.prototype.add=function(t){if(this.curve.isInfinity(this))return t;if(this.curve.isInfinity(t))return this;var e=this.x,r=this.y,i=t.x,n=t.y.multiply(this.z).subtract(r.multiply(t.z)).mod(this.curve.p),o=i.multiply(this.z).subtract(e.multiply(t.z)).mod(this.curve.p);if(0===o.signum())return 0===n.signum()?this.twice():this.curve.infinity;var a=o.square(),s=a.multiply(o),u=e.multiply(a),h=n.square().multiply(this.z),f=h.subtract(u.shiftLeft(1)).multiply(t.z).subtract(s).multiply(o).mod(this.curve.p),c=u.multiply(THREE).multiply(n).subtract(r.multiply(s)).subtract(h.multiply(n)).multiply(t.z).add(n.multiply(s)).mod(this.curve.p),l=s.multiply(this.z).multiply(t.z).mod(this.curve.p);return new Point(this.curve,f,c,l)},Point.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(0===this.y.signum())return this.curve.infinity;var t=this.x,e=this.y,r=e.multiply(this.z).mod(this.curve.p),i=r.multiply(e).mod(this.curve.p),n=this.curve.a,o=t.square().multiply(THREE);0!==n.signum()&&(o=o.add(this.z.square().multiply(n)));var a=(o=o.mod(this.curve.p)).square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(r).mod(this.curve.p),s=o.multiply(THREE).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(o.pow(3)).mod(this.curve.p),u=r.pow(3).shiftLeft(3).mod(this.curve.p);return new Point(this.curve,a,s,u)},Point.prototype.multiply=function(t){if(this.curve.isInfinity(this))return this;if(0===t.signum())return this.curve.infinity;for(var e=t,r=e.multiply(THREE),i=this.negate(),n=this,o=r.bitLength()-2;o>0;--o){var a=r.testBit(o),s=e.testBit(o);n=n.twice(),a!==s&&(n=n.add(a?this:i))}return n},Point.prototype.multiplyTwo=function(t,e,r){for(var i=Math.max(t.bitLength(),r.bitLength())-1,n=this.curve.infinity,o=this.add(e);i>=0;){var a=t.testBit(i),s=r.testBit(i);n=n.twice(),a?n=s?n.add(o):n.add(this):s&&(n=n.add(e)),--i}return n},Point.prototype.getEncoded=function(t){if(null==t&&(t=this.compressed),this.curve.isInfinity(this))return __Buffer_322.alloc(1,0);var e,r=this.affineX,i=this.affineY,n=this.curve.pLength;return t?(e=__Buffer_322.allocUnsafe(1+n)).writeUInt8(i.isEven()?2:3,0):((e=__Buffer_322.allocUnsafe(1+n+n)).writeUInt8(4,0),i.toBuffer(n).copy(e,1+n)),r.toBuffer(n).copy(e,1),e},Point.decodeFrom=function(t,e){var r,i=e.readUInt8(0),n=4!==i,o=Math.floor((t.p.bitLength()+7)/8),a=_$lib_192.fromBuffer(e.slice(1,1+o));if(n){var s=3===i;r=t.pointFromX(s,a)}else{var u=_$lib_192.fromBuffer(e.slice(1+o));r=Point.fromAffine(t,a,u)}return r.compressed=n,r},Point.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"},_$point_322=Point;var _$curve_318={};function Curve(t,e,r,i,n,o,a){this.p=t,this.a=e,this.b=r,this.G=_$point_322.fromAffine(this,i,n),this.n=o,this.h=a,this.infinity=new _$point_322(this,null,null,_$lib_192.ZERO),this.pOverFour=t.add(_$lib_192.ONE).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}Curve.prototype.pointFromX=function(t,e){var r=e.pow(3).add(this.a.multiply(e)).add(this.b).mod(this.p).modPow(this.pOverFour,this.p),i=r;return r.isEven()^!t&&(i=this.p.subtract(i)),_$point_322.fromAffine(this,e,i)},Curve.prototype.isInfinity=function(t){return t===this.infinity||0===t.z.signum()&&0!==t.y.signum()},Curve.prototype.isOnCurve=function(t){if(this.isInfinity(t))return!0;var e=t.affineX,r=t.affineY,i=this.a,n=this.b,o=this.p;if(e.signum()<0||e.compareTo(o)>=0)return!1;if(r.signum()<0||r.compareTo(o)>=0)return!1;var a=r.square().mod(o),s=e.pow(3).add(i.multiply(e)).add(n).mod(o);return a.equals(s)},Curve.prototype.validate=function(t){return t.multiply(this.n),!0},_$curve_318=Curve;var _$curves_319={secp128r1:{p:"fffffffdffffffffffffffffffffffff",a:"fffffffdfffffffffffffffffffffffc",b:"e87579c11079f43dd824993c2cee5ed3",n:"fffffffe0000000075a30d1b9038a115",h:"01",Gx:"161ff7528b899b2d0c28607ca52c5b86",Gy:"cf5ac8395bafeb13c02da292dded7a83"},secp160k1:{p:"fffffffffffffffffffffffffffffffeffffac73",a:"00",b:"07",n:"0100000000000000000001b8fa16dfab9aca16b6b3",h:"01",Gx:"3b4c382ce37aa192a4019e763036f4f5dd4d7ebb",Gy:"938cf935318fdced6bc28286531733c3f03c4fee"},secp160r1:{p:"ffffffffffffffffffffffffffffffff7fffffff",a:"ffffffffffffffffffffffffffffffff7ffffffc",b:"1c97befc54bd7a8b65acf89f81d4d4adc565fa45",n:"0100000000000000000001f4c8f927aed3ca752257",h:"01",Gx:"4a96b5688ef573284664698968c38bb913cbfc82",Gy:"23a628553168947d59dcc912042351377ac5fb32"},secp192k1:{p:"fffffffffffffffffffffffffffffffffffffffeffffee37",a:"00",b:"03",n:"fffffffffffffffffffffffe26f2fc170f69466a74defd8d",h:"01",Gx:"db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d",Gy:"9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"},secp192r1:{p:"fffffffffffffffffffffffffffffffeffffffffffffffff",a:"fffffffffffffffffffffffffffffffefffffffffffffffc",b:"64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",n:"ffffffffffffffffffffffff99def836146bc9b1b4d22831",h:"01",Gx:"188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",Gy:"07192b95ffc8da78631011ed6b24cdd573f977a11e794811"},secp256k1:{p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"},secp256r1:{p:"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",a:"ffffffff00000001000000000000000000000000fffffffffffffffffffffffc",b:"5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",n:"ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",h:"01",Gx:"6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",Gy:"4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"}},_$names_321=function(t){var e=_$curves_319[t];if(!e)return null;var r=new _$lib_192(e.p,16),i=new _$lib_192(e.a,16),n=new _$lib_192(e.b,16),o=new _$lib_192(e.n,16),a=new _$lib_192(e.h,16),s=new _$lib_192(e.Gx,16),u=new _$lib_192(e.Gy,16);return new _$curve_318(r,i,n,s,u,o,a)},_$lib_320={Point:_$point_322,getCurveByName:_$names_321},_$legacy_265={},__Buffer_265=_$safeBuffer_431.Buffer,ZEROS=__Buffer_265.alloc(128),blocksize=64;function Hmac(t,e){_$cipherBase_258.call(this,"digest"),"string"==typeof e&&(e=__Buffer_265.from(e)),this._alg=t,this._key=e,e.length>blocksize?e=t(e):e.lengthr?e=("rmd160"===t?new _$ripemd160_430:_$shaJs_447(t)).update(e).digest():e.length=0||!r(a);)n=_$browser_264("sha256",n).update(o).update(ZERO).digest(),o=_$browser_264("sha256",n).update(o).digest(),o=_$browser_264("sha256",n).update(o).digest(),a=_$lib_192.fromBuffer(o);return a}},__secp256k1_51=_$lib_320.getCurveByName("secp256k1"),deterministicGenerateK=_$rfc6979_57.deterministicGenerateK,N_OVER_TWO=__secp256k1_51.n.shiftRight(1),_$ecdsa_51={sign:function(t,e){_$typeforce_480(_$types_85.tuple(_$types_85.Hash256bit,_$types_85.BigInt),arguments);var r,i,n=e.toBuffer(32),o=_$lib_192.fromBuffer(t),a=__secp256k1_51.n,s=__secp256k1_51.G;return deterministicGenerateK(t,n,(function(t){var n=s.multiply(t);return!__secp256k1_51.isInfinity(n)&&0!==(r=n.affineX.mod(a)).signum()&&0!==(i=t.modInverse(a).multiply(o.add(e.multiply(r))).mod(a)).signum()})),i.compareTo(N_OVER_TWO)>0&&(i=a.subtract(i)),new _$ecsignature_53(r,i)},verify:function(t,e,r){_$typeforce_480(_$types_85.tuple(_$types_85.Hash256bit,_$types_85.ECSignature,_$types_85.ECPoint),arguments);var i=__secp256k1_51.n,n=__secp256k1_51.G,o=e.r,a=e.s;if(o.signum()<=0||o.compareTo(i)>=0)return!1;if(a.signum()<=0||a.compareTo(i)>=0)return!1;var s=_$lib_192.fromBuffer(t),u=a.modInverse(i),h=s.multiply(u).mod(i),f=o.multiply(u).mod(i),c=n.multiplyTwo(h,r,f);return!__secp256k1_51.isInfinity(c)&&c.affineX.mod(i).equals(o)},__curve:__secp256k1_51},_$schnorr_58={};(function(t){(function(){var e=_$lib_320.getCurveByName("secp256k1"),r=_$rfc6979_57.deterministicGenerateK;function i(t,e){return t.modPow(e.subtract(_$lib_192.ONE).divide(_$lib_192.valueOf(2)),e).intValue()}function n(e){return _$typeforce_480(_$types_85.tuple(_$types_85.ECPoint),arguments),t.concat([t.from([e.affineY.isEven()?2:3]),e.affineX.toBuffer(32)])}_$schnorr_58={sign:function(o,a){_$typeforce_480(_$types_85.tuple(_$types_85.BufferN(32),_$types_85.BigInt),arguments);var s=e.n,u=e.G;if(a.compareTo(_$lib_192.ZERO)<=0||a.compareTo(s)>=0)throw new Error("Private key x not in range");var h,f,c=u.multiply(a);function l(r){var l=u.multiply(r);1!=i(l.affineY,e.p)&&(r=s.subtract(r),l=u.multiply(r)),h=l.affineX.mod(s);var d=n(c),p=h.toBuffer(32),_=_$crypto_50.sha256(t.concat([p,d,o])),m=_$lib_192.fromBuffer(_).mod(s);return f=r.add(m.multiply(a)).mod(s),!0}return r(o,a.toBuffer(32),l,t.from("Schnorr+SHA256 ","ascii")),new _$ecsignature_53(h,f)}}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$browser_415={};(function(t,e){(function(){"use strict";var r=_$safeBuffer_431.Buffer,i=e.crypto||e.msCrypto;_$browser_415=i&&i.getRandomValues?function(n,o){if(n>65536)throw new Error("requested too many random bytes");var a=new e.Uint8Array(n);n>0&&i.getRandomValues(a);var s=r.from(a.buffer);return"function"==typeof o?t.nextTick((function(){o(null,s)})):s}:function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this)}).call(this,_$browser_401,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$wif_485={};(function(t){(function(){function e(e,r,i){var n=new t(i?34:33);return n.writeUInt8(e,0),r.copy(n,1),i&&(n[33]=1),n}_$wif_485={decode:function(t,e){return function(t,e){if(void 0!==e&&t[0]!==e)throw new Error("Invalid network version");if(33===t.length)return{version:t[0],privateKey:t.slice(1,33),compressed:!1};if(34!==t.length)throw new Error("Invalid WIF length");if(1!==t[33])throw new Error("Invalid compression flag");return{version:t[0],privateKey:t.slice(1,33),compressed:!0}}(_$bs58check_247.decode(t),e)},encode:function(t,r,i){return"number"==typeof t?_$bs58check_247.encode(e(t,r,i)):_$bs58check_247.encode(e(t.version,t.privateKey,t.compressed))}}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$ecpair_52={},__secp256k1_52=_$ecdsa_51.__curve;function ECPair(t,e,r){if(r&&_$typeforce_480({compressed:_$types_85.maybe(_$types_85.Boolean),network:_$types_85.maybe(_$types_85.Network)},r),r=r||{},t){if(t.signum()<=0)throw new Error("Private key must be greater than 0");if(t.compareTo(__secp256k1_52.n)>=0)throw new Error("Private key must be less than the curve order");if(e)throw new TypeError("Unexpected publicKey parameter");this.d=t}else _$typeforce_480(_$types_85.ECPoint,e),this.__Q=e;this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||_$networks_56.bitcoin}Object.defineProperty(ECPair.prototype,"Q",{get:function(){return!this.__Q&&this.d&&(this.__Q=__secp256k1_52.G.multiply(this.d)),this.__Q}}),ECPair.fromPublicKeyBuffer=function(t,e){var r=_$lib_320.Point.decodeFrom(__secp256k1_52,t);return new ECPair(null,r,{compressed:r.compressed,network:e})},ECPair.fromWIF=function(t,e){var r=_$wif_485.decode(t),i=r.version;if(_$types_85.Array(e)){if(!(e=e.filter((function(t){return i===t.wif})).pop()))throw new Error("Unknown network version")}else if(e=e||_$networks_56.bitcoin,i!==e.wif)throw new Error("Invalid network version");return new ECPair(_$lib_192.fromBuffer(r.privateKey),null,{compressed:r.compressed,network:e})},ECPair.makeRandom=function(t){var e,r=(t=t||{}).rng||_$browser_415;do{var i=r(32);_$typeforce_480(_$types_85.Buffer256bit,i),e=_$lib_192.fromBuffer(i)}while(e.signum()<=0||e.compareTo(__secp256k1_52.n)>=0);return new ECPair(e,null,t)},ECPair.prototype.getAddress=function(){return _$address_47.toBase58Check(_$crypto_50.hash160(this.getPublicKeyBuffer()),this.getNetwork().pubKeyHash)},ECPair.prototype.getNetwork=function(){return this.network},ECPair.prototype.getPublicKeyBuffer=function(){return this.Q.getEncoded(this.compressed)},ECPair.prototype.sign=function(t,e){if(!this.d)throw new Error("Missing private key");return e||(e=_$ecsignature_53.ECDSA),e===_$ecsignature_53.ECDSA?_$ecdsa_51.sign(t,this.d):e===_$ecsignature_53.SCHNORR?_$schnorr_58.sign(t,this.d):void 0},ECPair.prototype.toWIF=function(){if(!this.d)throw new Error("Missing private key");return _$wif_485.encode(this.network.wif,this.d.toBuffer(32),this.compressed)},ECPair.prototype.verify=function(t,e){return _$ecdsa_51.verify(t,e,this.Q)},_$ecpair_52=ECPair;var _$hdnode_54={},__Buffer_54=_$safeBuffer_431.Buffer,curve=_$lib_320.getCurveByName("secp256k1");function HDNode(t,e){if(!t.compressed)throw new TypeError("BIP32 only allows compressed keyPairs");this.keyPair=t,this.chainCode=e,this.depth=0,this.index=0,this.parentFingerprint=0}HDNode.HIGHEST_BIT=2147483648,HDNode.LENGTH=78,HDNode.MASTER_SECRET=__Buffer_54.from("Bitcoin seed","utf8"),HDNode.fromSeedBuffer=function(t,e){if(_$typeforce_480(_$types_85.tuple(_$types_85.Buffer,_$types_85.maybe(_$types_85.Network)),arguments),t.length<16)throw new TypeError("Seed should be at least 128 bits");if(t.length>64)throw new TypeError("Seed should be at most 512 bits");var r=_$browser_264("sha512",HDNode.MASTER_SECRET).update(t).digest(),i=r.slice(0,32),n=r.slice(32),o=_$lib_192.fromBuffer(i);return new HDNode(new _$ecpair_52(o,null,{network:e}),n)},HDNode.fromSeedHex=function(t,e){return HDNode.fromSeedBuffer(__Buffer_54.from(t,"hex"),e)},HDNode.fromBase58=function(t,e){var r=_$bs58check_247.decode(t);if(78!==r.length)throw new Error("Invalid buffer length");var i,n=r.readUInt32BE(0);if(Array.isArray(e)){if(!(i=e.filter((function(t){return n===t.bip32.private||n===t.bip32.public})).pop()))throw new Error("Unknown network version")}else i=e||_$networks_56.bitcoin;if(n!==i.bip32.private&&n!==i.bip32.public)throw new Error("Invalid network version");var o=r[4],a=r.readUInt32BE(5);if(0===o&&0!==a)throw new Error("Invalid parent fingerprint");var s=r.readUInt32BE(9);if(0===o&&0!==s)throw new Error("Invalid index");var u,h=r.slice(13,45);if(n===i.bip32.private){if(0!==r.readUInt8(45))throw new Error("Invalid private key");var f=_$lib_192.fromBuffer(r.slice(46,78));u=new _$ecpair_52(f,null,{network:i})}else{var c=_$lib_320.Point.decodeFrom(curve,r.slice(45,78));curve.validate(c),u=new _$ecpair_52(null,c,{network:i})}var l=new HDNode(u,h);return l.depth=o,l.index=s,l.parentFingerprint=a,l},HDNode.prototype.getAddress=function(){return this.keyPair.getAddress()},HDNode.prototype.getIdentifier=function(){return _$crypto_50.hash160(this.keyPair.getPublicKeyBuffer())},HDNode.prototype.getFingerprint=function(){return this.getIdentifier().slice(0,4)},HDNode.prototype.getNetwork=function(){return this.keyPair.getNetwork()},HDNode.prototype.getPublicKeyBuffer=function(){return this.keyPair.getPublicKeyBuffer()},HDNode.prototype.neutered=function(){var t=new HDNode(new _$ecpair_52(null,this.keyPair.Q,{network:this.keyPair.network}),this.chainCode);return t.depth=this.depth,t.index=this.index,t.parentFingerprint=this.parentFingerprint,t},HDNode.prototype.sign=function(t){return this.keyPair.sign(t)},HDNode.prototype.verify=function(t,e){return this.keyPair.verify(t,e)},HDNode.prototype.toBase58=function(t){if(void 0!==t)throw new TypeError("Unsupported argument in 2.0.0");var e=this.keyPair.network,r=this.isNeutered()?e.bip32.public:e.bip32.private,i=__Buffer_54.allocUnsafe(78);return i.writeUInt32BE(r,0),i.writeUInt8(this.depth,4),i.writeUInt32BE(this.parentFingerprint,5),i.writeUInt32BE(this.index,9),this.chainCode.copy(i,13),this.isNeutered()?this.keyPair.getPublicKeyBuffer().copy(i,45):(i.writeUInt8(0,45),this.keyPair.d.toBuffer(32).copy(i,46)),_$bs58check_247.encode(i)},HDNode.prototype.derive=function(t){_$typeforce_480(_$types_85.UInt32,t);var e=t>=HDNode.HIGHEST_BIT,r=__Buffer_54.allocUnsafe(37);if(e){if(this.isNeutered())throw new TypeError("Could not derive hardened child key");r[0]=0,this.keyPair.d.toBuffer(32).copy(r,1),r.writeUInt32BE(t,33)}else this.keyPair.getPublicKeyBuffer().copy(r,0),r.writeUInt32BE(t,33);var i,n=_$browser_264("sha512",this.chainCode).update(r).digest(),o=n.slice(0,32),a=n.slice(32),s=_$lib_192.fromBuffer(o);if(s.compareTo(curve.n)>=0)return this.derive(t+1);if(this.isNeutered()){var u=curve.G.multiply(s).add(this.keyPair.Q);if(curve.isInfinity(u))return this.derive(t+1);i=new _$ecpair_52(null,u,{network:this.keyPair.network})}else{var h=s.add(this.keyPair.d).mod(curve.n);if(0===h.signum())return this.derive(t+1);i=new _$ecpair_52(h,null,{network:this.keyPair.network})}var f=new HDNode(i,a);return f.depth=this.depth+1,f.index=t,f.parentFingerprint=this.getFingerprint().readUInt32BE(0),f},HDNode.prototype.deriveHardened=function(t){return _$typeforce_480(_$types_85.UInt31,t),this.derive(t+HDNode.HIGHEST_BIT)},HDNode.prototype.isNeutered=function(){return!this.keyPair.d},HDNode.prototype.derivePath=function(t){_$typeforce_480(_$types_85.BIP32Path,t);var e=t.split("/");if("m"===e[0]){if(this.parentFingerprint)throw new Error("Not a master node");e=e.slice(1)}return e.reduce((function(t,e){var r;return"'"===e.slice(-1)?(r=parseInt(e.slice(0,-1),10),t.deriveHardened(r)):(r=parseInt(e,10),t.derive(r))}),this)},_$hdnode_54=HDNode;var __Buffer_483=_$safeBuffer_431.Buffer,MAX_SAFE_INTEGER=9007199254740991;function checkUInt53(t){if(t<0||t>MAX_SAFE_INTEGER||t%1!=0)throw new RangeError("value out of range")}function __encodingLength_483(t){return checkUInt53(t),t<253?1:t<=65535?3:t<=4294967295?5:9}var _$varuintBitcoin_483={encode:function t(e,r,i){if(checkUInt53(e),r||(r=__Buffer_483.allocUnsafe(__encodingLength_483(e))),!__Buffer_483.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),e<253?(r.writeUInt8(e,i),t.bytes=1):e<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(e,i+1),t.bytes=3):e<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(e,i+1),t.bytes=5):(r.writeUInt8(255,i),r.writeUInt32LE(e>>>0,i+1),r.writeUInt32LE(e/4294967296|0,i+5),t.bytes=9),r},decode:function t(e,r){if(!__Buffer_483.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var i=e.readUInt8(r);if(i<253)return t.bytes=1,i;if(253===i)return t.bytes=3,e.readUInt16LE(r+1);if(254===i)return t.bytes=5,e.readUInt32LE(r+1);t.bytes=9;var n=e.readUInt32LE(r+1),o=4294967296*e.readUInt32LE(r+5)+n;return checkUInt53(o),o},encodingLength:__encodingLength_483};function verifuint(t,e){if("number"!=typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}var _$bufferutils_49={pushDataSize:_$pushdataBitcoin_104.encodingLength,readPushDataInt:_$pushdataBitcoin_104.decode,readUInt64LE:function(t,e){var r=t.readUInt32LE(e),i=t.readUInt32LE(e+4);return verifuint((i*=4294967296)+r,9007199254740991),i+r},readVarInt:function(t,e){return{number:_$varuintBitcoin_483.decode(t,e),size:_$varuintBitcoin_483.decode.bytes}},varIntBuffer:_$varuintBitcoin_483.encode,varIntSize:_$varuintBitcoin_483.encodingLength,writePushDataInt:_$pushdataBitcoin_104.encode,writeUInt64LE:function(t,e,r){return verifuint(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8},writeVarInt:function(t,e,r){return _$varuintBitcoin_483.encode(e,t,r),_$varuintBitcoin_483.encode.bytes}},_$transaction_83={},__Buffer_83=_$safeBuffer_431.Buffer;function varSliceSize(t){var e=t.length;return _$varuintBitcoin_483.encodingLength(e)+e}function Transaction(){this.version=2,this.locktime=0,this.ins=[],this.outs=[]}Transaction.DEFAULT_SEQUENCE=4294967295,Transaction.SIGHASH_ALL=1,Transaction.SIGHASH_NONE=2,Transaction.SIGHASH_SINGLE=3,Transaction.SIGHASH_ANYONECANPAY=128,Transaction.SIGHASH_BITCOINCASHBIP143=64,Transaction.ADVANCED_TRANSACTION_MARKER=0,Transaction.ADVANCED_TRANSACTION_FLAG=1;var EMPTY_SCRIPT=__Buffer_83.allocUnsafe(0),EMPTY_WITNESS=[],__ZERO_83=__Buffer_83.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),__ONE_83=__Buffer_83.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),VALUE_UINT64_MAX=__Buffer_83.from("ffffffffffffffff","hex"),BLANK_OUTPUT={script:EMPTY_SCRIPT,valueBuffer:VALUE_UINT64_MAX};Transaction.fromBuffer=function(t,e){var r=0;function i(e){return r+=e,t.slice(r-e,r)}function n(){var e=t.readUInt32LE(r);return r+=4,e}function o(){var e=_$bufferutils_49.readUInt64LE(t,r);return r+=8,e}function a(){var e=_$varuintBitcoin_483.decode(t,r);return r+=_$varuintBitcoin_483.decode.bytes,e}function s(){return i(a())}function u(){for(var t=a(),e=[],r=0;r=this.ins.length)return __ONE_83;var i=_$script_59.compile(_$script_59.decompile(e).filter((function(t){return t!==_$index_45.OP_CODESEPARATOR}))),n=this.clone();if((31&r)===Transaction.SIGHASH_NONE)n.outs=[],n.ins.forEach((function(e,r){r!==t&&(e.sequence=0)}));else if((31&r)===Transaction.SIGHASH_SINGLE){if(t>=this.outs.length)return __ONE_83;n.outs.length=t+1;for(var o=0;o0)return e=e.map((function(t){return t||_$index_45.OP_0})),i||(e=e.filter((function(t){return t!==_$index_45.OP_0}))),_$templates_61.multisig.input.encodeStack(e)}if(!i)throw new Error("Not enough signatures provided");return[]}function TransactionBuilder(t,e){this.prevTxMap={},this.network=t||_$networks_56.bitcoin,this.maximumFeeRate=e||2500,this.inputs=[],this.bitcoinCash=!0,this.tx=new _$transaction_83}function canSign(t){return void 0!==t.prevOutScript&&void 0!==t.signScript&&void 0!==t.pubKeys&&void 0!==t.signatures&&t.signatures.length===t.pubKeys.length&&t.pubKeys.length>0&&(!1===t.witness||!0===t.witness&&void 0!==t.value)}function signatureHashType(t){return t.readUInt8(t.length-1)}TransactionBuilder.prototype.setLockTime=function(t){if(_$typeforce_480(_$types_85.UInt32,t),this.inputs.some((function(t){return!!t.signatures&&t.signatures.some((function(t){return t}))})))throw new Error("No, this would invalidate signatures");this.tx.locktime=t},TransactionBuilder.fromTransaction=function(t,e,r){var i=new TransactionBuilder(e);return i.setLockTime(t.locktime),t.outs.forEach((function(t){i.addOutput(t.script,t.value)})),t.ins.forEach((function(t){i.__addInputUnsafe(t.hash,t.index,{sequence:t.sequence,script:t.script,witness:t.witness,value:t.value})})),i.inputs.forEach((function(e,i){!function(t,e,r,i,n){if(t.redeemScriptType===scriptTypes.MULTISIG&&t.redeemScript&&t.pubKeys.length!==t.signatures.length){var o=t.signatures.concat();t.signatures=t.pubKeys.map((function(a){var s,u=_$ecpair_52.fromPublicKeyBuffer(a);return o.some((function(a,h){if(!a)return!1;var f,c=_$ecsignature_53.parseScriptSignature(a);return f=n?e.hashForCashSignature(r,t.signScript,i,c.hashType):t.witness?e.hashForWitnessV0(r,t.signScript,i,c.hashType):e.hashForSignature(r,t.signScript,c.hashType),!!u.verify(f,c.signature)&&(o[h]=void 0,s=a,!0)})),s}))}}(e,t,i,e.value,r)})),i},TransactionBuilder.prototype.addInput=function(t,e,r,i){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");var n;if("string"==typeof t)t=__Buffer_84.from(t,"hex").reverse();else if(t instanceof _$transaction_83){var o=t.outs[e];i=o.script,n=o.value,t=t.getHash()}return this.__addInputUnsafe(t,e,{sequence:r,prevOutScript:i,value:n})},TransactionBuilder.prototype.__addInputUnsafe=function(t,e,r){if(_$transaction_83.isCoinbaseHash(t))throw new Error("coinbase inputs not supported");var i=t.toString("hex")+":"+e;if(void 0!==this.prevTxMap[i])throw new Error("Duplicate TxOut: "+i);var n={};if(void 0!==r.script&&(n=expandInput(r.script,r.witness||[])),void 0!==r.value&&(n.value=r.value),!n.prevOutScript&&r.prevOutScript){var o;if(!n.pubKeys&&!n.signatures){var a=expandOutput(r.prevOutScript);a.pubKeys&&(n.pubKeys=a.pubKeys,n.signatures=a.signatures),o=a.scriptType}n.prevOutScript=r.prevOutScript,n.prevOutType=o||_$templates_61.classifyOutput(r.prevOutScript)}var s=this.tx.addInput(t,e,r.sequence,r.scriptSig);return this.inputs[s]=n,this.prevTxMap[i]=s,s},TransactionBuilder.prototype.addOutput=function(t,e){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof t&&(t=_$address_47.toOutputScript(t,this.network)),this.tx.addOutput(t,e)},TransactionBuilder.prototype.build=function(){return this.__build(!1)},TransactionBuilder.prototype.buildIncomplete=function(){return this.__build(!0)},TransactionBuilder.prototype.__build=function(t){if(!t){if(!this.tx.ins.length)throw new Error("Transaction has no inputs");if(!this.tx.outs.length)throw new Error("Transaction has no outputs")}var e=this.tx.clone();if(this.inputs.forEach((function(r,i){if(!(r.witnessScriptType||r.redeemScriptType||r.prevOutType||t))throw new Error("Transaction is not complete");var n=function(t,e){var r=t.prevOutType,i=[],n=[];supportedType(r)&&(i=buildStack(r,t.signatures,t.pubKeys,e));var o=!1;if(r===_$templates_61.types.P2SH){if(!e&&!supportedP2SHType(t.redeemScriptType))throw new Error("Impossible to sign this type");supportedType(t.redeemScriptType)&&(i=buildStack(t.redeemScriptType,t.signatures,t.pubKeys,e)),t.redeemScriptType&&(o=!0,r=t.redeemScriptType)}switch(r){case _$templates_61.types.P2WPKH:n=buildStack(_$templates_61.types.P2PKH,t.signatures,t.pubKeys,e);break;case _$templates_61.types.P2WSH:if(!e&&!supportedType(t.witnessScriptType))throw new Error("Impossible to sign this type");supportedType(t.witnessScriptType)&&((n=buildStack(t.witnessScriptType,t.signatures,t.pubKeys,e)).push(t.witnessScript),r=t.witnessScriptType)}return o&&i.push(t.redeemScript),{type:r,script:_$script_59.compile(i),witness:n}}(r,t);if(!t&&!supportedType(n.type)&&n.type!==_$templates_61.types.P2WPKH)throw new Error(n.type+" not supported");e.setInputScript(i,n.script),e.setWitness(i,n.witness)})),!t&&this.__overMaximumFees(e.virtualSize()))throw new Error("Transaction has absurd fees");return e},TransactionBuilder.prototype.sign=function(t,e,r,i,n,o,a){if(i|=_$transaction_83.SIGHASH_BITCOINCASHBIP143,!this.inputs[t])throw new Error("No input at index: "+t);i=i||_$transaction_83.SIGHASH_ALL;var s=this.inputs[t];if(void 0!==s.redeemScript&&r&&!s.redeemScript.equals(r))throw new Error("Inconsistent redeemScript");var u=e.publicKey||e.getPublicKeyBuffer();if(!canSign(s)){if(void 0!==n){if(void 0!==s.value&&s.value!==n)throw new Error("Input didn't match witnessValue");_$typeforce_480(_$types_85.Satoshi,n),s.value=n}if(canSign(s)||prepareInput(s,u,r,0,o),!canSign(s))throw Error(s.prevOutType+" not supported")}var h=this.tx.hashForCashSignature(t,s.signScript,n,i);if(!s.pubKeys.some((function(t,r){if(!u.equals(t))return!1;if(s.signatures[r])throw new Error("Signature already exists");if(33!==u.length&&s.signType===scriptTypes.P2WPKH)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");var n=e.sign(h,a);return __Buffer_84.isBuffer(n)&&(n=_$ecsignature_53.fromRSBuffer(n)),s.signatures[r]=n.toScriptSignature(i,a),!0})))throw new Error("Key pair cannot sign for this input")},TransactionBuilder.prototype.__canModifyInputs=function(){return this.inputs.every((function(t){return void 0===t.signatures||t.signatures.every((function(t){return!t||signatureHashType(t)&_$transaction_83.SIGHASH_ANYONECANPAY}))}))},TransactionBuilder.prototype.__canModifyOutputs=function(){var t=this.tx.ins.length,e=this.tx.outs.length;return this.inputs.every((function(r){return void 0===r.signatures||r.signatures.every((function(r){if(!r)return!0;var i=31&signatureHashType(r);return i===_$transaction_83.SIGHASH_NONE||(i===_$transaction_83.SIGHASH_SINGLE?t<=e:void 0)}))}))},TransactionBuilder.prototype.__overMaximumFees=function(t){return(this.inputs.reduce((function(t,e){return t+(e.value>>>0)}),0)-this.tx.outs.reduce((function(t,e){return t+e.value}),0))/t>this.maximumFeeRate},_$transaction_builder_84=TransactionBuilder;var _$fastRoot_380={};(function(t){(function(){_$fastRoot_380=function(e,r){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof r)throw TypeError("Expected digest Function");for(var i=e.length,n=e.concat();i>1;){for(var o=0,a=0;a>24)-3,r=8388607&t,i=__Buffer_48.alloc(32,0);return i.writeUInt32BE(r,28-e),i},Block.calculateMerkleRoot=function(t){if(_$typeforce_480([{getHash:_$types_85.Function}],t),0===t.length)throw TypeError("Cannot compute merkle root for zero transactions");var e=t.map((function(t){return t.getHash()}));return _$fastRoot_380(e,_$crypto_50.hash256)},Block.prototype.checkMerkleRoot=function(){if(!this.transactions)return!1;var t=Block.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)},Block.prototype.checkProofOfWork=function(){var t=this.getHash().reverse(),e=Block.calculateTarget(this.bits);return t.compare(e)<=0},_$block_48=Block,_$templates_61)_$script_59[key]=_$templates_61[key];var _$src_55={ECPair:_$ecpair_52,ECSignature:_$ecsignature_53,HDNode:_$hdnode_54,TransactionBuilder:_$transaction_builder_84,address:_$address_47,crypto:_$crypto_50,networks:_$networks_56,script:_$script_59},_$big_433={exports:{}};!function(t){"use strict";var e,r={},i=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function n(t,e,r){var i=t.constructor,n=e-(t=new i(t)).e,a=t.c;for(a.length>++e&&o(t,n,i.RM),a[0]?r?n=e:(a=t.c,n=t.e+n+1):++n;a.length1?a[0]+"."+a.join("").slice(1):a[0])+(n<0?"e":"e+")+n:t.toString()}function o(t,e,r,i){var n,o=t.c,s=t.e+e+1;if(1===r?i=o[s]>=5:2===r?i=o[s]>5||5==o[s]&&(i||s<0||o[s+1]!==n||1&o[s-1]):3===r?i=i||o[s]!==n||s<0:(i=!1,0!==r&&a("!Big.RM!")),s<1||!o[0])i?(t.e=-e,t.c=[1]):t.c=[t.e=0];else{if(o.length=s--,i)for(;++o[s]>9;)o[s]=0,s--||(++t.e,o.unshift(1));for(s=o.length;!o[--s];o.pop());}return t}function a(t){var e=new Error(t);throw e.name="BigError",e}r.abs=function(){var t=new this.constructor(this);return t.s=1,t},r.cmp=function(t){var e,r=this,i=r.c,n=(t=new r.constructor(t)).c,o=r.s,a=t.s,s=r.e,u=t.e;if(!i[0]||!n[0])return i[0]?o:n[0]?-a:0;if(o!=a)return o;if(e=o<0,s!=u)return s>u^e?1:-1;for(o=-1,a=(s=i.length)<(u=n.length)?s:u;++on[o]^e?1:-1;return s==u?0:s>u^e?1:-1},r.div=function(t){var e=this,r=e.constructor,i=e.c,n=(t=new r(t)).c,s=e.s==t.s?1:-1,u=r.DP;if((u!==~~u||u<0||u>1e6)&&a("!Big.DP!"),!i[0]||!n[0])return i[0]==n[0]&&a(NaN),n[0]||a(s/0),new r(0*s);var h,f,c,l,d,p,_=n.slice(),m=h=n.length,g=i.length,y=i.slice(0,h),b=y.length,v=t,w=v.c=[],M=0,$=u+(v.e=e.e-t.e)+1;for(v.s=s,s=$<0?0:$,_.unshift(0);b++b?1:-1;else for(d=-1,l=0;++dy[d]?1:-1;break}if(!(l<0))break;for(f=b==h?n:_;b;){if(y[--b]$&&o(v,u,r.RM,y[0]!==p),v},r.eq=function(t){return!this.cmp(t)},r.gt=function(t){return this.cmp(t)>0},r.gte=function(t){return this.cmp(t)>-1},r.lt=function(t){return this.cmp(t)<0},r.lte=function(t){return this.cmp(t)<1},r.sub=r.minus=function(t){var e,r,i,n,o=this,a=o.constructor,s=o.s,u=(t=new a(t)).s;if(s!=u)return t.s=-u,o.plus(t);var h=o.c.slice(),f=o.e,c=t.c,l=t.e;if(!h[0]||!c[0])return c[0]?(t.s=-u,t):new a(h[0]?o:0);if(s=f-l){for((n=s<0)?(s=-s,i=h):(l=f,i=c),i.reverse(),u=s;u--;i.push(0));i.reverse()}else for(r=((n=h.length0)for(;u--;h[e++]=0);for(u=e;r>s;){if(h[--r]0?(u=a,e=h):(n=-n,e=s),e.reverse();n--;e.push(0));e.reverse()}for(s.length-h.length<0&&(e=h,h=s,s=e),n=h.length,o=0;n;)o=(s[--n]=s[n]+h[n]+o)/10|0,s[n]%=10;for(o&&(s.unshift(o),++u),n=s.length;0===s[--n];s.pop());return t.c=s,t.e=u,t},r.pow=function(t){var e=this,r=new e.constructor(1),i=r,n=t<0;for((t!==~~t||t<-1e6||t>1e6)&&a("!pow!"),t=n?-t:t;1&t&&(i=i.times(e)),t>>=1;)e=e.times(e);return n?r.div(i):i},r.round=function(t,e){var r=this,i=r.constructor;return null==t?t=0:(t!==~~t||t<0||t>1e6)&&a("!round!"),o(r=new i(r),t,null==e?i.RM:e),r},r.sqrt=function(){var t,e,r,i=this,n=i.constructor,s=i.c,u=i.s,h=i.e,f=new n("0.5");if(!s[0])return new n(i);u<0&&a(NaN),0===(u=Math.sqrt(i.toString()))||u===1/0?((t=s.join("")).length+h&1||(t+="0"),(e=new n(Math.sqrt(t).toString())).e=((h+1)/2|0)-(h<0||1&h)):e=new n(u.toString()),u=e.e+(n.DP+=4);do{r=e,e=f.times(r.plus(i.div(r)))}while(r.c.slice(0,u).join("")!==e.c.slice(0,u).join(""));return o(e,n.DP-=4,n.RM),e},r.mul=r.times=function(t){var e,r=this,i=r.constructor,n=r.c,o=(t=new i(t)).c,a=n.length,s=o.length,u=r.e,h=t.e;if(t.s=r.s==t.s?1:-1,!n[0]||!o[0])return new i(0*t.s);for(t.e=u+h,au;)s=e[h]+o[u]*n[h-u-1]+s,e[h--]=s%10,s=s/10|0;e[h]=(e[h]+s)%10}for(s&&++t.e,e[0]||e.shift(),u=e.length;!e[--u];e.pop());return t.c=e,t},r.toString=r.valueOf=r.toJSON=function(){var t=this,e=t.constructor,r=t.e,i=t.c.join(""),n=i.length;if(r<=e.E_NEG||r>=e.E_POS)i=i.charAt(0)+(n>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;i="0"+i);i="0."+i}else if(r>0)if(++r>n)for(r-=n;r--;i+="0");else r1&&(i=i.charAt(0)+"."+i.slice(1));return t.s<0&&t.c[0]?"-"+i:i},r.toExponential=function(t){return null==t?t=this.c.length-1:(t!==~~t||t<0||t>1e6)&&a("!toExp!"),n(this,t,1)},r.toFixed=function(t){var e,r=this,i=r.constructor,o=i.E_NEG,s=i.E_POS;return i.E_NEG=-(i.E_POS=1/0),null==t?e=r.toString():t===~~t&&t>=0&&t<=1e6&&(e=n(r,r.e+t),r.s<0&&r.c[0]&&e.indexOf("-")<0&&(e="-"+e)),i.E_NEG=o,i.E_POS=s,e||a("!toFix!"),e},r.toPrecision=function(t){return null==t?this.toString():((t!==~~t||t<1||t>1e6)&&a("!toPre!"),n(this,t-1,2))},e=function t(){function e(r){var n=this;if(!(n instanceof e))return void 0===r?t():new e(r);r instanceof e?(n.s=r.s,n.e=r.e,n.c=r.c.slice()):function(t,e){var r,n,o;for(0===e&&1/e<0?e="-0":i.test(e+="")||a(NaN),t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[];n<=o;t.c.push(+e.charAt(n++)));}}(n,r),n.constructor=e}return e.prototype=r,e.DP=20,e.RM=1,e.E_NEG=-7,e.E_POS=21,e}(),"function"==typeof define&&define.amd?define((function(){return e})):_$big_433.exports?(_$big_433.exports=e,_$big_433.exports.Big=e):t.Big=e}(this),_$big_433=_$big_433.exports;var _$satoshiBitcoin_432={};function toNumber(t){return Number(t)}Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&t%1==0}),_$satoshiBitcoin_432={toBitcoin:function(t){var e=typeof t;if("string"===e&&(t=toNumber(t),e="number"),"number"!==e)throw new TypeError("toBitcoin must be called on a number or string, got "+e);if(!Number.isInteger(t))throw new TypeError("toBitcoin must be called on a whole number or string format whole number");var r=new _$big_433(t);return Number(r.div(1e8))},toSatoshi:function(t){var e=typeof t;if("string"===e&&(t=toNumber(t),e="number"),"number"!==e)throw new TypeError("toSatoshi must be called on a number or string, got "+e);var r=new _$big_433(t);return Number(r.times(1e8))}};var _$bufferEquals_248={};(function(t){(function(){"use strict";_$bufferEquals_248=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return!0;if("function"==typeof e.equals)return e.equals(r);if(e.length!==r.length)return!1;for(var i=0;i=r)throw RangeError(i)}}).call(this)}).call(this,{isBuffer:_$isBuffer_376});var _$der_440={},__Buffer_440=_$safeBuffer_431.Buffer,EC_PRIVKEY_EXPORT_DER_COMPRESSED=__Buffer_440.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]),EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED=__Buffer_440.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]);_$der_440.privateKeyExport=function(t,e,r){var i=__Buffer_440.from(r?EC_PRIVKEY_EXPORT_DER_COMPRESSED:EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED);return t.copy(i,r?8:9),e.copy(i,r?181:214),i},_$der_440.privateKeyImport=function(t){var e=t.length,r=0;if(!(e2||e1?t[r+i-2]<<8:0);if(!(e<(r+=i)+n||e32||e1&&0===e[i]&&!(128&e[i+1]);--r,++i);for(var n=__Buffer_440.concat([__Buffer_440.from([0]),t.s]),o=33,a=0;o>1&&0===n[a]&&!(128&n[a+1]);--o,++a);return _$bip66_212.encode(e.slice(i),n.slice(a))},_$der_440.signatureImport=function(t){var e=__Buffer_440.alloc(32,0),r=__Buffer_440.alloc(32,0);try{var i=_$bip66_212.decode(t);if(33===i.r.length&&0===i.r[0]&&(i.r=i.r.slice(1)),i.r.length>32)throw new Error("R length is too long");if(33===i.s.length&&0===i.s[0]&&(i.s=i.s.slice(1)),i.s.length>32)throw new Error("S length is too long")}catch(n){return}return i.r.copy(e,32-i.r.length),i.s.copy(r,32-i.s.length),{r:e,s:r}},_$der_440.signatureImportLax=function(t){var e=__Buffer_440.alloc(32,0),r=__Buffer_440.alloc(32,0),i=t.length,n=0;if(48===t[n++]){var o=t[n++];if(!(128&o&&(n+=o-128)>i)&&2===t[n++]){var a=t[n++];if(128&a){if(n+(o=a-128)>i)return;for(;o>0&&0===t[n];n+=1,o-=1);for(a=0;o>0;n+=1,o-=1)a=(a<<8)+t[n]}if(!(a>i-n)){var s=n;if(n+=a,2===t[n++]){var u=t[n++];if(128&u){if(n+(o=u-128)>i)return;for(;o>0&&0===t[n];n+=1,o-=1);for(u=0;o>0;n+=1,o-=1)u=(u<<8)+t[n]}if(!(u>i-n)){var h=n;for(n+=u;a>0&&0===t[s];a-=1,s+=1);if(!(a>32)){var f=t.slice(s,s+a);for(f.copy(e,32-f.length);u>0&&0===t[h];u-=1,h+=1);if(!(u>32)){var c=t.slice(h,h+u);return c.copy(r,32-c.length),{r:e,s:r}}}}}}}}};var _$messages_443={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"};function initCompressedValue(t,e){return void 0===t?e:(_$assert_439.isBoolean(t,_$messages_443.COMPRESSED_TYPE_INVALID),t)}var _$lib_442=function(t){return{privateKeyVerify:function(e){return _$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),32===e.length&&t.privateKeyVerify(e)},privateKeyExport:function(e,r){_$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_439.isBufferLength(e,32,_$messages_443.EC_PRIVATE_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0);var i=t.privateKeyExport(e,r);return _$der_440.privateKeyExport(e,i,r)},privateKeyImport:function(e){if(_$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),(e=_$der_440.privateKeyImport(e))&&32===e.length&&t.privateKeyVerify(e))return e;throw new Error(_$messages_443.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(e){return _$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_439.isBufferLength(e,32,_$messages_443.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyNegate(e)},privateKeyModInverse:function(e){return _$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_439.isBufferLength(e,32,_$messages_443.EC_PRIVATE_KEY_LENGTH_INVALID),t.privateKeyModInverse(e)},privateKeyTweakAdd:function(e,r){return _$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_439.isBufferLength(e,32,_$messages_443.EC_PRIVATE_KEY_LENGTH_INVALID),_$assert_439.isBuffer(r,_$messages_443.TWEAK_TYPE_INVALID),_$assert_439.isBufferLength(r,32,_$messages_443.TWEAK_LENGTH_INVALID),t.privateKeyTweakAdd(e,r)},privateKeyTweakMul:function(e,r){return _$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_439.isBufferLength(e,32,_$messages_443.EC_PRIVATE_KEY_LENGTH_INVALID),_$assert_439.isBuffer(r,_$messages_443.TWEAK_TYPE_INVALID),_$assert_439.isBufferLength(r,32,_$messages_443.TWEAK_LENGTH_INVALID),t.privateKeyTweakMul(e,r)},publicKeyCreate:function(e,r){return _$assert_439.isBuffer(e,_$messages_443.EC_PRIVATE_KEY_TYPE_INVALID),_$assert_439.isBufferLength(e,32,_$messages_443.EC_PRIVATE_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0),t.publicKeyCreate(e,r)},publicKeyConvert:function(e,r){return _$assert_439.isBuffer(e,_$messages_443.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_439.isBufferLength2(e,33,65,_$messages_443.EC_PUBLIC_KEY_LENGTH_INVALID),r=initCompressedValue(r,!0),t.publicKeyConvert(e,r)},publicKeyVerify:function(e){return _$assert_439.isBuffer(e,_$messages_443.EC_PUBLIC_KEY_TYPE_INVALID),t.publicKeyVerify(e)},publicKeyTweakAdd:function(e,r,i){return _$assert_439.isBuffer(e,_$messages_443.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_439.isBufferLength2(e,33,65,_$messages_443.EC_PUBLIC_KEY_LENGTH_INVALID),_$assert_439.isBuffer(r,_$messages_443.TWEAK_TYPE_INVALID),_$assert_439.isBufferLength(r,32,_$messages_443.TWEAK_LENGTH_INVALID),i=initCompressedValue(i,!0),t.publicKeyTweakAdd(e,r,i)},publicKeyTweakMul:function(e,r,i){return _$assert_439.isBuffer(e,_$messages_443.EC_PUBLIC_KEY_TYPE_INVALID),_$assert_439.isBufferLength2(e,33,65,_$messages_443.EC_PUBLIC_KEY_LENGTH_INVALID),_$assert_439.isBuffer(r,_$messages_443.TWEAK_TYPE_INVALID),_$assert_439.isBufferLength(r,32,_$messages_443.TWEAK_LENGTH_INVALID),i=initCompressedValue(i,!0),t.publicKeyTweakMul(e,r,i)},publicKeyCombine:function(e,r){_$assert_439.isArray(e,_$messages_443.EC_PUBLIC_KEYS_TYPE_INVALID),_$assert_439.isLengthGTZero(e,_$messages_443.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=a(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[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],f=[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 c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],l=f[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:u[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return this.toArrayLike(n,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function d(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(l=c),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):d(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(o,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){return this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new i(1),o=new i(0),a=new i(0),s=new i(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(f)),n.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(s)):(r.isub(e),a.isub(n),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},i.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new i(1),a=new i(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new w(t)},i.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return this._forceRed(t)},i.prototype.redAdd=function(t){return this.red.add(this,t)},i.prototype.redIAdd=function(t){return this.red.iadd(this,t)},i.prototype.redSub=function(t){return this.red.sub(this,t)},i.prototype.redISub=function(t){return this.red.isub(this,t)},i.prototype.redShl=function(t){return this.red.shl(this,t)},i.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}m.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},r(g,m),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new y;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new v}return _[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new i(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),n=0;!r.isZero()&&0===r.andln(1);)n++,r.iushrn(1);var o=new i(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=n;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new i(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n=0;n--){for(var h=e.words[n],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===n&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},r(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_444,this),_$bn_444=_$bn_444.exports;var _$package_339={version:"6.5.7"},_$bn_338={exports:{}};!function(t,e){"use strict";function r(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var n;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{n="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:_$empty_216({}).Buffer}catch($){}function o(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function s(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=a(t,e,i)<=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,u=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[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],f=[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 c(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],l=f[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:u[c-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return this.toArrayLike(n,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function d(t,e,r){return(new p).mulp(t,e,r)}function p(t,e){this.x=t,this.y=e}Math.imul||(l=c),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):d(this,t,e)},p.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return i},p.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(o,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){return this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},i.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new i(1),o=new i(0),a=new i(0),s=new i(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(f)),n.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(s)):(r.isub(e),a.isub(n),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},i.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new i(1),a=new i(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new w(t)},i.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return this._forceRed(t)},i.prototype.redAdd=function(t){return this.red.add(this,t)},i.prototype.redIAdd=function(t){return this.red.iadd(this,t)},i.prototype.redSub=function(t){return this.red.sub(this,t)},i.prototype.redISub=function(t){return this.red.isub(this,t)},i.prototype.redShl=function(t){return this.red.shl(this,t)},i.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}m.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},r(g,m),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new y;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new v}return _[t]=e,e},w.prototype._verify1=function(t){},w.prototype._verify2=function(t,e){},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new i(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),n=0;!r.isZero()&&0===r.andln(1);)n++,r.iushrn(1);var o=new i(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=n;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new i(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n=0;n--){for(var h=e.words[n],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===n&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},r(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_338,this),_$bn_338=_$bn_338.exports;var _$minimalisticAssert_383={};function __assert_383(t,e){if(!t)throw new Error(e||"Assertion failed")}_$minimalisticAssert_383=__assert_383,__assert_383.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var _$utils_384={},utils=_$utils_384;function zero2(t){return 1===t.length?"0"+t:t}function toHex(t){for(var e="",r=0;r>8,a=255&n;o?r.push(o,a):r.push(a)}return r},utils.zero2=zero2,utils.toHex=toHex,utils.encode=function(t,e){return"hex"===e?toHex(t):t};var _$utils_337={},__utils_337=_$utils_337;__utils_337.assert=_$minimalisticAssert_383,__utils_337.toArray=_$utils_384.toArray,__utils_337.zero2=_$utils_384.zero2,__utils_337.toHex=_$utils_384.toHex,__utils_337.encode=_$utils_384.encode,__utils_337.getNAF=function(t,e,r){var i,n=new Array(Math.max(t.bitLength(),r)+1);for(i=0;i(o>>1)-1?(o>>1)-u:u,a.isubn(s)):s=0,n[i]=s,a.iushrn(1)}return n},__utils_337.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,o=0;t.cmpn(-n)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+n&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),a=0==(1&u)?0:3!=(i=t.andln(7)+n&7)&&5!==i||2!==h?u:-u,r[0].push(a),s=0==(1&h)?0:3!=(i=e.andln(7)+o&7)&&5!==i||2!==u?h:-h,r[1].push(s),2*n===a+1&&(n=1-n),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},__utils_337.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},__utils_337.parseBytes=function(t){return"string"==typeof t?__utils_337.toArray(t,"hex"):t},__utils_337.intFromLE=function(t){return new _$bn_338(t,"hex","le")};var _$brorand_215={},r;function Rand(t){this.rand=t}if(_$brorand_215=function(t){return r||(r=new Rand(null)),r.generate(t)},_$brorand_215.Rand=Rand,Rand.prototype.generate=function(t){return this._rand(t)},Rand.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(t,e){this.curve=t,this.type=e,this.precomputed=null}_$utils_337.assert,_$base_324=BaseCurve,BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(t,e){var r=t._getDoubles(),i=getNAF(e,1,this._bitLength),n=(1<=o;u--)a=(a<<1)+i[u];s.push(a)}for(var h=this.jpoint(null,null,null),f=this.jpoint(null,null,null),c=n;c>0;c--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var h=o[s];a="affine"===t.type?h>0?a.mixedAdd(n[h-1>>1]):a.mixedAdd(n[-h-1>>1].neg()):h>0?a.add(n[h-1>>1]):a.add(n[-h-1>>1].neg())}return"affine"===t.type?a.toP():a},BaseCurve.prototype._wnafMulAdd=function(t,e,r,i,n){var o,a,s,u=this._wnafT1,h=this._wnafT2,f=this._wnafT3,c=0;for(o=0;o=1;o-=2){var d=o-1,p=o;if(1===u[d]&&1===u[p]){var _=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(_[1]=e[d].add(e[p]),_[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(_[1]=e[d].toJ().mixedAdd(e[p]),_[2]=e[d].add(e[p].neg())):(_[1]=e[d].toJ().mixedAdd(e[p]),_[2]=e[d].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF(r[d],r[p]);for(c=Math.max(g[0].length,c),f[d]=new Array(c),f[p]=new Array(c),a=0;a=0;o--){for(var M=0;o>=0;){var $=!0;for(a=0;a=0&&M++,v=v.dblp(M),o<0)break;for(a=0;a0?s=h[a][E-1>>1]:E<0&&(s=h[a][-E-1>>1].neg()),v="affine"===s.type?v.mixedAdd(s):v.add(s))}}for(o=0;o=Math.ceil((t.bitLength()+1)/e.step)},BasePoint.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n=0&&(o=e,a=r),i.negative&&(i=i.neg(),n=n.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:n},{a:o,b:a}]},ShortCurve.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=n.mul(r.a),s=o.mul(i.a),u=n.mul(r.b),h=o.mul(i.b);return{k1:t.sub(a).sub(s),k2:u.add(h).neg()}},ShortCurve.prototype.pointFromX=function(t,e){(t=new _$bn_338(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},ShortCurve.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o":""},__Point_328.prototype.isInfinity=function(){return this.inf},__Point_328.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},__Point_328.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},__Point_328.prototype.getX=function(){return this.x.fromRed()},__Point_328.prototype.getY=function(){return this.y.fromRed()},__Point_328.prototype.mul=function(t){return t=new _$bn_338(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},__Point_328.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},__Point_328.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},__Point_328.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},__Point_328.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},__Point_328.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},_$inherits_browser_375(JPoint,_$base_324.BasePoint),ShortCurve.prototype.jpoint=function(t,e,r){return new JPoint(this,t,e,r)},JPoint.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),f=h.redMul(s),c=i.redMul(h),l=u.redSqr().redIAdd(f).redISub(c).redISub(c),d=u.redMul(c.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,d,p)},JPoint.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(i),s=n.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),h=u.redMul(a),f=r.redMul(u),c=s.redSqr().redIAdd(h).redISub(f).redISub(f),l=s.redMul(f.redISub(c)).redISub(n.redMul(h)),d=this.z.redMul(a);return this.curve.jpoint(c,l,d)},JPoint.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},JPoint.prototype.inspect=function(){return this.isInfinity()?"":""},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _$mont_327={};function MontCurve(t){_$base_324.call(this,"mont",t),this.a=new _$bn_338(t.a,16).toRed(this.red),this.b=new _$bn_338(t.b,16).toRed(this.red),this.i4=new _$bn_338(4).toRed(this.red).redInvm(),this.two=new _$bn_338(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function __Point_327(t,e,r){_$base_324.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new _$bn_338(e,16),this.z=new _$bn_338(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}_$inherits_browser_375(MontCurve,_$base_324),_$mont_327=MontCurve,MontCurve.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},_$inherits_browser_375(__Point_327,_$base_324.BasePoint),MontCurve.prototype.decodePoint=function(t,e){return this.point(_$utils_337.toArray(t,e),1)},MontCurve.prototype.point=function(t,e){return new __Point_327(this,t,e)},MontCurve.prototype.pointFromJSON=function(t){return __Point_327.fromJSON(this,t)},__Point_327.prototype.precompute=function(){},__Point_327.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},__Point_327.fromJSON=function(t,e){return new __Point_327(t,e[0],e[1]||t.one)},__Point_327.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_327.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},__Point_327.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},__Point_327.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},__Point_327.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=n.redMul(i),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},__Point_327.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},__Point_327.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_327.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},__Point_327.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},__Point_327.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},__Point_327.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var _$edwards_325={};function EdwardsCurve(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,_$base_324.call(this,"edwards",t),this.a=new _$bn_338(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _$bn_338(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _$bn_338(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),this.oneC=1==(0|t.c)}function __Point_325(t,e,r,i,n){_$base_324.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(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 _$bn_338(e,16),this.y=new _$bn_338(r,16),this.z=i?new _$bn_338(i,16):this.curve.one,this.t=n&&new _$bn_338(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.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()))))}_$utils_337.assert,_$inherits_browser_375(EdwardsCurve,_$base_324),_$edwards_325=EdwardsCurve,EdwardsCurve.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},EdwardsCurve.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},EdwardsCurve.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},EdwardsCurve.prototype.pointFromX=function(t,e){(t=new _$bn_338(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(n.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},EdwardsCurve.prototype.pointFromY=function(t,e){(t=new _$bn_338(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(n.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},EdwardsCurve.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},_$inherits_browser_375(__Point_325,_$base_324.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(t){return __Point_325.fromJSON(this,t)},EdwardsCurve.prototype.point=function(t,e,r,i){return new __Point_325(this,t,e,r,i)},__Point_325.fromJSON=function(t,e){return new __Point_325(t,e[0],e[1],e[2])},__Point_325.prototype.inspect=function(){return this.isInfinity()?"":""},__Point_325.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},__Point_325.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=i.redAdd(e),a=o.redSub(r),s=i.redSub(e),u=n.redMul(a),h=o.redMul(s),f=n.redMul(s),c=a.redMul(o);return this.curve.point(u,h,c,f)},__Point_325.prototype._projDbl=function(){var t,e,r,i,n,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var h=(i=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(h.redSub(this.curve.two)),e=h.redMul(i.redSub(u)),r=h.redSqr().redSub(h).redSub(h)):(n=this.z.redSqr(),o=h.redSub(n).redISub(n),t=a.redSub(s).redISub(u).redMul(o),e=h.redMul(i.redSub(u)),r=h.redMul(o))}else i=s.redAdd(u),n=this.curve._mulC(this.z).redSqr(),o=i.redSub(n).redSub(n),t=this.curve._mulC(a.redISub(i)).redMul(o),e=this.curve._mulC(i).redMul(s.redISub(u)),r=i.redMul(o);return this.curve.point(t,e,r)},__Point_325.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},__Point_325.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=n.redSub(i),s=n.redAdd(i),u=r.redAdd(e),h=o.redMul(a),f=s.redMul(u),c=o.redMul(u),l=a.redMul(s);return this.curve.point(h,f,l,c)},__Point_325.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=n.redSub(s),h=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),c=i.redMul(u).redMul(f);return this.curve.twisted?(e=i.redMul(h).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=i.redMul(h).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(c,e,r)},__Point_325.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},__Point_325.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},__Point_325.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},__Point_325.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},__Point_325.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},__Point_325.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},__Point_325.prototype.getX=function(){return this.normalize(),this.x.fromRed()},__Point_325.prototype.getY=function(){return this.normalize(),this.y.fromRed()},__Point_325.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},__Point_325.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},__Point_325.prototype.toP=__Point_325.prototype.normalize,__Point_325.prototype.mixedAdd=__Point_325.prototype.add;var _$curve_326={},__curve_326=_$curve_326;__curve_326.base=_$base_324,__curve_326.short=_$short_328,__curve_326.mont=_$mont_327,__curve_326.edwards=_$edwards_325;var _$utils_371={};function isSurrogatePair(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function htonl(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function __zero2_371(t){return 1===t.length?"0"+t:t}function zero8(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}_$utils_371.inherits=_$inherits_browser_375,_$utils_371.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):isSurrogatePair(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return n},_$utils_371.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},_$utils_371.rotr32=function(t,e){return t>>>e|t<<32-e},_$utils_371.rotl32=function(t,e){return t<>>32-e},_$utils_371.sum32=function(t,e){return t+e>>>0},_$utils_371.sum32_3=function(t,e,r){return t+e+r>>>0},_$utils_371.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},_$utils_371.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},_$utils_371.sum64=function(t,e,r,i){var n=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},_$utils_371.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},_$utils_371.sum64_lo=function(t,e,r,i){return e+i>>>0},_$utils_371.sum64_4_hi=function(t,e,r,i,n,o,a,s){var u=0,h=e;return u+=(h=h+i>>>0)>>0)>>0)>>0},_$utils_371.sum64_4_lo=function(t,e,r,i,n,o,a,s){return e+i+o+s>>>0},_$utils_371.sum64_5_hi=function(t,e,r,i,n,o,a,s,u,h){var f=0,c=e;return f+=(c=c+i>>>0)>>0)>>0)>>0)>>0},_$utils_371.sum64_5_lo=function(t,e,r,i,n,o,a,s,u,h){return e+i+o+s+h>>>0},_$utils_371.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},_$utils_371.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},_$utils_371.shr64_hi=function(t,e,r){return t>>>r},_$utils_371.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var _$common_361={};function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_$common_361.BlockHash=BlockHash,BlockHash.prototype.update=function(t,e){if(t=_$utils_371.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=_$utils_371.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o>>3},_$common_370.g1_256=function(t){return rotr32(t,17)^rotr32(t,19)^t>>>10};var _$1_365={},rotl32=_$utils_371.rotl32,sum32=_$utils_371.sum32,sum32_5=_$utils_371.sum32_5,ft_1=_$common_370.ft_1,__BlockHash_365=_$common_361.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;__BlockHash_365.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}_$utils_371.inherits(SHA1,__BlockHash_365),_$1_365=SHA1,SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest());for(var e=t.length;ethis.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=_$utils_384.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length"};var _$signature_332={};function Signature(t,e){if(t instanceof Signature)return t;this._importDER(t,e)||(this.r=new _$bn_338(t.r,16),this.s=new _$bn_338(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function Position(){this.place=0}function getLength(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;if(0===t[e.place])return!1;for(var n=0,o=0,a=e.place;o>>=0;return!(n<=127)&&(e.place=a,n)}function rmPadding(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}_$utils_337.assert,_$signature_332=Signature,Signature.prototype._importDER=function(t,e){t=_$utils_337.toArray(t,e);var r=new Position;if(48!==t[r.place++])return!1;var i=getLength(t,r);if(!1===i)return!1;if(i+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=getLength(t,r);if(!1===n)return!1;if(0!=(128&t[r.place]))return!1;var o=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var a=getLength(t,r);if(!1===a)return!1;if(t.length!==a+r.place)return!1;if(0!=(128&t[r.place]))return!1;var s=t.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new _$bn_338(o),this.s=new _$bn_338(s),this.recoveryParam=null,!0},Signature.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=rmPadding(e),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];constructLength(i,e.length),(i=i.concat(e)).push(2),constructLength(i,r.length);var n=i.concat(r),o=[48];return constructLength(o,n.length),o=o.concat(n),_$utils_337.encode(o,t)};var _$ec_330={},__KeyPair_330=(_$utils_337.assert,_$key_331);function EC(t){if(!(this instanceof EC))return new EC(t);"string"==typeof t&&(t=_$curves_329[t]),t instanceof _$curves_329.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}_$ec_330=EC,EC.prototype.keyPair=function(t){return new __KeyPair_330(this,t)},EC.prototype.keyFromPrivate=function(t,e){return __KeyPair_330.fromPrivate(this,t,e)},EC.prototype.keyFromPublic=function(t,e){return __KeyPair_330.fromPublic(this,t,e)},EC.prototype.genKeyPair=function(t){t||(t={});for(var e=new _$hmacDrbg_373({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||_$brorand_215(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new _$bn_338(2));;){var n=new _$bn_338(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},EC.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},EC.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new _$bn_338(t,16));for(var n=this.n.byteLength(),o=e.getPrivate().toArray("be",n),a=t.toArray("be",n),s=new _$hmacDrbg_373({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new _$bn_338(1)),h=0;;h++){var f=i.k?i.k(h):new _$bn_338(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var c=this.g.mul(f);if(!c.isInfinity()){var l=c.getX(),d=l.umod(this.n);if(0!==d.cmpn(0)){var p=f.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var _=(c.getY().isOdd()?1:0)|(0!==l.cmp(d)?2:0);return i.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),_^=1),new _$signature_332({r:d,s:p,recoveryParam:_})}}}}}},EC.prototype.verify=function(t,e,r,i){t=this._truncateToN(new _$bn_338(t,16)),r=this.keyFromPublic(r,i);var n=(e=new _$signature_332(e,"hex")).r,o=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),h=s.mul(n).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),h)).isInfinity()&&a.eqXToP(n):!(a=this.g.mulAdd(u,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(n)},EC.prototype.recoverPubKey=function(t,e,r,i){e=new _$signature_332(e,i);var n=this.n,o=new _$bn_338(t),a=e.r,s=e.s,u=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=e.r.invm(n),c=n.sub(o).mul(f).umod(n),l=s.mul(f).umod(n);return this.g.mulAdd(c,a,l)},EC.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new _$signature_332(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch(t){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var _$key_334={},parseBytes=(_$utils_337.assert,_$utils_337.parseBytes),cachedProperty=_$utils_337.cachedProperty;function __KeyPair_334(t,e){this.eddsa=t,this._secret=parseBytes(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=parseBytes(e.pub)}__KeyPair_334.fromPublic=function(t,e){return e instanceof __KeyPair_334?e:new __KeyPair_334(t,{pub:e})},__KeyPair_334.fromSecret=function(t,e){return e instanceof __KeyPair_334?e:new __KeyPair_334(t,{secret:e})},__KeyPair_334.prototype.secret=function(){return this._secret},cachedProperty(__KeyPair_334,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty(__KeyPair_334,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty(__KeyPair_334,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),cachedProperty(__KeyPair_334,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty(__KeyPair_334,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty(__KeyPair_334,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),__KeyPair_334.prototype.sign=function(t){return this.eddsa.sign(t,this)},__KeyPair_334.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},__KeyPair_334.prototype.getSecret=function(t){return _$utils_337.encode(this.secret(),t)},__KeyPair_334.prototype.getPublic=function(t){return _$utils_337.encode(this.pubBytes(),t)},_$key_334=__KeyPair_334;var _$signature_335={},__cachedProperty_335=(_$utils_337.assert,_$utils_337.cachedProperty),__parseBytes_335=_$utils_337.parseBytes;function __Signature_335(t,e){this.eddsa=t,"object"!=typeof e&&(e=__parseBytes_335(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof _$bn_338&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}__cachedProperty_335(__Signature_335,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),__cachedProperty_335(__Signature_335,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),__cachedProperty_335(__Signature_335,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),__cachedProperty_335(__Signature_335,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),__Signature_335.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},__Signature_335.prototype.toHex=function(){return _$utils_337.encode(this.toBytes(),"hex").toUpperCase()},_$signature_335=__Signature_335;var _$eddsa_333={},__parseBytes_333=(_$utils_337.assert,_$utils_337.parseBytes);function EDDSA(t){if(!(this instanceof EDDSA))return new EDDSA(t);t=_$curves_329[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=_$hash_360.sha512}_$eddsa_333=EDDSA,EDDSA.prototype.sign=function(t,e){t=__parseBytes_333(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),o=this.encodePoint(n),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),s=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:o})},EDDSA.prototype.verify=function(t,e,r){if(t=__parseBytes_333(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(o)},EDDSA.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=0)return null;var i=(r=r.toRed(ecparams.red)).redSqr().redIMul(r).redIAdd(ecparams.b).redSqrt();return 3===t!==i.isOdd()&&(i=i.redNeg()),ec.keyPair({pub:{x:r,y:i}})}(e,t.slice(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,r){var i=new _$bn_444(e),n=new _$bn_444(r);if(i.cmp(ecparams.p)>=0||n.cmp(ecparams.p)>=0)return null;if(i=i.toRed(ecparams.red),n=n.toRed(ecparams.red),(6===t||7===t)&&n.isOdd()!==(7===t))return null;var o=i.redSqr().redIMul(i);return n.redSqr().redISub(o.redIAdd(ecparams.b)).isZero()?ec.keyPair({pub:{x:i,y:n}}):null}(e,t.slice(1,33),t.slice(33,65));default:return null}}_$elliptic_441.privateKeyVerify=function(t){var e=new _$bn_444(t);return e.cmp(ecparams.n)<0&&!e.isZero()},_$elliptic_441.privateKeyExport=function(t,e){var r=new _$bn_444(t);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_443.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return __Buffer_441.from(ec.keyFromPrivate(t).getPublic(e,!0))},_$elliptic_441.privateKeyNegate=function(t){var e=new _$bn_444(t);return e.isZero()?__Buffer_441.alloc(32):ecparams.n.sub(e).umod(ecparams.n).toArrayLike(__Buffer_441,"be",32)},_$elliptic_441.privateKeyModInverse=function(t){var e=new _$bn_444(t);if(e.cmp(ecparams.n)>=0||e.isZero())throw new Error(_$messages_443.EC_PRIVATE_KEY_RANGE_INVALID);return e.invm(ecparams.n).toArrayLike(__Buffer_441,"be",32)},_$elliptic_441.privateKeyTweakAdd=function(t,e){var r=new _$bn_444(e);if(r.cmp(ecparams.n)>=0)throw new Error(_$messages_443.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(r.iadd(new _$bn_444(t)),r.cmp(ecparams.n)>=0&&r.isub(ecparams.n),r.isZero())throw new Error(_$messages_443.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return r.toArrayLike(__Buffer_441,"be",32)},_$elliptic_441.privateKeyTweakMul=function(t,e){var r=new _$bn_444(e);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_443.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return r.imul(new _$bn_444(t)),r.cmp(ecparams.n)&&(r=r.umod(ecparams.n)),r.toArrayLike(__Buffer_441,"be",32)},_$elliptic_441.publicKeyCreate=function(t,e){var r=new _$bn_444(t);if(r.cmp(ecparams.n)>=0||r.isZero())throw new Error(_$messages_443.EC_PUBLIC_KEY_CREATE_FAIL);return __Buffer_441.from(ec.keyFromPrivate(t).getPublic(e,!0))},_$elliptic_441.publicKeyConvert=function(t,e){var r=loadPublicKey(t);if(null===r)throw new Error(_$messages_443.EC_PUBLIC_KEY_PARSE_FAIL);return __Buffer_441.from(r.getPublic(e,!0))},_$elliptic_441.publicKeyVerify=function(t){return null!==loadPublicKey(t)},_$elliptic_441.publicKeyTweakAdd=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_443.EC_PUBLIC_KEY_PARSE_FAIL);if((e=new _$bn_444(e)).cmp(ecparams.n)>=0)throw new Error(_$messages_443.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var n=ecparams.g.mul(e).add(i.pub);if(n.isInfinity())throw new Error(_$messages_443.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return __Buffer_441.from(n.encode(!0,r))},_$elliptic_441.publicKeyTweakMul=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_443.EC_PUBLIC_KEY_PARSE_FAIL);if((e=new _$bn_444(e)).cmp(ecparams.n)>=0||e.isZero())throw new Error(_$messages_443.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return __Buffer_441.from(i.pub.mul(e).encode(!0,r))},_$elliptic_441.publicKeyCombine=function(t,e){for(var r=new Array(t.length),i=0;i=0||r.cmp(ecparams.n)>=0)throw new Error(_$messages_443.ECDSA_SIGNATURE_PARSE_FAIL);var i=__Buffer_441.from(t);return 1===r.cmp(ec.nh)&&ecparams.n.sub(r).toArrayLike(__Buffer_441,"be",32).copy(i,32),i},_$elliptic_441.signatureExport=function(t){var e=t.slice(0,32),r=t.slice(32,64);if(new _$bn_444(e).cmp(ecparams.n)>=0||new _$bn_444(r).cmp(ecparams.n)>=0)throw new Error(_$messages_443.ECDSA_SIGNATURE_PARSE_FAIL);return{r:e,s:r}},_$elliptic_441.signatureImport=function(t){var e=new _$bn_444(t.r);e.cmp(ecparams.n)>=0&&(e=new _$bn_444(0));var r=new _$bn_444(t.s);return r.cmp(ecparams.n)>=0&&(r=new _$bn_444(0)),__Buffer_441.concat([e.toArrayLike(__Buffer_441,"be",32),r.toArrayLike(__Buffer_441,"be",32)])},_$elliptic_441.sign=function(t,e,r,i){if("function"==typeof r){var n=r;r=function(r){var o=n(t,e,null,i,r);if(!__Buffer_441.isBuffer(o)||32!==o.length)throw new Error(_$messages_443.ECDSA_SIGN_FAIL);return new _$bn_444(o)}}var o=new _$bn_444(e);if(o.cmp(ecparams.n)>=0||o.isZero())throw new Error(_$messages_443.ECDSA_SIGN_FAIL);var a=ec.sign(t,e,{canonical:!0,k:r,pers:i});return{signature:__Buffer_441.concat([a.r.toArrayLike(__Buffer_441,"be",32),a.s.toArrayLike(__Buffer_441,"be",32)]),recovery:a.recoveryParam}},_$elliptic_441.verify=function(t,e,r){var i={r:e.slice(0,32),s:e.slice(32,64)},n=new _$bn_444(i.r),o=new _$bn_444(i.s);if(n.cmp(ecparams.n)>=0||o.cmp(ecparams.n)>=0)throw new Error(_$messages_443.ECDSA_SIGNATURE_PARSE_FAIL);if(1===o.cmp(ec.nh)||n.isZero()||o.isZero())return!1;var a=loadPublicKey(r);if(null===a)throw new Error(_$messages_443.EC_PUBLIC_KEY_PARSE_FAIL);return ec.verify(t,i,{x:a.pub.x,y:a.pub.y})},_$elliptic_441.recover=function(t,e,r,i){var n={r:e.slice(0,32),s:e.slice(32,64)},o=new _$bn_444(n.r),a=new _$bn_444(n.s);if(o.cmp(ecparams.n)>=0||a.cmp(ecparams.n)>=0)throw new Error(_$messages_443.ECDSA_SIGNATURE_PARSE_FAIL);try{if(o.isZero()||a.isZero())throw new Error;var s=ec.recoverPubKey(t,n,r);return __Buffer_441.from(s.encode(!0,i))}catch(u){throw new Error(_$messages_443.ECDSA_RECOVER_FAIL)}},_$elliptic_441.ecdh=function(t,e){var r=_$elliptic_441.ecdhUnsafe(t,e,!0);return _$browser_262("sha256").update(r).digest()},_$elliptic_441.ecdhUnsafe=function(t,e,r){var i=loadPublicKey(t);if(null===i)throw new Error(_$messages_443.EC_PUBLIC_KEY_PARSE_FAIL);var n=new _$bn_444(e);if(n.cmp(ecparams.n)>=0||n.isZero())throw new Error(_$messages_443.ECDH_FAIL);return __Buffer_441.from(i.pub.mul(n).encode(!0,r))};var _$elliptic_438=_$lib_442(_$elliptic_441),_$bitcoinjsMessage_213={};(function(t){(function(){function e(t){return _$browser_262("sha256").update(t).digest()}function r(r,i){i=i||"\x18Bitcoin Signed Message:\n",t.isBuffer(i)||(i=t.from(i,"utf8"));var n=_$varuintBitcoin_483.encodingLength(r.length),o=t.allocUnsafe(i.length+n+r.length);return i.copy(o,0),_$varuintBitcoin_483.encode(r.length,o,i.length),o.write(r,i.length+n),function(t){return e(e(t))}(o)}_$bitcoinjsMessage_213={sign:function(e,i,n,o){var a=r(e,o),s=_$elliptic_438.sign(a,i);return function(e,r,i){return i&&(r+=4),t.concat([t.alloc(1,r+27),e])}(s.signature,s.recovery,n)},verify:function(i,n,o,a){t.isBuffer(o)||(o=t.from(o,"base64"));var s,u=function(t){if(65!==t.length)throw new Error("Invalid signature length");var e=t.readUInt8(0)-27;if(e>7)throw new Error("Invalid signature parameter");return{compressed:!!(4&e),recovery:3&e,signature:t.slice(1)}}(o),h=r(i,a),f=(s=_$elliptic_438.recover(h,u.signature,u.recovery,u.compressed),_$browser_262("ripemd160").update(e(s)).digest()),c=_$bs58check_247.decode(n).slice(1);return _$bufferEquals_248(f,c)}}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$Error_342=Error,_$EvalError_341=EvalError,_$RangeError_343=RangeError,_$ReferenceError_344=ReferenceError,_$SyntaxError_345=SyntaxError,_$TypeError_346=TypeError,_$URIError_347=URIError,_$shams_358=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0},origSymbol="undefined"!=typeof Symbol&&Symbol,_$hasSymbols_357=function(){return"function"==typeof origSymbol&&"function"==typeof Symbol&&"symbol"==typeof origSymbol("foo")&&"symbol"==typeof Symbol("bar")&&_$shams_358()},test={__proto__:null,foo:{}},$Object=Object,_$hasProto_356=function(){return{__proto__:test}.foo===test.foo&&!(test instanceof $Object)},toStr=Object.prototype.toString,max=Math.max,concatty=function(t,e){for(var r=[],i=0;i1&&"boolean"!=typeof e)throw new _$TypeError_346('"allowMissing" argument must be a boolean');if(null===$exec(/^%?[^%]*%?$/,t))throw new _$SyntaxError_345("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=$strSlice(t,0,1),r=$strSlice(t,-1);if("%"===e&&"%"!==r)throw new _$SyntaxError_345("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new _$SyntaxError_345("invalid intrinsic syntax, expected opening `%`");var i=[];return $replace(t,rePropName,(function(t,e,r,n){i[i.length]=r?$replace(n,reEscapeChar,"$1"):e||t})),i}(t),i=r.length>0?r[0]:"",n=getBaseIntrinsic("%"+i+"%",e),o=n.name,a=n.value,s=!1,u=n.alias;u&&(i=u[0],$spliceApply(r,$concat([0,1],u)));for(var h=1,f=!0;h=r.length){var p=$gOPD(a,c);a=(f=!!p)&&"get"in p&&!("originalValue"in p.get)?p.get:a[c]}else f=_$hasown_372(a,c),a=a[c];f&&!s&&(INTRINSICS[o]=a)}}return a},$defineProperty=_$getIntrinsic_353("%Object.defineProperty%",!0)||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}var _$$defineProperty_340=$defineProperty,__$gOPD_354=_$getIntrinsic_353("%Object.getOwnPropertyDescriptor%",!0);if(__$gOPD_354)try{__$gOPD_354([],"length")}catch(e){__$gOPD_354=null}var _$$gOPD_354=__$gOPD_354,_$defineDataProperty_301=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new _$TypeError_346("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new _$TypeError_346("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new _$TypeError_346("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new _$TypeError_346("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new _$TypeError_346("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new _$TypeError_346("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6&&arguments[6],s=!!_$$gOPD_354&&_$$gOPD_354(t,e);if(_$$defineProperty_340)_$$defineProperty_340(t,e,{configurable:null===o&&s?s.configurable:!o,enumerable:null===i&&s?s.enumerable:!i,value:r,writable:null===n&&s?s.writable:!n});else{if(!a&&(i||n||o))throw new _$SyntaxError_345("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}},_$hasPropertyDescriptors_355={},hasPropertyDescriptors=function(){return!!_$$defineProperty_340};hasPropertyDescriptors.hasArrayLengthDefineBug=function(){if(!_$$defineProperty_340)return null;try{return 1!==_$$defineProperty_340([],"length",{value:1}).length}catch(e){return!0}},_$hasPropertyDescriptors_355=hasPropertyDescriptors;var hasDescriptors=_$hasPropertyDescriptors_355(),$floor=_$getIntrinsic_353("%Math.floor%"),_$setFunctionLength_445=function(t,e){if("function"!=typeof t)throw new _$TypeError_346("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||$floor(e)!==e)throw new _$TypeError_346("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,n=!0;if("length"in t&&_$$gOPD_354){var o=_$$gOPD_354(t,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(n=!1)}return(i||n||!r)&&(hasDescriptors?_$defineDataProperty_301(t,"length",e,!0,!0):_$defineDataProperty_301(t,"length",e)),t},_$callBind_253={},$apply=_$getIntrinsic_353("%Function.prototype.apply%"),$call=_$getIntrinsic_353("%Function.prototype.call%"),$reflectApply=_$getIntrinsic_353("%Reflect.apply%",!0)||_$functionBind_352.call($call,$apply),$max=_$getIntrinsic_353("%Math.max%");_$callBind_253=function(t){if("function"!=typeof t)throw new _$TypeError_346("a function is required");var e=$reflectApply(_$functionBind_352,$call,arguments);return _$setFunctionLength_445(e,1+$max(0,t.length-(arguments.length-1)),!0)};var applyBind=function(){return $reflectApply(_$functionBind_352,$apply,arguments)};_$$defineProperty_340?_$$defineProperty_340(_$callBind_253,"apply",{value:applyBind}):_$callBind_253.apply=applyBind;var $indexOf=_$callBind_253(_$getIntrinsic_353("String.prototype.indexOf")),_$callBound_252=function(t,e){var r=_$getIntrinsic_353(t,!!e);return"function"==typeof r&&$indexOf(t,".prototype.")>-1?_$callBind_253(r):r},_$inspect__385={};(function(t){(function(){var r="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=r&&i&&"function"==typeof i.get?i.get:null,o=r&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,s=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=a&&s&&"function"==typeof s.get?s.get:null,h=a&&Set.prototype.forEach,f="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,c="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,l="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,d=Boolean.prototype.valueOf,p=Object.prototype.toString,_=Function.prototype.toString,m=String.prototype.match,g=String.prototype.slice,y=String.prototype.replace,b=String.prototype.toUpperCase,v=String.prototype.toLowerCase,w=RegExp.prototype.test,M=Array.prototype.concat,$=Array.prototype.join,E=Array.prototype.slice,S=Math.floor,A="function"==typeof BigInt?BigInt.prototype.valueOf:null,B=Object.getOwnPropertySymbols,k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,T="function"==typeof Symbol&&"object"==typeof Symbol.iterator,x="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,I=Object.prototype.propertyIsEnumerable,P=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function R(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||w.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var i=t<0?-S(-t):S(t);if(i!==t){var n=String(i),o=g.call(e,n.length+1);return y.call(n,r,"$&_")+"."+y.call(y.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return y.call(e,r,"$&_")}var C=_$empty_216({}),O=C.custom,N=H(O)?O:null;function L(t,e,r){var i="double"===(r.quoteStyle||e)?'"':"'";return i+t+i}function D(t){return y.call(String(t),/"/g,""")}function U(t){return!("[object Array]"!==K(t)||x&&"object"==typeof t&&x in t)}function j(t){return!("[object RegExp]"!==K(t)||x&&"object"==typeof t&&x in t)}function H(t){if(T)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!k)return!1;try{return k.call(t),!0}catch(e){}return!1}_$inspect__385=function r(i,a,s,p){var b=a||{};if(q(b,"quoteStyle")&&"single"!==b.quoteStyle&&"double"!==b.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(q(b,"maxStringLength")&&("number"==typeof b.maxStringLength?b.maxStringLength<0&&b.maxStringLength!==1/0:null!==b.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var w=!q(b,"customInspect")||b.customInspect;if("boolean"!=typeof w&&"symbol"!==w)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(q(b,"indent")&&null!==b.indent&&"\t"!==b.indent&&!(parseInt(b.indent,10)===b.indent&&b.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(q(b,"numericSeparator")&&"boolean"!=typeof b.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var S=b.numericSeparator;if(void 0===i)return"undefined";if(null===i)return"null";if("boolean"==typeof i)return i?"true":"false";if("string"==typeof i)return function t(e,r){if(e.length>r.maxStringLength){var i=e.length-r.maxStringLength,n="... "+i+" more character"+(i>1?"s":"");return t(g.call(e,0,r.maxStringLength),r)+n}return L(y.call(y.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,V),"single",r)}(i,b);if("number"==typeof i){if(0===i)return 1/0/i>0?"0":"-0";var B=String(i);return S?R(i,B):B}if("bigint"==typeof i){var O=String(i)+"n";return S?R(i,O):O}var z=void 0===b.depth?5:b.depth;if(void 0===s&&(s=0),s>=z&&z>0&&"object"==typeof i)return U(i)?"[Array]":"[Object]";var X=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=$.call(Array(t.indent+1)," ")}return{base:r,prev:$.call(Array(e+1),r)}}(b,s);if(void 0===p)p=[];else if(F(p,i)>=0)return"[Circular]";function Q(t,e,i){if(e&&(p=E.call(p)).push(e),i){var n={depth:b.depth};return q(b,"quoteStyle")&&(n.quoteStyle=b.quoteStyle),r(t,n,s+1,p)}return r(t,b,s+1,p)}if("function"==typeof i&&!j(i)){var tt=function(t){if(t.name)return t.name;var e=m.call(_.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(i),et=Y(i,Q);return"[Function"+(tt?": "+tt:" (anonymous)")+"]"+(et.length>0?" { "+$.call(et,", ")+" }":"")}if(H(i)){var rt=T?y.call(String(i),/^(Symbol\(.*\))_[^)]*$/,"$1"):k.call(i);return"object"!=typeof i||T?rt:G(rt)}if(function(t){return!(!t||"object"!=typeof t)&&("undefined"!=typeof HTMLElement&&t instanceof HTMLElement||"string"==typeof t.nodeName&&"function"==typeof t.getAttribute)}(i)){for(var it="<"+v.call(String(i.nodeName)),nt=i.attributes||[],ot=0;ot"}if(U(i)){if(0===i.length)return"[]";var at=Y(i,Q);return X&&!function(t){for(var e=0;e=0)return!1;return!0}(at)?"["+J(at,X)+"]":"[ "+$.call(at,", ")+" ]"}if(function(t){return!("[object Error]"!==K(t)||x&&"object"==typeof t&&x in t)}(i)){var st=Y(i,Q);return"cause"in Error.prototype||!("cause"in i)||I.call(i,"cause")?0===st.length?"["+String(i)+"]":"{ ["+String(i)+"] "+$.call(st,", ")+" }":"{ ["+String(i)+"] "+$.call(M.call("[cause]: "+Q(i.cause),st),", ")+" }"}if("object"==typeof i&&w){if(N&&"function"==typeof i[N]&&C)return C(i,{depth:z-s});if("symbol"!==w&&"function"==typeof i.inspect)return i.inspect()}if(function(t){if(!n||!t||"object"!=typeof t)return!1;try{n.call(t);try{u.call(t)}catch(it){return!0}return t instanceof Map}catch(e){}return!1}(i)){var ut=[];return o&&o.call(i,(function(t,e){ut.push(Q(e,i,!0)+" => "+Q(t,i))})),Z("Map",n.call(i),ut,X)}if(function(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t);try{n.call(t)}catch(r){return!0}return t instanceof Set}catch(e){}return!1}(i)){var ht=[];return h&&h.call(i,(function(t){ht.push(Q(t,i))})),Z("Set",u.call(i),ht,X)}if(function(t){if(!f||!t||"object"!=typeof t)return!1;try{f.call(t,f);try{c.call(t,c)}catch(it){return!0}return t instanceof WeakMap}catch(e){}return!1}(i))return W("WeakMap");if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t,c);try{f.call(t,f)}catch(it){return!0}return t instanceof WeakSet}catch(e){}return!1}(i))return W("WeakSet");if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{return l.call(t),!0}catch(e){}return!1}(i))return W("WeakRef");if(function(t){return!("[object Number]"!==K(t)||x&&"object"==typeof t&&x in t)}(i))return G(Q(Number(i)));if(function(t){if(!t||"object"!=typeof t||!A)return!1;try{return A.call(t),!0}catch(e){}return!1}(i))return G(Q(A.call(i)));if(function(t){return!("[object Boolean]"!==K(t)||x&&"object"==typeof t&&x in t)}(i))return G(d.call(i));if(function(t){return!("[object String]"!==K(t)||x&&"object"==typeof t&&x in t)}(i))return G(Q(String(i)));if("undefined"!=typeof window&&i===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&i===globalThis||void 0!==t&&i===t)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==K(t)||x&&"object"==typeof t&&x in t)}(i)&&!j(i)){var ft=Y(i,Q),ct=P?P(i)===Object.prototype:i instanceof Object||i.constructor===Object,lt=i instanceof Object?"":"null prototype",dt=!ct&&x&&Object(i)===i&&x in i?g.call(K(i),8,-1):lt?"Object":"",pt=(ct||"function"!=typeof i.constructor?"":i.constructor.name?i.constructor.name+" ":"")+(dt||lt?"["+$.call(M.call([],dt||[],lt||[]),": ")+"] ":"");return 0===ft.length?pt+"{}":X?pt+"{"+J(ft,X)+"}":pt+"{ "+$.call(ft,", ")+" }"}return String(i)};var z=Object.prototype.hasOwnProperty||function(t){return t in this};function q(t,e){return z.call(t,e)}function K(t){return p.call(t)}function F(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;r1;){var e=t.pop(),r=e.obj[e.prop];if(isArray(r)){for(var i=[],n=0;n=1024?o.slice(s,s+1024):o,h=[],f=0;f=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||n===_$formats_409.RFC1738&&(40===c||41===c)?h[h.length]=u.charAt(f):c<128?h[h.length]=hexTable[c]:c<2048?h[h.length]=hexTable[192|c>>6]+hexTable[128|63&c]:c<55296||c>=57344?h[h.length]=hexTable[224|c>>12]+hexTable[128|c>>6&63]+hexTable[128|63&c]:(f+=1,c=65536+((1023&c)<<10|1023&u.charCodeAt(f)),h[h.length]=hexTable[240|c>>18]+hexTable[128|c>>12&63]+hexTable[128|c>>6&63]+hexTable[128|63&c])}a+=h.join("")}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(isArray(t)){for(var r=[],i=0;i0?v.join(",")||null:void 0}];else if(__isArray_412(f))S=f;else{var B=Object.keys(v);S=c?B.sort(c):B}var k=u?r.replace(/\./g,"%2E"):r,T=n&&__isArray_412(v)&&1===v.length?k+"[]":k;if(o&&__isArray_412(v)&&0===v.length)return T+"[]";for(var x=0;x0?l+c:""},__has_411=Object.prototype.hasOwnProperty,__isArray_411=Array.isArray,__defaults_411={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:_$utils_413.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},interpretNumericEntities=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},parseArrayValue=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},parseKeys=function(t,e,r,i){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(n),s=a?n.slice(0,a.index):n,u=[];if(s){if(!r.plainObjects&&__has_411.call(Object.prototype,s)&&!r.allowPrototypes)return;u.push(s)}for(var h=0;r.depth>0&&null!==(a=o.exec(n))&&h=0;--o){var a,s=t[o];if("[]"===s&&r.parseArrays)a=r.allowEmptyArrays&&(""===n||r.strictNullHandling&&null===n)?[]:[].concat(n);else{a=r.plainObjects?Object.create(null):{};var u="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,h=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,f=parseInt(h,10);r.parseArrays||""!==h?!isNaN(f)&&s!==h&&String(f)===h&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(a=[])[f]=n:"__proto__"!==h&&(a[h]=n):a={0:n}}n=a}return n}(u,e,r,i)}},_$parse_411=function(t,e){var r=function(t){if(!t)return __defaults_411;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.decodeDotInKeys&&"boolean"!=typeof t.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?__defaults_411.charset:t.charset,r=void 0===t.duplicates?__defaults_411.duplicates:t.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===t.allowDots?!0===t.decodeDotInKeys||__defaults_411.allowDots:!!t.allowDots,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:__defaults_411.allowEmptyArrays,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:__defaults_411.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:__defaults_411.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:__defaults_411.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:__defaults_411.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:__defaults_411.comma,decodeDotInKeys:"boolean"==typeof t.decodeDotInKeys?t.decodeDotInKeys:__defaults_411.decodeDotInKeys,decoder:"function"==typeof t.decoder?t.decoder:__defaults_411.decoder,delimiter:"string"==typeof t.delimiter||_$utils_413.isRegExp(t.delimiter)?t.delimiter:__defaults_411.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:__defaults_411.depth,duplicates:r,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:__defaults_411.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:__defaults_411.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:__defaults_411.plainObjects,strictDepth:"boolean"==typeof t.strictDepth?!!t.strictDepth:__defaults_411.strictDepth,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:__defaults_411.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){var r={__proto__:null},i=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n,o=e.parameterLimit===1/0?void 0:e.parameterLimit,a=i.split(e.delimiter,o),s=-1,u=e.charset;if(e.charsetSentinel)for(n=0;n-1&&(f=__isArray_411(f)?[f]:f);var p=__has_411.call(r,h);p&&"combine"===e.duplicates?r[h]=_$utils_413.combine(r[h],f):p&&"last"!==e.duplicates||(r[h]=f)}return r}(t,r):t,n=r.plainObjects?Object.create(null):{},o=Object.keys(i),a=0;a>o%8,t._prev=shiftIn(t._prev,r?i:n);return a}function shiftIn(t,e){var r=t.length,i=-1,n=__Buffer_226.allocUnsafe(t.length);for(t=__Buffer_226.concat([t,__Buffer_226.from([e])]);++i>7;return n}_$cfb1_226.encrypt=function(t,e,r){for(var i=e.length,n=__Buffer_226.allocUnsafe(i),o=-1;++o>>24]^f[p>>>16&255]^c[_>>>8&255]^l[255&m]^e[g++],a=h[p>>>24]^f[_>>>16&255]^c[m>>>8&255]^l[255&d]^e[g++],s=h[_>>>24]^f[m>>>16&255]^c[d>>>8&255]^l[255&p]^e[g++],u=h[m>>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&_]^e[g++],d=o,p=a,_=s,m=u;return o=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[_>>>8&255]<<8|i[255&m])^e[g++],a=(i[p>>>24]<<24|i[_>>>16&255]<<16|i[m>>>8&255]<<8|i[255&d])^e[g++],s=(i[_>>>24]<<24|i[m>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[g++],u=(i[m>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&_])^e[g++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var RCON=[0,1,2,4,8,16,32,64,128,27,54],G=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var h=s^s<<1^s<<2^s<<3^s<<4;h=h>>>8^255&h^99,r[a]=h,i[h]=a;var f=t[a],c=t[f],l=t[c],d=257*t[h]^16843008*h;n[0][a]=d<<24|d>>>8,n[1][a]=d<<16|d>>>16,n[2][a]=d<<8|d>>>24,n[3][a]=d,d=16843009*l^65537*c^257*f^16843008*a,o[0][h]=d<<24|d>>>8,o[1][h]=d<<16|d>>>16,o[2][h]=d<<8|d>>>24,o[3][h]=d,0===a?a=s=1:(a=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function AES(t){this._key=asUInt32Array(t),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],o=0;o>>24,a=G.SBOX[a>>>24]<<24|G.SBOX[a>>>16&255]<<16|G.SBOX[a>>>8&255]<<8|G.SBOX[255&a],a^=RCON[o/e|0]<<24):e>6&&o%e==4&&(a=G.SBOX[a>>>24]<<24|G.SBOX[a>>>16&255]<<16|G.SBOX[a>>>8&255]<<8|G.SBOX[255&a]),n[o]=n[o-e]^a}for(var s=[],u=0;u>>24]]^G.INV_SUB_MIX[1][G.SBOX[f>>>16&255]]^G.INV_SUB_MIX[2][G.SBOX[f>>>8&255]]^G.INV_SUB_MIX[3][G.SBOX[255&f]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=s},AES.prototype.encryptBlockRaw=function(t){return cryptBlock(t=asUInt32Array(t),this._keySchedule,G.SUB_MIX,G.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=__Buffer_217.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},AES.prototype.decryptBlock=function(t){var e=(t=asUInt32Array(t))[1];t[1]=t[3],t[3]=e;var r=cryptBlock(t,this._invKeySchedule,G.INV_SUB_MIX,G.INV_SBOX,this._nRounds),i=__Buffer_217.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},_$aes_217.AES=AES;var _$ghash_222={},__Buffer_222=_$safeBuffer_431.Buffer,ZEROES=__Buffer_222.alloc(16,0);function fromArray(t){var e=__Buffer_222.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function GHASH(t){this.h=t,this.state=__Buffer_222.alloc(16,0),this.cache=__Buffer_222.allocUnsafe(0)}GHASH.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=fromArray(n)},GHASH.prototype.update=function(t){var e;for(this.cache=__Buffer_222.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},GHASH.prototype.final=function(t,e){return this.cache.length&&this.ghash(__Buffer_222.concat([this.cache,ZEROES],16)),this.ghash(fromArray([0,t,0,e])),this.state},_$ghash_222=GHASH;var _$authCipher_218={},__Buffer_218=_$safeBuffer_431.Buffer;function StreamCipher(t,e,r,i){_$cipherBase_258.call(this);var n=__Buffer_218.alloc(4,0);this._cipher=new _$aes_217.AES(e);var o=this._cipher.encryptBlock(n);this._ghash=new _$ghash_222(o),r=function(t,e,r){if(12===e.length)return t._finID=__Buffer_218.concat([e,__Buffer_218.from([0,0,0,1])]),__Buffer_218.concat([e,__Buffer_218.from([0,0,0,2])]);var i=new _$ghash_222(r),n=e.length,o=n%16;i.update(e),o&&(o=16-o,i.update(__Buffer_218.alloc(o,0))),i.update(__Buffer_218.alloc(8,0));var a=8*n,s=__Buffer_218.alloc(8);s.writeUIntBE(a,0,8),i.update(s),t._finID=i.state;var u=__Buffer_218.from(t._finID);return _$incr32_223(u),u}(this,r,o),this._prev=__Buffer_218.from(r),this._cache=__Buffer_218.allocUnsafe(0),this._secCache=__Buffer_218.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}_$inherits_browser_375(StreamCipher,_$cipherBase_258),StreamCipher.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=__Buffer_218.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},StreamCipher.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=_$bufferXor_249(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n0||i>0;){var u=new _$md5Js_379;u.update(s),u.update(t),e&&u.update(e),s=u.digest();var h=0;if(n>0){var f=o.length-n;h=Math.min(n,s.length),s.copy(o,f,0,h),n-=h}if(h0){var c=a.length-i,l=Math.min(i,s.length-h);s.copy(a,c,h,h+l),i-=l}}return s.fill(0),{key:o,iv:a}},_$encrypter_221={},__Buffer_221=_$safeBuffer_431.Buffer;function Cipher(t,e,r){_$cipherBase_258.call(this),this._cache=new Splitter,this._cipher=new _$aes_217.AES(e),this._prev=__Buffer_221.from(r),this._mode=t,this._autopadding=!0}_$inherits_browser_375(Cipher,_$cipherBase_258),Cipher.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return __Buffer_221.concat(i)};var PADDING=__Buffer_221.alloc(16,16);function Splitter(){this.cache=__Buffer_221.allocUnsafe(0)}function createCipheriv(t,e,r){var i=_$modes_230[t.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=__Buffer_221.from(e)),e.length!==i.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=__Buffer_221.from(r)),"GCM"!==i.mode&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===i.type?new _$streamCipher_233(i.module,e,r):"auth"===i.type?new _$authCipher_218(i.module,e,r):new Cipher(i.module,e,r)}Cipher.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(PADDING))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},Splitter.prototype.add=function(t){this.cache=__Buffer_221.concat([this.cache,t])},Splitter.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},Splitter.prototype.flush=function(){for(var t=16-this.cache.length,e=__Buffer_221.allocUnsafe(t),r=-1;++r16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},__Splitter_220.prototype.flush=function(){if(this.cache.length)return this.cache};var _$browser_219={};_$encrypter_221.createCipher,_$browser_219.createCipheriv=_$encrypter_221.createCipheriv,_$decrypter_220.createDecipher,_$browser_219.createDecipheriv=_$decrypter_220.createDecipheriv,_$browser_219.getCiphers=function(){return Object.keys(_$list_231)};var _$algorithms_239={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}},_$algos_238=_$algorithms_239,MAX_ALLOC=Math.pow(2,30)-1,_$precondition_397=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>MAX_ALLOC||e!=e)throw new TypeError("Bad key length")},_$defaultEncoding_396={};(function(t,e){(function(){var r;r=e.process&&e.process.browser?"utf-8":e.process&&e.process.version?parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",_$defaultEncoding_396=r}).call(this)}).call(this,_$browser_401,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var __Buffer_399=_$safeBuffer_431.Buffer,_$toBuffer_399=function(t,e,r){if(__Buffer_399.isBuffer(t))return t;if("string"==typeof t)return __Buffer_399.from(t,e);if(ArrayBuffer.isView(t))return __Buffer_399.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")},_$syncBrowser_398={},__Buffer_398=_$safeBuffer_431.Buffer,__ZEROS_398=__Buffer_398.alloc(128),sizes={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function __Hmac_398(t,e,r){var i=function(t){return"rmd160"===t||"ripemd160"===t?function(t){return(new _$ripemd160_430).update(t).digest()}:"md5"===t?_$md5_263:function(e){return _$shaJs_447(t).update(e).digest()}}(t),n="sha512"===t||"sha384"===t?128:64;e.length>n?e=i(e):e.length>>0},writeUInt32BE:function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},ip:function(t,e,r,i){for(var n=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[i+0]=n>>>0,r[i+1]=o>>>0},rip:function(t,e,r,i){for(var n=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)n<<=1,n|=e>>>s+a&1,n<<=1,n|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},pc1:function(t,e,r,i){for(var n=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+a&1}for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},r28shl:function(t,e){return t<>>28-e}},pc2table=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];_$utils_307.pc2=function(t,e,r,i){for(var n=0,o=0,a=pc2table.length>>>1,s=0;s>>pc2table[s]&1;for(s=a;s>>pc2table[s]&1;r[i+0]=n>>>0,r[i+1]=o>>>0},_$utils_307.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=t>>>o&63;for(o=11;o>=3;o-=4)n|=t>>>o&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var sTable=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];_$utils_307.substitute=function(t,e){for(var r=0,i=0;i<4;i++)r<<=4,r|=sTable[64*i+(t>>>18-6*i&63)];for(i=0;i<4;i++)r<<=4,r|=sTable[256+64*i+(e>>>18-6*i&63)];return r>>>0};var permuteTable=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];_$utils_307.permute=function(t){for(var e=0,r=0;r>>permuteTable[r]&1;return e>>>0},_$utils_307.padSplit=function(t,e,r){for(var i=t.toString(2);i.length0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},__Cipher_304.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},__Cipher_304.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=_$utils_307.r28shl(r,o),i=_$utils_307.r28shl(i,o),_$utils_307.pc2(r,i,t.keys,n)}},DES.prototype._update=function(t,e,r,i){var n=this._desState,o=_$utils_307.readUInt32BE(t,e),a=_$utils_307.readUInt32BE(t,e+4);_$utils_307.ip(o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,a,n.tmp,0):this._decrypt(n,o,a,n.tmp,0),o=n.tmp[0],a=n.tmp[1],_$utils_307.writeUInt32BE(r,o,i),_$utils_307.writeUInt32BE(r,a,i+4)},DES.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var r=t.length-e,i=e;i>>0,o=c}_$utils_307.rip(a,o,i,n)},DES.prototype._decrypt=function(t,e,r,i,n){for(var o=r,a=e,s=t.keys.length-2;s>=0;s-=2){var u=t.keys[s],h=t.keys[s+1];_$utils_307.expand(o,t.tmp,0),u^=t.tmp[0],h^=t.tmp[1];var f=_$utils_307.substitute(u,h),c=o;o=(a^_$utils_307.permute(f))>>>0,a=c}_$utils_307.rip(o,a,i,n)};var _$cbc_303={},__proto_303={};function CBCState(t){this.iv=new Array(8);for(var e=0;e=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=s(t,e,i)<=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){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"],f=[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],c=[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 l(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=c[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:h[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new _).mulp(t,e,r)}function _(t,e){this.x=t,this.y=e}Math.imul||(d=l),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},_.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},_.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function $(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return m[t]=e,e},M.prototype._verify1=function(t){},M.prototype._verify2=function(t,e){},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new n(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new $(t)},i($,M),$.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},$.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},$.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},$.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},$.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_312,this),_$bn_312=_$bn_312.exports;var _$bn_382={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:_$empty_216({}).Buffer}catch(e){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=s(t,e,i)<=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){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"],f=[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],c=[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 l(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=c[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:h[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new _).mulp(t,e,r)}function _(t,e){this.x=t,this.y=e}Math.imul||(d=l),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},_.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},_.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function $(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return m[t]=e,e},M.prototype._verify1=function(t){},M.prototype._verify2=function(t,e){},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new n(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new $(t)},i($,M),$.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},$.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},$.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},$.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},$.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_382,this),_$bn_382=_$bn_382.exports;var _$mr_381={};function MillerRabin(t){this.rand=t||new _$brorand_215.Rand}_$mr_381=MillerRabin,MillerRabin.create=function(t){return new MillerRabin(t)},MillerRabin.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var i=new _$bn_382(this.rand.generate(r))}while(i.cmp(t)>=0);return i},MillerRabin.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},MillerRabin.prototype.test=function(t,e,r){var i=t.bitLength(),n=_$bn_382.mont(t),o=new _$bn_382(1).toRed(n);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),h=a.toRed(n);e>0;e--){var f=this._randrange(new _$bn_382(2),a);r&&r(f);var c=f.toRed(n).redPow(u);if(0!==c.cmp(o)&&0!==c.cmp(h)){for(var l=1;l0;e--){var h=this._randrange(new _$bn_382(2),o),f=t.gcd(h);if(0!==f.cmpn(1))return f;var c=h.toRed(i).redPow(s);if(0!==c.cmp(n)&&0!==c.cmp(u)){for(var l=1;lt;)r.ishrn(1);if(r.isEven()&&r.iadd(__ONE_310),r.testn(1)||r.iadd(TWO),e.cmp(TWO)){if(!e.cmp(FIVE))for(;r.mod(TEN).cmp(__THREE_310);)r.iadd(FOUR)}else for(;r.mod(TWENTYFOUR).cmp(ELEVEN);)r.iadd(FOUR);if(simpleSieve(i=r.shrn(1))&&simpleSieve(r)&&fermatTest(i)&&fermatTest(r)&&millerRabin.test(i)&&millerRabin.test(r))return r}}var _$primes_311={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},_$DH_309={};(function(t){(function(){var e=new _$mr_381,r=new _$bn_312(24),i=new _$bn_312(11),n=new _$bn_312(10),o=new _$bn_312(3),a=new _$bn_312(7);function s(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._pub=new _$bn_312(e),this}function u(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._priv=new _$bn_312(e),this}_$DH_309=f;var h={};function f(t,e,r){this.setGenerator(e),this.__prime=new _$bn_312(t),this._prime=_$bn_312.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=s,this.setPrivateKey=u):this._primeCode=8}function c(e,r){var i=new t(e.toArray());return r?i.toString(r):i}Object.defineProperty(f.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,s){var u=s.toString("hex"),f=[u,t.toString(16)].join("_");if(f in h)return h[f];var c,l=0;if(t.isEven()||!_$generatePrime_310.simpleSieve||!_$generatePrime_310.fermatTest(t)||!e.test(t))return l+=1,l+="02"===u||"05"===u?8:4,h[f]=l,l;switch(e.test(t.shrn(1))||(l+=2),u){case"02":t.mod(r).cmp(i)&&(l+=8);break;case"05":(c=t.mod(n)).cmp(o)&&c.cmp(a)&&(l+=8);break;default:l+=4}return h[f]=l,l}(this.__prime,this.__gen)),this._primeCode}}),f.prototype.generateKeys=function(){return this._priv||(this._priv=new _$bn_312(_$browser_415(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},f.prototype.computeSecret=function(e){var r=(e=(e=new _$bn_312(e)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new t(r.toArray()),n=this.getPrime();if(i.length0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return __Buffer_422.alloc(0);for(var e,r,i=__Buffer_422.allocUnsafe(t>>>0),n=this.head,o=0;n;)e=i,r=o,n.data.copy(e,r),o+=n.data.length,n=n.next;return i},t}(),util&&util.inspect&&util.inspect.custom&&(_$BufferList_422.prototype[util.inspect.custom]=function(){var t=util.inspect({length:this.length});return this.constructor.name+" "+t});var _$destroy_423={destroy:function(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,_$processNextickArgs_400.nextTick(emitErrorNT,this,t)):_$processNextickArgs_400.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,_$processNextickArgs_400.nextTick(emitErrorNT,r,t)):_$processNextickArgs_400.nextTick(emitErrorNT,r,t):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}},_$Transform_420=__Transform_420,__Duplex_420=_$Duplex_417({}),__util_420=Object.create(_$util_259);function __afterTransform_420(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void 0}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=s(t,e,i)<=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){n.prototype.inspect=f}else n.prototype.inspect=f;function f(){return(this.red?""}var c=["","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],d=[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 p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==n||o!==this.length-1?c[6-s.length]+s+r:s+r}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],h=d[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var p=f.modrn(h).toString(t);r=(f=f.idivn(h)).isZero()?p+r:c[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),n=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,r||Math.max(1,i));return this["_toArrayLike"+("le"===e?"LE":"BE")](n,i),n},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function m(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function g(t,e,r){return m(t,e,r)}function y(t,e){this.x=t,this.y=e}Math.imul||(_=p),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?_(this,t,e):r<63?p(this,t,e):r<1024?m(this,t,e):g(this,t,e)},y.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},y.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this._strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t);for(var r=(1<<26)%t,i=0,n=this.length-1;n>=0;n--)i=(r*i+(0|this.words[n]))%t;return e?-i:i},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t);for(var r=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*r;this.words[i]=n/t|0,r=n%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new S(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function $(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function A(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(w,v),w.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new M;else if("p192"===t)e=new $;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return b[t]=e,e},S.prototype._verify1=function(t){},S.prototype._verify2=function(t,e){},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new n(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},S.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},S.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,S),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_214,this),_$bn_214=_$bn_214.exports;var _$browserifyRsa_237={};(function(t){(function(){function e(t){var e,r=t.modulus.byteLength();do{e=new _$bn_214(_$browser_415(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function r(r,i){var n=function(t){var r=e(t);return{blinder:r.toRed(_$bn_214.mont(t.modulus)).redPow(new _$bn_214(t.publicExponent)).fromRed(),unblinder:r.invm(t.modulus)}}(i),o=i.modulus.byteLength(),a=new _$bn_214(r).mul(n.blinder).umod(i.modulus),s=a.toRed(_$bn_214.mont(i.prime1)),u=a.toRed(_$bn_214.mont(i.prime2)),h=i.coefficient,f=i.prime1,c=i.prime2,l=s.redPow(i.exponent1).fromRed(),d=u.redPow(i.exponent2).fromRed(),p=l.isub(d).imul(h).umod(f).imul(c);return d.iadd(p).imul(n.unblinder).umod(i.modulus).toArrayLike(t,"be",o)}r.getr=e,_$browserifyRsa_237=r}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$bn_119={exports:{}};!function(t,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:r.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:_$empty_216({}).Buffer}catch(e){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=s(t,e,i)<=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){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"],f=[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],c=[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 l(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=c[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:h[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new _).mulp(t,e,r)}function _(t,e){this.x=t,this.y=e}Math.imul||(d=l),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},_.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},_.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function $(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return m[t]=e,e},M.prototype._verify1=function(t){},M.prototype._verify2=function(t,e){},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new n(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new $(t)},i($,M),$.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},$.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},$.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},$.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},$.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_119,this),_$bn_119=_$bn_119.exports;var _$reporter_110={};function Reporter(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function ReporterError(t,e){this.path=t,this.rethrow(e)}_$reporter_110.Reporter=Reporter,Reporter.prototype.isError=function(t){return t instanceof ReporterError},Reporter.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},Reporter.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},Reporter.prototype.enterKey=function(t){return this._reporterState.path.push(t)},Reporter.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},Reporter.prototype.leaveKey=function(t,e,r){var i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},Reporter.prototype.path=function(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},Reporter.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},Reporter.prototype.error=function(t){var e,r=this._reporterState,i=t instanceof ReporterError;if(e=i?t:new ReporterError(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},Reporter.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},_$inherits_browser_375(ReporterError,Error),ReporterError.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var asn=_$asn1_105({}),Time=asn.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),AttributeTypeValue=asn.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),AlgorithmIdentifier=asn.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),SubjectPublicKeyInfo=asn.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier),this.key("subjectPublicKey").bitstr())})),RelativeDistinguishedName=asn.define("RelativeDistinguishedName",(function(){this.setof(AttributeTypeValue)})),RDNSequence=asn.define("RDNSequence",(function(){this.seqof(RelativeDistinguishedName)})),Name=asn.define("Name",(function(){this.choice({rdnSequence:this.use(RDNSequence)})})),Validity=asn.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(Time),this.key("notAfter").use(Time))})),Extension=asn.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),TBSCertificate=asn.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(AlgorithmIdentifier),this.key("issuer").use(Name),this.key("validity").use(Validity),this.key("subject").use(Name),this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Extension).optional())})),X509Certificate=asn.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(TBSCertificate),this.key("signatureAlgorithm").use(AlgorithmIdentifier),this.key("signatureValue").bitstr())})),_$X509Certificate_390=X509Certificate,_$asn1_389={},__asn1_389=_$asn1_105({});_$asn1_389.certificate=_$X509Certificate_390;var RSAPrivateKey=__asn1_389.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));_$asn1_389.RSAPrivateKey=RSAPrivateKey;var RSAPublicKey=__asn1_389.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));_$asn1_389.RSAPublicKey=RSAPublicKey;var __AlgorithmIdentifier_389=__asn1_389.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),PublicKey=__asn1_389.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(__AlgorithmIdentifier_389),this.key("subjectPublicKey").bitstr())}));_$asn1_389.PublicKey=PublicKey;var PrivateKeyInfo=__asn1_389.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(__AlgorithmIdentifier_389),this.key("subjectPrivateKey").octstr())}));_$asn1_389.PrivateKey=PrivateKeyInfo;var EncryptedPrivateKeyInfo=__asn1_389.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));_$asn1_389.EncryptedPrivateKey=EncryptedPrivateKeyInfo;var DSAPrivateKey=__asn1_389.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));_$asn1_389.DSAPrivateKey=DSAPrivateKey,_$asn1_389.DSAparam=__asn1_389.define("DSAparam",(function(){this.int()}));var ECParameters=__asn1_389.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),ECPrivateKey=__asn1_389.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(ECParameters),this.key("publicKey").optional().explicit(1).bitstr())}));_$asn1_389.ECPrivateKey=ECPrivateKey,_$asn1_389.signature=__asn1_389.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}));var _$aesid_388={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},_$safeBuffer_393={},__buffer_393=_$buffer_251({}),__Buffer_393=__buffer_393.Buffer;function __copyProps_393(t,e){for(var r in t)e[r]=t[r]}function __SafeBuffer_393(t,e,r){return __Buffer_393(t,e,r)}__Buffer_393.from&&__Buffer_393.alloc&&__Buffer_393.allocUnsafe&&__Buffer_393.allocUnsafeSlow?_$safeBuffer_393=__buffer_393:(__copyProps_393(__buffer_393,_$safeBuffer_393),_$safeBuffer_393.Buffer=__SafeBuffer_393),__SafeBuffer_393.prototype=Object.create(__Buffer_393.prototype),__copyProps_393(__Buffer_393,__SafeBuffer_393),__SafeBuffer_393.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return __Buffer_393(t,e,r)},__SafeBuffer_393.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=__Buffer_393(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},__SafeBuffer_393.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __Buffer_393(t)},__SafeBuffer_393.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return __buffer_393.SlowBuffer(t)};var findProc=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,startRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,fullRegex=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,__Buffer_391=_$safeBuffer_393.Buffer,_$fixProc_391=function(t,e){var r,i=t.toString(),n=i.match(findProc);if(n){var o="aes"+n[1],a=__Buffer_391.from(n[2],"hex"),s=__Buffer_391.from(n[3].replace(/[\r\n]/g,""),"base64"),u=_$evp_bytestokey_350(e,a.slice(0,8),parseInt(n[1],10)).key,h=[],f=_$browser_219.createDecipheriv(o,u,a);h.push(f.update(s)),h.push(f.final()),r=__Buffer_391.concat(h)}else{var c=i.match(fullRegex);r=__Buffer_391.from(c[2].replace(/[\r\n]/g,""),"base64")}return{tag:i.match(startRegex)[1],data:r}},_$parseAsn1_392={},__Buffer_392=_$safeBuffer_393.Buffer;function __parseKeys_392(t){var e;"object"!=typeof t||__Buffer_392.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=__Buffer_392.from(t));var r,i,n=_$fixProc_391(t,e),o=n.tag,a=n.data;switch(o){case"CERTIFICATE":i=_$asn1_389.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(i||(i=_$asn1_389.PublicKey.decode(a,"der")),r=i.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return _$asn1_389.RSAPublicKey.decode(i.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return i.subjectPrivateKey=i.subjectPublicKey,{type:"ec",data:i};case"1.2.840.10040.4.1":return i.algorithm.params.pub_key=_$asn1_389.DSAparam.decode(i.subjectPublicKey.data,"der"),{type:"dsa",data:i.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":a=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=_$aesid_388[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,a=t.subjectPrivateKey,s=parseInt(n.split("-")[1],10)/8,u=_$browser_394.pbkdf2Sync(e,r,i,s,"sha1"),h=_$browser_219.createDecipheriv(n,u,o),f=[];return f.push(h.update(a)),f.push(h.final()),__Buffer_392.concat(f)}(a=_$asn1_389.EncryptedPrivateKey.decode(a,"der"),e);case"PRIVATE KEY":switch(r=(i=_$asn1_389.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return _$asn1_389.RSAPrivateKey.decode(i.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:i.algorithm.curve,privateKey:_$asn1_389.ECPrivateKey.decode(i.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return i.algorithm.params.priv_key=_$asn1_389.DSAparam.decode(i.subjectPrivateKey,"der"),{type:"dsa",params:i.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return _$asn1_389.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return _$asn1_389.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:_$asn1_389.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=_$asn1_389.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}__parseKeys_392.signature=_$asn1_389.signature,_$parseAsn1_392=__parseKeys_392;var _$curves_240={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},_$sign_242={},__Buffer_242=_$safeBuffer_244.Buffer,__EC_242=_$elliptic_323.ec,RSA_PKCS1_PADDING=1;function getKey(t,e,r,i){if((t=__Buffer_242.from(t.toArray())).length0&&r.ishrn(i),r}function makeKey(t,e,r){var i,n;do{for(i=__Buffer_242.alloc(0);8*i.length=0)throw new Error("invalid sig")}var _$verify_243=function(t,e,r,i,n){var o=_$parseAsn1_392(r);if("ec"===o.type){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong public key type");return function(t,e,r){var i=_$curves_240[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new __EC_243(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,o)}if("dsa"===o.type){if("dsa"!==i)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,n=r.data.q,o=r.data.g,a=r.data.pub_key,s=_$parseAsn1_392.signature.decode(t,"der"),u=s.s,h=s.r;checkValue(u,n),checkValue(h,n);var f=_$bn_214.mont(i),c=u.invm(n);return 0===o.toRed(f).redPow(new _$bn_214(e).mul(c).mod(n)).fromRed().mul(a.toRed(f).redPow(h.mul(c).mod(n)).fromRed()).mod(i).mod(n).cmp(h)}(t,e,o)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong public key type");e=__Buffer_243.concat([n,e]);for(var a=o.modulus.byteLength(),s=[1],u=0;e.length+s.length+2=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=s(t,e,i)<=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){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"],f=[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],c=[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 l(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=c[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:h[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new _).mulp(t,e,r)}function _(t,e){this.x=t,this.y=e}Math.imul||(d=l),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},_.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},_.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function $(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return m[t]=e,e},M.prototype._verify1=function(t){},M.prototype._verify2=function(t,e){},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new n(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new $(t)},i($,M),$.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},$.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},$.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},$.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},$.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_261,this),_$bn_261=_$bn_261.exports;var _$browser_260={};(function(t){(function(){_$browser_260=function(t){return new r(t)};var e={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function r(t){this.curveType=e[t],this.curveType||(this.curveType={name:t}),this.curve=new _$elliptic_323.ec(this.curveType.name),this.keys=void 0}function i(e,r,i){Array.isArray(e)||(e=e.toArray());var n=new t(e);if(i&&n.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[n]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(i=0,n=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this.strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=s(t,e,i)<=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this.strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){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"],f=[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],c=[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 l(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var h=1;h>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(a=(n=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&a}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}n.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,n=0,o=0;o>>24-i&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,(i+=2)>=26&&(i-=26,o--)}for(0!==n&&(r=n.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=c[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:h[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length,0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)},n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),n=r||Math.max(1,i);this.strip();var o,a,s="le"===e,u=new t(n),h=this.clone();if(s){for(a=0;!h.isZero();a++)o=h.andln(255),h.iushrn(8),u[a]=o;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,d=0|a[1],p=8191&d,_=d>>>13,m=0|a[2],g=8191&m,y=m>>>13,b=0|a[3],v=8191&b,w=b>>>13,M=0|a[4],$=8191&M,E=M>>>13,S=0|a[5],A=8191&S,B=S>>>13,k=0|a[6],T=8191&k,x=k>>>13,I=0|a[7],P=8191&I,R=I>>>13,C=0|a[8],O=8191&C,N=C>>>13,L=0|a[9],D=8191&L,U=L>>>13,j=0|s[0],H=8191&j,z=j>>>13,q=0|s[1],K=8191&q,F=q>>>13,V=0|s[2],G=8191&V,W=V>>>13,Z=0|s[3],J=8191&Z,Y=Z>>>13,X=0|s[4],Q=8191&X,tt=X>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,ft=0|s[8],ct=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,_t=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(c,H))|0)+((8191&(n=(n=Math.imul(c,z))+Math.imul(l,H)|0))<<13)|0;h=((o=Math.imul(l,z))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,z))+Math.imul(_,H)|0,o=Math.imul(_,z);var gt=(h+(i=i+Math.imul(c,K)|0)|0)+((8191&(n=(n=n+Math.imul(c,F)|0)+Math.imul(l,K)|0))<<13)|0;h=((o=o+Math.imul(l,F)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(g,H),n=(n=Math.imul(g,z))+Math.imul(y,H)|0,o=Math.imul(y,z),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,F)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,F)|0;var yt=(h+(i=i+Math.imul(c,G)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(l,G)|0))<<13)|0;h=((o=o+Math.imul(l,W)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,z))+Math.imul(w,H)|0,o=Math.imul(w,z),i=i+Math.imul(g,K)|0,n=(n=n+Math.imul(g,F)|0)+Math.imul(y,K)|0,o=o+Math.imul(y,F)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,W)|0;var bt=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(l,J)|0))<<13)|0;h=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul($,H),n=(n=Math.imul($,z))+Math.imul(E,H)|0,o=Math.imul(E,z),i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,F)|0)+Math.imul(w,K)|0,o=o+Math.imul(w,F)|0,i=i+Math.imul(g,G)|0,n=(n=n+Math.imul(g,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Y)|0;var vt=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(l,Q)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,z))+Math.imul(B,H)|0,o=Math.imul(B,z),i=i+Math.imul($,K)|0,n=(n=n+Math.imul($,F)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,F)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,W)|0,i=i+Math.imul(g,J)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0;var wt=(h+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,it)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,z))+Math.imul(x,H)|0,o=Math.imul(x,z),i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,F)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,F)|0,i=i+Math.imul($,G)|0,n=(n=n+Math.imul($,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,it)|0;var Mt=(h+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(P,H),n=(n=Math.imul(P,z))+Math.imul(R,H)|0,o=Math.imul(R,z),i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,F)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,F)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,W)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,W)|0,i=i+Math.imul($,J)|0,n=(n=n+Math.imul($,Y)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(g,rt)|0,n=(n=n+Math.imul(g,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0;var $t=(h+(i=i+Math.imul(c,ut)|0)|0)+((8191&(n=(n=n+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(n>>>13)|0)+($t>>>26)|0,$t&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(N,H)|0,o=Math.imul(N,z),i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,F)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,F)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,W)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,W)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul($,Q)|0,n=(n=n+Math.imul($,tt)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,at)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0;var Et=(h+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,H),n=(n=Math.imul(D,z))+Math.imul(U,H)|0,o=Math.imul(U,z),i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,F)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,F)|0,i=i+Math.imul(P,G)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(R,G)|0,o=o+Math.imul(R,W)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,i=i+Math.imul($,rt)|0,n=(n=n+Math.imul($,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(g,ut)|0,n=(n=n+Math.imul(g,ht)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ht)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var St=(h+(i=i+Math.imul(c,pt)|0)|0)+((8191&(n=(n=n+Math.imul(c,_t)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,_t)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,K),n=(n=Math.imul(D,F))+Math.imul(U,K)|0,o=Math.imul(U,F),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,W)|0,i=i+Math.imul(P,J)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,it)|0,i=i+Math.imul($,ot)|0,n=(n=n+Math.imul($,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,i=i+Math.imul(g,ct)|0,n=(n=n+Math.imul(g,lt)|0)+Math.imul(y,ct)|0,o=o+Math.imul(y,lt)|0;var At=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,_t)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,_t)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,G),n=(n=Math.imul(D,W))+Math.imul(U,G)|0,o=Math.imul(U,W),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Y)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,i=i+Math.imul($,ut)|0,n=(n=n+Math.imul($,ht)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ht)|0,i=i+Math.imul(v,ct)|0,n=(n=n+Math.imul(v,lt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,lt)|0;var Bt=(h+(i=i+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,_t)|0)+Math.imul(y,pt)|0))<<13)|0;h=((o=o+Math.imul(y,_t)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(D,J),n=(n=Math.imul(D,Y))+Math.imul(U,J)|0,o=Math.imul(U,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(A,ut)|0,n=(n=n+Math.imul(A,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,i=i+Math.imul($,ct)|0,n=(n=n+Math.imul($,lt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,lt)|0;var kt=(h+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,_t)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,_t)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(D,Q),n=(n=Math.imul(D,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),i=i+Math.imul(O,rt)|0,n=(n=n+Math.imul(O,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(P,ot)|0,n=(n=n+Math.imul(P,at)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,at)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,i=i+Math.imul(A,ct)|0,n=(n=n+Math.imul(A,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Tt=(h+(i=i+Math.imul($,pt)|0)|0)+((8191&(n=(n=n+Math.imul($,_t)|0)+Math.imul(E,pt)|0))<<13)|0;h=((o=o+Math.imul(E,_t)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul(U,rt)|0,o=Math.imul(U,it),i=i+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(P,ut)|0,n=(n=n+Math.imul(P,ht)|0)+Math.imul(R,ut)|0,o=o+Math.imul(R,ht)|0,i=i+Math.imul(T,ct)|0,n=(n=n+Math.imul(T,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var xt=(h+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,_t)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,_t)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul(U,ot)|0,o=Math.imul(U,at),i=i+Math.imul(O,ut)|0,n=(n=n+Math.imul(O,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,i=i+Math.imul(P,ct)|0,n=(n=n+Math.imul(P,lt)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,lt)|0;var It=(h+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,_t)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,_t)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ut),n=(n=Math.imul(D,ht))+Math.imul(U,ut)|0,o=Math.imul(U,ht),i=i+Math.imul(O,ct)|0,n=(n=n+Math.imul(O,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,_t)|0)+Math.imul(R,pt)|0))<<13)|0;h=((o=o+Math.imul(R,_t)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,lt))+Math.imul(U,ct)|0,o=Math.imul(U,lt);var Rt=(h+(i=i+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,_t)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,_t)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ct=(h+(i=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,_t))+Math.imul(U,pt)|0))<<13)|0;return h=((o=Math.imul(U,_t))+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=mt,u[1]=gt,u[2]=yt,u[3]=bt,u[4]=vt,u[5]=wt,u[6]=Mt,u[7]=$t,u[8]=Et,u[9]=St,u[10]=At,u[11]=Bt,u[12]=kt,u[13]=Tt,u[14]=xt,u[15]=It,u[16]=Pt,u[17]=Rt,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new _).mulp(t,e,r)}function _(t,e){this.x=t,this.y=e}Math.imul||(d=l),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?l(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},_.prototype.makeRBT=function(t){for(var e=new Array(t),r=n.prototype._countBits(t)-1,i=0;i>=1;return i},_.prototype.permute=function(t,e,r,i,n,o){for(var a=0;a>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=n>>>26,this.words[r]=67108863&n}return 0!==e&&(this.words[r]=e,this.length++),this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e>>n<o)for(this.length-=o,u=0;u=0&&(0!==h||u>=i);u--){var f=0|this.words[u];this.words[u]=h<<26-n|f>>>n,h=f&a}return s&&0!==h&&(s.words[s.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(t,e,r){return this.iushrn(t,e,r)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){var e=t%26,r=(t-e)/26,i=1<>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(s/67108864|0),this.words[i+r]=67108863&n}for(;i>26,this.words[i+r]=67108863&n;if(0===a)return this.strip();for(a=0,i=0;i>26,this.words[i]=67108863&n;return this.negative=1,this.strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,u=i.length-o.length;if("mod"!==e){(s=new n(null)).length=u+1,s.words=new Array(s.length);for(var h=0;h=0;c--){var l=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(o,l,c);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,r){return this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modn=function(t){for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},n.prototype.idivn=function(t){for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new n(1),o=new n(0),a=new n(0),s=new n(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var h=r.clone(),f=e.clone();!e.isZero();){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(h),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,p=1;0==(r.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(a.isOdd()||s.isOdd())&&(a.iadd(h),s.isub(f)),a.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(s)):(r.isub(e),a.isub(i),s.isub(o))}return{a:a,b:s,gcd:r.iushln(u)}},n.prototype._invmp=function(t){var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new n(1),a=new n(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,h=1;0==(e.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(i=0===e.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(t),i},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==n&&(this.words[o]=n,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t);var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new M(t)},n.prototype.toRed=function(t){return t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return this._forceRed(t)},n.prototype.redAdd=function(t){return this.red.add(this,t)},n.prototype.redIAdd=function(t){return this.red.iadd(this,t)},n.prototype.redSub=function(t){return this.red.sub(this,t)},n.prototype.redISub=function(t){return this.red.isub(this,t)},n.prototype.redShl=function(t){return this.red.shl(this,t)},n.prototype.redMul=function(t){return this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function $(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},i(y,g),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=o}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return m[t]=e,e},M.prototype._verify1=function(t){},M.prototype._verify2=function(t,e){},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();if(3===this.m.andln(3)){var e=this.m.add(new n(1)).iushrn(2);return this.pow(t,e)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);var o=new n(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var h=this.pow(u,r),f=this.pow(t,r.addn(1).iushrn(1)),c=this.pow(t,r),l=i;0!==c.cmp(o);){for(var d=c,p=0;0!==d.cmp(o);p++)d=d.redSqr();var _=this.pow(h,new n(1).iushln(l-p-1));f=f.redMul(_),h=_.redSqr(),c=c.redMul(h),l=p}return f},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i=0;i--){for(var h=e.words[i],f=u-1;f>=0;f--){var c=h>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4==++s||0===i&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new $(t)},i($,M),$.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},$.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},$.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},$.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},$.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(_$bn_404,this),_$bn_404=_$bn_404.exports;var __Buffer_407=_$safeBuffer_431.Buffer,_$withPublic_407=function(t,e){return __Buffer_407.from(t.toRed(_$bn_404.mont(e.modulus)).redPow(new _$bn_404(e.publicExponent)).fromRed().toArray())},__Buffer_406=_$safeBuffer_431.Buffer,_$publicEncrypt_406=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=_$parseAsn1_392(t);if(4===i)n=function(t,e){var r=t.modulus.byteLength(),i=e.length,n=_$browser_262("sha1").update(__Buffer_406.alloc(0)).digest(),o=n.length,a=2*o;if(i>r-a-2)throw new Error("message too long");var s=__Buffer_406.alloc(r-i-a-2),u=r-o-1,h=_$browser_415(o),f=_$xor_408(__Buffer_406.concat([n,s,__Buffer_406.alloc(1,1),e],u),_$mgf_403(h,u)),c=_$xor_408(h,_$mgf_403(f,o));return new _$bn_404(__Buffer_406.concat([__Buffer_406.alloc(1),c,f],r))}(o,e);else if(1===i)n=function(t,e,r){var i,n=e.length,o=t.modulus.byteLength();if(n>o-11)throw new Error("message too long");return i=r?__Buffer_406.alloc(o-n-3,255):function(t){for(var e,r=__Buffer_406.allocUnsafe(t),i=0,n=_$browser_415(2*t),o=0;i=0)throw new Error("data too long for modulus")}return r?_$browserifyRsa_237(n,o):_$withPublic_407(n,o)},__Buffer_405=_$safeBuffer_431.Buffer,_$privateDecrypt_405=function(t,e,r){var i;i=t.padding?t.padding:r?1:4;var n,o=_$parseAsn1_392(t),a=o.modulus.byteLength();if(e.length>a||new _$bn_404(e).cmp(o.modulus)>=0)throw new Error("decryption error");n=r?_$withPublic_407(new _$bn_404(e),o):_$browserifyRsa_237(e,o);var s=__Buffer_405.alloc(a-n.length);if(n=__Buffer_405.concat([s,n],a),4===i)return function(t,e){var r=t.modulus.byteLength(),i=_$browser_262("sha1").update(__Buffer_405.alloc(0)).digest(),n=i.length;if(0!==e[0])throw new Error("decryption error");var o=e.slice(1,n+1),a=e.slice(n+1),s=_$xor_408(o,_$mgf_403(a,n)),u=_$xor_408(a,_$mgf_403(s,r-n-1));if(function(t,e){t=__Buffer_405.from(t),e=__Buffer_405.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));for(var n=-1;++n=e.length){o++;break}var a=e.slice(2,n-1);if(("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return e.slice(n)}(0,n,r);if(3===i)return n;throw new Error("unknown padding")},_$browser_402={};_$browser_402.publicEncrypt=_$publicEncrypt_406,_$browser_402.privateDecrypt=_$privateDecrypt_405,_$browser_402.privateEncrypt=function(t,e){return _$browser_402.publicEncrypt(t,e,!0)},_$browser_402.publicDecrypt=function(t,e){return _$browser_402.privateDecrypt(t,e,!0)};var _$browser_416={};(function(t,e){(function(){"use strict";function r(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var i=_$safeBuffer_431.Buffer,n=_$safeBuffer_431.kMaxLength,o=e.crypto||e.msCrypto,a=Math.pow(2,32)-1;function s(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>a||t<0)throw new TypeError("offset must be a uint32");if(t>n||t>e)throw new RangeError("offset out of range")}function u(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>a||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>n)throw new RangeError("buffer too small")}function h(e,r,i,n){if(t.browser){var a=e.buffer,s=new Uint8Array(a,r,i);return o.getRandomValues(s),n?void t.nextTick((function(){n(null,e)})):e}if(!n)return _$browser_415(i).copy(e,r),e;_$browser_415(i,(function(t,i){if(t)return n(t);i.copy(e,r),n(null,e)}))}o&&o.getRandomValues||!t.browser?(_$browser_416.randomFill=function(t,r,n,o){if(!(i.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)o=r,r=0,n=t.length;else if("function"==typeof n)o=n,n=t.length-r;else if("function"!=typeof o)throw new TypeError('"cb" argument must be a function');return s(r,t.length),u(n,r,t.length),h(t,r,n,o)},_$browser_416.randomFillSync=function(t,r,n){if(void 0===r&&(r=0),!(i.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return s(r,t.length),void 0===n&&(n=t.length-r),u(n,r,t.length),h(t,r,n)}):(_$browser_416.randomFill=r,_$browser_416.randomFillSync=r)}).call(this)}).call(this,_$browser_401,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$utils_437={};(function(t,e){(function(){const r=_$cryptoBrowserify_266({});function i(t,e,r,i,n,u,h){let f;for(s(t,e+64*(2*i-1),n,0,64),f=0;f<2*i;f++)a(t,64*f,n,0,64),o(n,u,h),s(n,0,t,r+64*f,64);for(f=0;f>>32-e}function o(t,e,r){let i;for(i=0;i<16;i++)e[i]=(255&t[4*i+0])<<0,e[i]|=(255&t[4*i+1])<<8,e[i]|=(255&t[4*i+2])<<16,e[i]|=(255&t[4*i+3])<<24;for(s(e,0,r,0,16),i=8;i>0;i-=2)r[4]^=n(r[0]+r[12],7),r[8]^=n(r[4]+r[0],9),r[12]^=n(r[8]+r[4],13),r[0]^=n(r[12]+r[8],18),r[9]^=n(r[5]+r[1],7),r[13]^=n(r[9]+r[5],9),r[1]^=n(r[13]+r[9],13),r[5]^=n(r[1]+r[13],18),r[14]^=n(r[10]+r[6],7),r[2]^=n(r[14]+r[10],9),r[6]^=n(r[2]+r[14],13),r[10]^=n(r[6]+r[2],18),r[3]^=n(r[15]+r[11],7),r[7]^=n(r[3]+r[15],9),r[11]^=n(r[7]+r[3],13),r[15]^=n(r[11]+r[7],18),r[1]^=n(r[0]+r[3],7),r[2]^=n(r[1]+r[0],9),r[3]^=n(r[2]+r[1],13),r[0]^=n(r[3]+r[2],18),r[6]^=n(r[5]+r[4],7),r[7]^=n(r[6]+r[5],9),r[4]^=n(r[7]+r[6],13),r[5]^=n(r[4]+r[7],18),r[11]^=n(r[10]+r[9],7),r[8]^=n(r[11]+r[10],9),r[9]^=n(r[8]+r[11],13),r[10]^=n(r[9]+r[8],18),r[12]^=n(r[15]+r[14],7),r[13]^=n(r[12]+r[15],9),r[14]^=n(r[13]+r[12],13),r[15]^=n(r[14]+r[13],18);for(i=0;i<16;++i)e[i]=r[i]+e[i];for(i=0;i<16;i++){let r=4*i;t[r+0]=e[i]>>0&255,t[r+1]=e[i]>>8&255,t[r+2]=e[i]>>16&255,t[r+3]=e[i]>>24&255}}function a(t,e,r,i,n){for(let o=0;o 0 and a power of 2");if(n>2147483647/128/o)throw Error("Parameter N is too large");if(o>2147483647/128/a)throw Error("Parameter r is too large");let h,f=t.alloc(256*o),c=t.alloc(128*o*n),l=new Int32Array(16),d=new Int32Array(16),p=t.alloc(64),_=r.pbkdf2Sync(e,i,1,128*a*o,"sha256");if(u){let t=a*n*2,e=0;h=function(){++e%1e3==0&&u({current:e,total:t,percent:e/t*100})}}return{XY:f,V:c,B32:l,x:d,_X:p,B:_,tickCallback:h}},smix:async function(t,r,n,o,s,u,h,f,c,l,d){d=d||5e3;let p,_=128*n;for(t.copy(u,0,r,r+_),p=0;pe(t)),i(u,0,_,n,h,f,c),l&&l();for(p=0;pe(t)),i(u,0,_,n,h,f,c),l&&l()}u.copy(t,r,0,0+_)},smixSync:function(t,e,r,n,o,s,u,h,f,c){let l,d=128*r;for(t.copy(s,0,e,e+d),l=0;l=0&&(i=!0)})),Object.keys(e).forEach((function(t){r+=o[t]*e[t]})),i&&(r+=2),r+=40,Math.ceil(r/4)}encryptBIP38(t,e){const r=_$wif_485.decode(t);return _$bip38_201.encrypt(r.privateKey,r.compressed,e)}decryptBIP38(t,e,r="mainnet"){const i=_$bip38_201.decrypt(t,e);let n;return n="testnet"===r?239:128,_$wif_485.encode(n,i.privateKey,i.compressed)}},_$crypto_19=class{static sha256(t){return _$src_55.crypto.sha256(t)}static ripemd160(t){return _$src_55.crypto.ripemd160(t)}static hash256(t){return _$src_55.crypto.hash256(t)}static hash160(t){return _$src_55.crypto.hash160(t)}static randomBytes(t=16){return _$browser_415(t)}},_$bind_138=function(t,e){return function(){for(var r=new Array(arguments.length),i=0;i=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},_$isURLSameOrigin_144=_$utils_149.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(t){var i=t;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(e){var r=_$utils_149.isString(e)?i(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},_$Cancel_123={};function Cancel(t){this.message=t}Cancel.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,_$Cancel_123=Cancel;var _$xhr_121=function(t){return new Promise((function(e,r){var i,n=t.data,o=t.headers,a=t.responseType;function s(){t.cancelToken&&t.cancelToken.unsubscribe(i),t.signal&&t.signal.removeEventListener("abort",i)}_$utils_149.isFormData(n)&&delete o["Content-Type"];var u=new XMLHttpRequest;if(t.auth){var h=t.auth.username||"",f=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(h+":"+f)}var c=_$buildFullPath_128(t.baseURL,t.url);function l(){if(u){var i="getAllResponseHeaders"in u?_$parseHeaders_146(u.getAllResponseHeaders()):null,n={data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:i,config:t,request:u};_$settle_133((function(t){e(t),s()}),(function(t){r(t),s()}),n),u=null}}if(u.open(t.method.toUpperCase(),_$buildURL_139(c,t.params,t.paramsSerializer),!0),u.timeout=t.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(r(_$createError_129("Request aborted",t,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(_$createError_129("Network Error",t,null,u)),u=null},u.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",i=t.transitional||_$transitional_136;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(_$createError_129(e,t,i.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},_$utils_149.isStandardBrowserEnv()){var d=(t.withCredentials||_$isURLSameOrigin_144(c))&&t.xsrfCookieName?_$cookies_141.read(t.xsrfCookieName):void 0;d&&(o[t.xsrfHeaderName]=d)}"setRequestHeader"in u&&_$utils_149.forEach(o,(function(t,e){void 0===n&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,t)})),_$utils_149.isUndefined(t.withCredentials)||(u.withCredentials=!!t.withCredentials),a&&"json"!==a&&(u.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&u.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(i=function(t){u&&(r(!t||t&&t.type?new _$Cancel_123("canceled"):t),u.abort(),u=null)},t.cancelToken&&t.cancelToken.subscribe(i),t.signal&&(t.signal.aborted?i():t.signal.addEventListener("abort",i))),n||(n=null),u.send(n)}))},_$defaults_135={};(function(t){(function(){"use strict";var r={"Content-Type":"application/x-www-form-urlencoded"};function i(t,e){!_$utils_149.isUndefined(t)&&_$utils_149.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var n,o={transitional:_$transitional_136,adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(n=_$xhr_121),n),transformRequest:[function(t,r){return _$normalizeHeaderName_145(r,"Accept"),_$normalizeHeaderName_145(r,"Content-Type"),_$utils_149.isFormData(t)||_$utils_149.isArrayBuffer(t)||_$utils_149.isBuffer(t)||_$utils_149.isStream(t)||_$utils_149.isFile(t)||_$utils_149.isBlob(t)?t:_$utils_149.isArrayBufferView(t)?t.buffer:_$utils_149.isURLSearchParams(t)?(i(r,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_$utils_149.isObject(t)||r&&"application/json"===r["Content-Type"]?(i(r,"application/json"),function(t,r,i){if(_$utils_149.isString(t))try{return(0,JSON.parse)(t),_$utils_149.trim(t)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var r=this.transitional||o.transitional,i=r&&r.silentJSONParsing,n=r&&r.forcedJSONParsing,a=!i&&"json"===this.responseType;if(a||n&&_$utils_149.isString(t)&&t.length)try{return JSON.parse(t)}catch(e){if(a){if("SyntaxError"===e.name)throw _$enhanceError_131(e,this,"E_JSON_PARSE");throw e}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_$utils_149.forEach(["delete","get","head"],(function(t){o.headers[t]={}})),_$utils_149.forEach(["post","put","patch"],(function(t){o.headers[t]=_$utils_149.merge(r)})),_$defaults_135=o}).call(this)}).call(this,_$browser_401);var _$transformData_134=function(t,e,r){var i=this||_$defaults_135;return _$utils_149.forEach(r,(function(r){t=r.call(i,t,e)})),t},_$isCancel_125=function(t){return!(!t||!t.__CANCEL__)};function throwIfCancellationRequested(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _$Cancel_123("canceled")}var _$dispatchRequest_130=function(t){return throwIfCancellationRequested(t),t.headers=t.headers||{},t.data=_$transformData_134.call(t,t.data,t.headers,t.transformRequest),t.headers=_$utils_149.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),_$utils_149.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||_$defaults_135.adapter)(t).then((function(e){return throwIfCancellationRequested(t),e.data=_$transformData_134.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return _$isCancel_125(e)||(throwIfCancellationRequested(t),e&&e.response&&(e.response.data=_$transformData_134.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},_$mergeConfig_132=function(t,e){e=e||{};var r={};function i(t,e){return _$utils_149.isPlainObject(t)&&_$utils_149.isPlainObject(e)?_$utils_149.merge(t,e):_$utils_149.isPlainObject(e)?_$utils_149.merge({},e):_$utils_149.isArray(e)?e.slice():e}function n(r){return _$utils_149.isUndefined(e[r])?_$utils_149.isUndefined(t[r])?void 0:i(void 0,t[r]):i(t[r],e[r])}function o(t){if(!_$utils_149.isUndefined(e[t]))return i(void 0,e[t])}function a(r){return _$utils_149.isUndefined(e[r])?_$utils_149.isUndefined(t[r])?void 0:i(void 0,t[r]):i(void 0,e[r])}function s(r){return r in e?i(t[r],e[r]):r in t?i(void 0,t[r]):void 0}var u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return _$utils_149.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||n,i=e(t);_$utils_149.isUndefined(i)&&e!==s||(r[t]=i)})),r},_$data_137={version:"0.26.1"},_$validator_148={},VERSION=_$data_137.version,validators={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){validators[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var deprecatedWarnings={};validators.transitional=function(t,e,r){function i(t,e){return"[Axios v"+VERSION+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,n,o){if(!1===t)throw new Error(i(n," has been removed"+(e?" in "+e:"")));return e&&!deprecatedWarnings[n]&&(deprecatedWarnings[n]=!0,console.warn(i(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,o)}},_$validator_148={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var i=Object.keys(t),n=i.length;n-- >0;){var o=i[n],a=e[o];if(a){var s=t[o],u=void 0===s||a(s,o,t);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:validators};var _$Axios_126={},__validators_126=_$validator_148.validators;function Axios(t){this.defaults=t,this.interceptors={request:new _$InterceptorManager_127,response:new _$InterceptorManager_127}}Axios.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=_$mergeConfig_132(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;void 0!==r&&_$validator_148.assertOptions(r,{silentJSONParsing:__validators_126.transitional(__validators_126.boolean),forcedJSONParsing:__validators_126.transitional(__validators_126.boolean),clarifyTimeoutError:__validators_126.transitional(__validators_126.boolean)},!1);var i=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,i.unshift(t.fulfilled,t.rejected))}));var o,a=[];if(this.interceptors.response.forEach((function(t){a.push(t.fulfilled,t.rejected)})),!n){var s=[_$dispatchRequest_130,void 0];for(Array.prototype.unshift.apply(s,i),s=s.concat(a),o=Promise.resolve(e);s.length;)o=o.then(s.shift(),s.shift());return o}for(var u=e;i.length;){var h=i.shift(),f=i.shift();try{u=h(u)}catch(c){f(c);break}}try{o=_$dispatchRequest_130(u)}catch(c){return Promise.reject(c)}for(;a.length;)o=o.then(a.shift(),a.shift());return o},Axios.prototype.getUri=function(t){return t=_$mergeConfig_132(this.defaults,t),_$buildURL_139(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},_$utils_149.forEach(["delete","get","head","options"],(function(t){Axios.prototype[t]=function(e,r){return this.request(_$mergeConfig_132(r||{},{method:t,url:e,data:(r||{}).data}))}})),_$utils_149.forEach(["post","put","patch"],(function(t){Axios.prototype[t]=function(e,r,i){return this.request(_$mergeConfig_132(i||{},{method:t,url:e,data:r}))}})),_$Axios_126=Axios;var _$CancelToken_124={};function CancelToken(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,i=r._listeners.length;for(e=0;esetTimeout(e,t))}async validateAddress(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}util/validateAddress/${t}`,this.axiosOptions)).data;if(Array.isArray(t)){const e={method:"POST",url:this.restURL+"util/validateAddress",data:{addresses:t}},r=Object.assign({},e,this.axiosOptions);return(await _$axios_120(r)).data}throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}},_$blockchain_17=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}}}async getBestBlockHash(){try{return(await _$axios_120.get(this.restURL+"blockchain/getBestBlockHash",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlock(t,e=1){try{if(!t||"string"!=typeof t)throw new Error("blockhash must be a string");return(await _$axios_120.post(this.restURL+"blockchain/getblock",{blockhash:t,verbosity:e},this.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getBlockchainInfo(){try{return(await _$axios_120.get(this.restURL+"blockchain/getBlockchainInfo",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getBlockCount(){try{return(await _$axios_120.get(this.restURL+"blockchain/getBlockCount",this.axiosOptions)).data}catch(t){throw console.log("Error in bch-js/blockchain.js/getBlockCount()"),console.log("blockchain.js restURL: ",this.restURL),t.response&&t.response.data?t.response.data:t}}async getBlockHash(t=1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_120.get(`${this.restURL}blockchain/getBlockHash/${t}`,this.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getBlockHeader(t,e=!0){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}blockchain/getBlockHeader/${t}?verbose=${e}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"blockchain/getBlockHeader",{hashes:t,verbose:e},this.axiosOptions)).data;throw new Error("Input hash must be a string or array of strings.")}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getChainTips(){try{return(await _$axios_120.get(this.restURL+"blockchain/getChainTips",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getDifficulty(){try{return(await _$axios_120.get(this.restURL+"blockchain/getDifficulty",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getMempoolAncestors(t,e=!1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_120.get(`${this.restURL}blockchain/getMempoolAncestors/${t}?verbose=${e}`,this.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getMempoolDescendants(t,e=!1){"string"!=typeof t&&(t=JSON.stringify(t));try{return(await _$axios_120.get(`${this.restURL}blockchain/getMempoolDescendants/${t}?verbose=${e}`,this.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async getMempoolEntry(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}blockchain/getMempoolEntry/${t}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"blockchain/getMempoolEntry",{txids:t},this.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getMempoolInfo(){try{return(await _$axios_120.get(this.restURL+"blockchain/getMempoolInfo",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getRawMempool(t=!1){try{return(await _$axios_120.get(`${this.restURL}blockchain/getRawMempool?vebose=${t}`,this.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getTxOut(t,e,r=!0){try{if("string"!=typeof t||64!==t.length)throw new Error("txid needs to be a proper transaction ID");if(isNaN(e))throw new Error("n must be an integer");if("boolean"!=typeof r)throw new Error("includeMempool input must be of type boolean");return(await _$axios_120.post(this.restURL+"blockchain/getTxOut",{txid:t,vout:e,mempool:r},this.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}async getTxOutProof(t){try{if("string"==typeof t){const e=`${this.restURL}blockchain/getTxOutProof/${t}`;return(await _$axios_120.get(e,this.axiosOptions)).data}if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"blockchain/getTxOutProof",{txids:t},this.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async preciousBlock(t){try{return(await _$axios_120.get(`${this.restURL}blockchain/preciousBlock/${t}`,this.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async pruneBlockchain(t){try{return(await _$axios_120.post(`${this.restURL}blockchain/pruneBlockchain/${t}`,this.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async verifyChain(t=3,e=6){try{return(await _$axios_120.get(`${this.restURL}blockchain/verifyChain?checklevel=${t}&nblocks=${e}`,this.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async verifyTxOutProof(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}blockchain/verifyTxOutProof/${t}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"blockchain/verifyTxOutProof",{proofs:t},this.axiosOptions)).data;throw new Error("Input must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}},_$control_18=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}}}async getNetworkInfo(){try{return(await _$axios_120.get(this.restURL+"control/getNetworkInfo",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getMemoryInfo(){try{return(await _$axios_120.get(this.restURL+"control/getMemoryInfo",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}},_$generating_25=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}}}async generateToAddress(t,e,r=1e6){try{return(await _$axios_120.post(`${this.restURL}generating/generateToAddress/${t}/${e}?maxtries=${r}`,this.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}},_$mining_27=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}}}async getBlockTemplate(t){try{return(await _$axios_120.get(`${this.restURL}mining/getBlockTemplate/${t}`,this.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}async getMiningInfo(){try{return(await _$axios_120.get(this.restURL+"mining/getMiningInfo",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async getNetworkHashps(t=120,e=1){try{return(await _$axios_120.get(`${this.restURL}mining/getNetworkHashps?nblocks=${t}&height=${e}`,this.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response.data:r}}async submitBlock(t,e){let r=`${this.restURL}mining/submitBlock/${t}`;e&&(r=`${r}?parameters=${e}`);try{return(await _$axios_120.post(r,this.axiosOptions)).data}catch(i){throw i.response&&i.response.data?i.response.data:i}}},_$rawTransactions_31=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.axios=_$axios_120}async decodeRawTransaction(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}rawtransactions/decodeRawTransaction/${t}`,this.axiosOptions)).data;if(Array.isArray(t)){const e={method:"POST",url:this.restURL+"rawtransactions/decodeRawTransaction",data:{hexes:t},headers:this.axiosOptions.headers};return(await _$axios_120(e)).data}throw new Error("Input must be a string or array of strings.")}catch(e){throw e.error?new Error(e.error):e.response&&e.response.data?e.response.data:e}}async decodeScript(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}rawtransactions/decodeScript/${t}`,this.axiosOptions)).data;if(Array.isArray(t)){const e={method:"POST",url:this.restURL+"rawtransactions/decodeScript",data:{hexes:t},headers:this.axiosOptions.headers};return(await _$axios_120(e)).data}throw new Error("Input must be a string or array of strings.")}catch(e){throw e.error?new Error(e.error):e.response&&e.response.data?e.response.data:e}}async getRawTransaction(t,e=!1,r=null){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}rawtransactions/getRawTransaction/${t}?verbose=${e}`,this.axiosOptions)).data;if(Array.isArray(t)){const i={method:"POST",url:this.restURL+"rawtransactions/getRawTransaction",data:{txids:t,verbose:e,usrObj:r},headers:this.axiosOptions.headers};return(await _$axios_120(i)).data}throw new Error("Input must be a string or array of strings.")}catch(i){if(i.error)throw new Error(i.error);throw i.response&&i.response.data&&i.response.data.error?new Error(i.response.data.error):i.response&&i.response.data?i.response.data:i}}async _getInputAddrs(t){try{const e=[];for(let r=0;rn(t.toString(2),"0",8)).join("")}function s(t){const e=8*t.length/32;return a([..._$browser_262("sha256").update(t).digest()]).slice(0,e)}function u(t){return"mnemonic"+(t||"")}function h(e,a){if(!(a=a||r))throw new Error(i);const u=(e||"").normalize("NFKD").split(" ");if(u.length%3!=0)throw new Error("Invalid mnemonic");const h=u.map(t=>{const e=a.indexOf(t);if(-1===e)throw new Error("Invalid mnemonic");return n(e.toString(2),"0",11)}).join(""),f=32*Math.floor(h.length/33),c=h.slice(0,f),l=h.slice(f),d=c.match(/(.{1,8})/g).map(o);if(d.length<16)throw new Error("Invalid entropy");if(d.length>32)throw new Error("Invalid entropy");if(d.length%4!=0)throw new Error("Invalid entropy");const p=t.from(d);if(s(p)!==l)throw new Error("Invalid mnemonic checksum");return p.toString("hex")}function f(e,n){if(t.isBuffer(e)||(e=t.from(e,"hex")),!(n=n||r))throw new Error(i);if(e.length<16)throw new TypeError("Invalid entropy");if(e.length>32)throw new TypeError("Invalid entropy");if(e.length%4!=0)throw new TypeError("Invalid entropy");const u=(a([...e])+s(e)).match(/(.{1,11})/g).map(t=>{const e=o(t);return n[e]});return"\u3042\u3044\u3053\u304f\u3057\u3093"===n[0]?u.join("\u3000"):u.join(" ")}_$src_203.mnemonicToSeed=function(e,r){return new Promise((i,n)=>{try{const o=t.from((e||"").normalize("NFKD"),"utf8"),a=t.from(u((r||"").normalize("NFKD")),"utf8");_$browser_394.pbkdf2(o,a,2048,64,"sha512",(t,e)=>t?n(t):i(e))}catch(o){return n(o)}})},_$src_203.mnemonicToEntropy=h,_$src_203.entropyToMnemonic=f,_$src_203.generateMnemonic=function(t,e,r){if((t=t||128)%32!=0)throw new TypeError("Invalid entropy");return f((e=e||_$browser_415)(t/8),r)},_$src_203.validateMnemonic=function(t,r){try{h(t,r)}catch(e){return!1}return!0},_$src_203.wordlists=_$_wordlists_202.wordlists}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$mnemonic_28={};(function(t){(function(){const e=_$safeBuffer_431.Buffer;_$mnemonic_28=class{constructor(t){this._address=t}generate(t=128,e){return _$src_203.generateMnemonic(t,_$browser_415,e)}fromEntropy(t,e){return _$src_203.entropyToMnemonic(t,e)}toEntropy(t,r){return e.from(_$src_203.mnemonicToEntropy(t,r),"hex")}validate(t,e){const r=t.split(" ");if(0===r.length)return"Blank mnemonic";for(let i=0;i(s=i+1)&&(n=s),n>(s=r[a+1]+1)&&(n=s),r[a]=i;r[a]=n}return n},getAsync:function(e,r,i,n){if(n=function(t){const e=Array.prototype.slice.call(arguments,1);for(let r=0;r(f=a+1)&&(s=f),f=o[h+1]+1,s>f&&(s=f),o[h]=a,l=(new Date).valueOf()}if(null!==n.progress)try{n.progress.call(null,100*u/e.length)}catch(err){return i("Progress callback: "+err.toString())}var p;p=d,"function"==typeof t?t(p):setTimeout(p,0)};d()}}}).call(this)}).call(this,_$main_477({}).setImmediate);var _$validation_317={};function ValidationError(t){var e=new Error;this.name=e.name="ValidationError",this.message=e.message=t,this.stack=e.stack}ValidationError.prototype=Object.create(Error.prototype),_$validation_317={ValidationError:ValidationError,validate:function(t,e){if(!t)throw new ValidationError(e)}};var validate=_$validation_317.validate,CHARSET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",CHARSET_INVERSE_INDEX={q:0,p:1,z:2,r:3,y:4,9:5,x:6,8:7,g:8,f:9,2:10,t:11,v:12,d:13,w:14,0:15,s:16,3:17,j:18,n:19,5:20,4:21,k:22,h:23,c:24,e:25,6:26,m:27,u:28,a:29,7:30,l:31},_$base32_314={encode:function(t){validate(t instanceof Uint8Array,"Invalid data: "+t+".");for(var e="",r=0;r0?Math.floor(t):Math.ceil(t)}function p(t,r){var i,n,o=t.length,a=r.length,s=new Array(o),u=0,h=e;for(n=0;n=h?1:0,s[n]=i-u*h;for(;n0&&s.push(u),s}function _(t,e){return t.length>=e.length?p(t,e):p(e,t)}function m(t,r){var i,n,o=t.length,a=new Array(o),s=e;for(n=0;n0;)a[n++]=r%s,r=Math.floor(r/s);return a}function g(t,e){var r,i,n=t.length,o=e.length,a=new Array(n),s=0;for(r=0;r0;)a[n++]=u%s,u=Math.floor(u/s);return a}function w(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function M(t,r,i){return new a(t=0;--r)n=(o=1e7*n+t[r])-(i=d(o/e))*e,s[r]=0|i;return[s,0|n]}function S(t,r){var i,n,u=K(r),p=t.value,_=u.value;if(0===_)throw new Error("Cannot divide by zero");if(t.isSmall)return u.isSmall?[new s(d(p/_)),new s(p%_)]:[o[0],t];if(u.isSmall){if(1===_)return[t,o[0]];if(-1==_)return[t.negate(),o[0]];var m=Math.abs(_);if(m=0;n--){for(i=p-1,y[n+d]!==m&&(i=Math.floor((y[n+d]*p+y[n+d-1])/m)),o=0,a=0,u=b.length,s=0;su&&(n=1e7*(n+1)),r=Math.ceil(n/o);do{if(A(a=v(e,r),l)<=0)break;r--}while(r);h.push(r),l=g(l,a)}return h.reverse(),[f(h),f(l)]}(p,_))[0];var w=t.sign!==u.sign,M=i[1],$=t.sign;return"number"==typeof n?(w&&(n=-n),n=new s(n)):n=new a(n,w),"number"==typeof M?($&&(M=-M),M=new s(M)):M=new a(M,$),[n,M]}function A(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function B(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function k(t,e){for(var r,i,n,a=t.prev(),s=a,u=0;s.isEven();)s=s.divide(2),u++;t:for(i=0;i=0?i=g(t,e):(i=g(e,t),r=!r),"number"==typeof(i=f(i))?(r&&(i=-i),new s(i)):new a(i,r)}(r,i,this.sign)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(t){var e=K(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var i=e.value;return e.isSmall?new s(r-i):y(i,Math.abs(r),r>=0)},s.prototype.minus=s.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},s.prototype.negate=function(){var t=this.sign,e=new s(-this.value);return e.sign=!t,e},a.prototype.abs=function(){return new a(this.value,!1)},s.prototype.abs=function(){return new s(Math.abs(this.value))},a.prototype.multiply=function(t){var r,i,n,s=K(t),u=this.value,f=s.value,l=this.sign!==s.sign;if(s.isSmall){if(0===f)return o[0];if(1===f)return this;if(-1===f)return this.negate();if((r=Math.abs(f))0?function t(e,r){var i=Math.max(e.length,r.length);if(i<=30)return b(e,r);i=Math.ceil(i/2);var n=e.slice(i),o=e.slice(0,i),a=r.slice(i),s=r.slice(0,i),u=t(o,s),h=t(n,a),f=t(_(o,n),_(s,a)),l=_(_(u,w(g(g(f,u),h),i)),w(h,2*i));return c(l),l}(u,f):b(u,f),l)},a.prototype.times=a.prototype.multiply,s.prototype._multiplyBySmall=function(t){return u(t.value*this.value)?new s(t.value*this.value):M(Math.abs(t.value),h(Math.abs(this.value)),this.sign!==t.sign)},a.prototype._multiplyBySmall=function(t){return 0===t.value?o[0]:1===t.value?this:-1===t.value?this.negate():M(Math.abs(t.value),this.value,this.sign!==t.sign)},s.prototype.multiply=function(t){return K(t)._multiplyBySmall(this)},s.prototype.times=s.prototype.multiply,a.prototype.square=function(){return new a($(this.value),!1)},s.prototype.square=function(){var t=this.value*this.value;return u(t)?new s(t):new a($(h(Math.abs(this.value))),!1)},a.prototype.divmod=function(t){var e=S(this,t);return{quotient:e[0],remainder:e[1]}},s.prototype.divmod=a.prototype.divmod,a.prototype.divide=function(t){return S(this,t)[0]},s.prototype.over=s.prototype.divide=a.prototype.over=a.prototype.divide,a.prototype.mod=function(t){return S(this,t)[1]},s.prototype.remainder=s.prototype.mod=a.prototype.remainder=a.prototype.mod,a.prototype.pow=function(t){var e,r,i,n=K(t),a=this.value,h=n.value;if(0===h)return o[1];if(0===a)return o[0];if(1===a)return o[1];if(-1===a)return n.isEven()?o[1]:o[-1];if(n.sign)return o[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&u(e=Math.pow(a,h)))return new s(d(e));for(r=this,i=o[1];!0&h&&(i=i.times(r),--h),0!==h;)h/=2,r=r.square();return i},s.prototype.pow=a.prototype.pow,a.prototype.modPow=function(t,e){if(t=K(t),(e=K(e)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var r=o[1],i=this.mod(e);t.isPositive();){if(i.isZero())return o[0];t.isOdd()&&(r=r.multiply(i).mod(e)),t=t.divide(2),i=i.square().mod(e)}return r},s.prototype.modPow=a.prototype.modPow,a.prototype.compareAbs=function(t){var e=K(t),r=this.value,i=e.value;return e.isSmall?1:A(r,i)},s.prototype.compareAbs=function(t){var e=K(t),r=Math.abs(this.value),i=e.value;return e.isSmall?r===(i=Math.abs(i))?0:r>i?1:-1:-1},a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,i=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:A(r,i)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare,s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,i=e.value;return e.isSmall?r==i?0:r>i?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},s.prototype.compareTo=s.prototype.compare,a.prototype.equals=function(t){return 0===this.compare(t)},s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals,a.prototype.notEquals=function(t){return 0!==this.compare(t)},s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals,a.prototype.greater=function(t){return this.compare(t)>0},s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater,a.prototype.lesser=function(t){return this.compare(t)<0},s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser,a.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals,a.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals,a.prototype.isEven=function(){return 0==(1&this.value[0])},s.prototype.isEven=function(){return 0==(1&this.value)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},s.prototype.isOdd=function(){return 1==(1&this.value)},a.prototype.isPositive=function(){return!this.sign},s.prototype.isPositive=function(){return this.value>0},a.prototype.isNegative=function(){return this.sign},s.prototype.isNegative=function(){return this.value<0},a.prototype.isUnit=function(){return!1},s.prototype.isUnit=function(){return 1===Math.abs(this.value)},a.prototype.isZero=function(){return!1},s.prototype.isZero=function(){return 0===this.value},a.prototype.isDivisibleBy=function(t){var e=K(t),r=e.value;return 0!==r&&(1===r||(2===r?this.isEven():this.mod(e).equals(o[0])))},s.prototype.isDivisibleBy=a.prototype.isDivisibleBy,a.prototype.isPrime=function(t){var e=B(this);if(void 0!==e)return e;var r=this.abs(),i=r.bitLength();if(i<=64)return k(r,[2,325,9375,28178,450775,9780504,1795265022]);for(var n=Math.log(2)*i,o=Math.ceil(!0===t?2*Math.pow(n,2):n),a=[],s=0;s-r?new s(t-1):new a(i,!0)};for(var T=[1];2*T[T.length-1]<=e;)T.push(2*T[T.length-1]);var x=T.length,I=T[x-1];function P(t){return("number"==typeof t||"string"==typeof t)&&+Math.abs(t)<=e||t instanceof a&&t.value.length<=1}function R(t,e,r){e=K(e);for(var i=t.isNegative(),n=e.isNegative(),o=i?t.not():t,a=n?e.not():e,s=0,u=0,h=null,f=null,c=[];!o.isZero()||!a.isZero();)s=(h=S(o,I))[1].toJSNumber(),i&&(s=I-1-s),u=(f=S(a,I))[1].toJSNumber(),n&&(u=I-1-u),o=h[0],a=f[0],c.push(r(s,u));for(var l=0!==r(i?1:0,n?1:0)?bigInt(-1):bigInt(0),d=c.length-1;d>=0;d-=1)l=l.multiply(I).add(bigInt(c[d]));return l}a.prototype.shiftLeft=function(t){if(!P(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftRight(-t);var e=this;if(e.isZero())return e;for(;t>=x;)e=e.multiply(I),t-=x-1;return e.multiply(T[t])},s.prototype.shiftLeft=a.prototype.shiftLeft,a.prototype.shiftRight=function(t){var e;if(!P(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftLeft(-t);for(var r=this;t>=x;){if(r.isZero()||r.isNegative()&&r.isUnit())return r;r=(e=S(r,I))[1].isNegative()?e[0].prev():e[0],t-=x-1}return(e=S(r,T[t]))[1].isNegative()?e[0].prev():e[0]},s.prototype.shiftRight=a.prototype.shiftRight,a.prototype.not=function(){return this.negate().prev()},s.prototype.not=a.prototype.not,a.prototype.and=function(t){return R(this,t,(function(t,e){return t&e}))},s.prototype.and=a.prototype.and,a.prototype.or=function(t){return R(this,t,(function(t,e){return t|e}))},s.prototype.or=a.prototype.or,a.prototype.xor=function(t){return R(this,t,(function(t,e){return t^e}))},s.prototype.xor=a.prototype.xor;function C(t){var r=t.value,i="number"==typeof r?r|1<<30:r[0]+r[1]*e|1073758208;return i&-i}function O(t,e){return t=K(t),e=K(e),t.greater(e)?t:e}function N(t,e){return t=K(t),e=K(e),t.lesser(e)?t:e}function L(t,e){if(t=K(t).abs(),e=K(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,i,n=o[1];t.isEven()&&e.isEven();)r=Math.min(C(t),C(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(C(t));do{for(;e.isEven();)e=e.divide(C(e));t.greater(e)&&(i=e,e=t,t=i),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}a.prototype.bitLength=function(){var t=this;return t.compareTo(bigInt(0))<0&&(t=t.negate().subtract(bigInt(1))),0===t.compareTo(bigInt(0))?bigInt(0):bigInt(function t(e,r){if(r.compareTo(e)<=0){var i=t(e,r.square(r)),n=i.p,o=i.e,a=n.multiply(r);return a.compareTo(e)<=0?{p:a,e:2*o+1}:{p:n,e:2*o}}return{p:bigInt(1),e:0}}(t,bigInt(2)).e).add(bigInt(1))},s.prototype.bitLength=a.prototype.bitLength;var D=function(t,e){for(var r=t.length,i=Math.abs(e),o=0;o=i){if("1"===f&&1===i)continue;throw new Error(f+" is not a valid digit in base "+e+".")}if(f.charCodeAt(0)-87>=i)throw new Error(f+" is not a valid digit in base "+e+".")}if(2<=e&&e<=36&&r<=n/Math.log(e)){var a=parseInt(t,e);if(isNaN(a))throw new Error(f+" is not a valid digit in base "+e+".");return new s(parseInt(t,e))}e=K(e);var u=[],h="-"===t[0];for(o=h?1:0;o"!==t[o]);u.push(K(t.slice(l+1,o)))}}return U(u,e,h)};function U(t,e,r){var i,n=o[0],a=o[1];for(i=t.length-1;i>=0;i--)n=n.add(t[i].times(a)),a=a.times(e);return r?n.negate():n}function j(t){return t<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t):"<"+t+">"}function H(t,e){if((e=bigInt(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(+t-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var i=!1;if(t.isNegative()&&e.isPositive()&&(i=!0,t=t.abs()),e.equals(1))return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+t)).map(Number.prototype.valueOf,1),isNegative:i};for(var n,o=[],a=t;a.isNegative()||a.compareAbs(e)>=0;){n=a.divmod(e),a=n.quotient;var s=n.remainder;s.isNegative()&&(s=e.minus(s).abs(),a=a.next()),o.push(s.toJSNumber())}return o.push(a.toJSNumber()),{value:o.reverse(),isNegative:i}}function z(t,e){var r=H(t,e);return(r.isNegative?"-":"")+r.value.map(j).join("")}function q(t){if(u(+t)){var e=+t;if(e===d(e))return new s(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var i=t.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+i.join("e"));if(2===i.length){var n=i[1];if("+"===n[0]&&(n=n.slice(1)),(n=+n)!==d(n)||!u(n))throw new Error("Invalid integer: "+n+" is not a valid exponent.");var o=i[0],h=o.indexOf(".");if(h>=0&&(n-=o.length-h-1,o=o.slice(0,h)+o.slice(h+1)),n<0)throw new Error("Cannot include negative exponent part for integers");t=o+=new Array(n+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);for(var f=[],l=t.length,p=l-7;l>0;)f.push(+t.slice(p,l)),(p-=7)<0&&(p=0),l-=7;return c(f),new a(f,r)}function K(t){return"number"==typeof t?function(t){if(u(t)){if(t!==d(t))throw new Error(t+" is not an integer.");return new s(t)}return q(t.toString())}(t):"string"==typeof t?q(t):t}a.prototype.toArray=function(t){return H(this,t)},s.prototype.toArray=function(t){return H(this,t)},a.prototype.toString=function(t){if(void 0===t&&(t=10),10!==t)return z(this,t);for(var e,r=this.value,i=r.length,n=String(r[--i]);--i>=0;)e=String(r[i]),n+="0000000".slice(e.length)+e;return(this.sign?"-":"")+n},s.prototype.toString=function(t){return void 0===t&&(t=10),10!=t?z(this,t):String(this.value)},a.prototype.toJSON=s.prototype.toJSON=function(){return this.toString()},a.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf,s.prototype.valueOf=function(){return this.value},s.prototype.toJSNumber=s.prototype.valueOf;for(var F=0;F<1e3;F++)o[F]=new s(F),F>0&&(o[-F]=new s(-F));return o.one=o[1],o.zero=o[0],o.minusOne=o[-1],o.max=O,o.min=N,o.gcd=L,o.lcm=function(t,e){return t=K(t).abs(),e=K(e).abs(),t.divide(L(t,e)).multiply(e)},o.isInstance=function(t){return t instanceof a||t instanceof s},o.randBetween=function(t,r){var i=N(t=K(t),r=K(r)),n=O(t,r).subtract(i).add(1);if(n.isSmall)return i.add(Math.floor(Math.random()*n));for(var o=[],u=!0,h=n.value.length-1;h>=0;h--){var c=u?n.value[h]:e,l=d(Math.random()*c);o.unshift(l),l>e==0,"Invalid value: "+c+"."),u=u<=r;)h-=r,a[s]=u>>h&o,++s}return i?__validate_316(h0&&(a[s]=u<=e?i(void 0,o-n,o):(t.next(),void a()))}))}()},_$account_8={};function Account(t){this.chains=t}Account.fromJSON=function(t,e,r){},Account.prototype.clone=function(){return new Account(this.chains.map((function(t){return t.clone()})))},Account.prototype.containsAddress=function(t){return this.chains.some((function(e){return void 0!==e.find(t)}))},Account.prototype.derive=function(t,e){let r;return this.chains.some((function(i,n){return r=i.derive(t,e&&e[n])})),r},Account.prototype.discoverChain=function(t,e,r,i){const n=this.chains,o=n[t].clone();_$discovery_10(o,e,r,(function(e,r,a){if(e)return i(e);const s=a-r;for(let t=1;t0?Math.floor(t):Math.ceil(t)}function _(t,r){var i,n,o=t.length,a=r.length,s=new Array(o),u=0,h=e;for(n=0;n=h?1:0,s[n]=i-u*h;for(;n0&&s.push(u),s}function m(t,e){return t.length>=e.length?_(t,e):_(e,t)}function g(t,r){var i,n,o=t.length,a=new Array(o),s=e;for(n=0;n0;)a[n++]=r%s,r=Math.floor(r/s);return a}function y(t,e){var r,i,n=t.length,o=e.length,a=new Array(n),s=0;for(r=0;r0;)a[n++]=u%s,u=Math.floor(u/s);return a}function M(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function $(t,r,i){return new a(t=0;--r)n=(o=1e7*n+t[r])-(i=p(o/e))*e,s[r]=0|i;return[s,0|n]}function A(t,r){var i,h=K(r);if(n)return[new u(t.value/h.value),new u(t.value%h.value)];var _,m=t.value,g=h.value;if(0===g)throw new Error("Cannot divide by zero");if(t.isSmall)return h.isSmall?[new s(p(m/g)),new s(m%g)]:[o[0],t];if(h.isSmall){if(1===g)return[t,o[0]];if(-1==g)return[t.negate(),o[0]];var b=Math.abs(g);if(b=0;n--){for(i=p-1,y[n+l]!==m&&(i=Math.floor((y[n+l]*p+y[n+l-1])/m)),o=0,a=0,u=b.length,s=0;su&&(n=1e7*(n+1)),r=Math.ceil(n/o);do{if(B(a=w(e,r),f)<=0)break;r--}while(r);h.push(r),f=y(f,a)}return h.reverse(),[c(h),c(f)]}(m,g))[0];var $=t.sign!==h.sign,E=i[1],A=t.sign;return"number"==typeof _?($&&(_=-_),_=new s(_)):_=new a(_,$),"number"==typeof E?(A&&(E=-E),E=new s(E)):E=new a(E,A),[_,E]}function B(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function k(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function T(t,e){for(var r,i,n,o=t.prev(),a=o,s=0;a.isEven();)a=a.divide(2),s++;t:for(i=0;i=0?i=y(t,e):(i=y(e,t),r=!r),"number"==typeof(i=c(i))?(r&&(i=-i),new s(i)):new a(i,r)}(r,i,this.sign)},a.prototype.minus=a.prototype.subtract,s.prototype.subtract=function(t){var e=K(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var i=e.value;return e.isSmall?new s(r-i):b(i,Math.abs(r),r>=0)},s.prototype.minus=s.prototype.subtract,u.prototype.subtract=function(t){return new u(this.value-K(t).value)},u.prototype.minus=u.prototype.subtract,a.prototype.negate=function(){return new a(this.value,!this.sign)},s.prototype.negate=function(){var t=this.sign,e=new s(-this.value);return e.sign=!t,e},u.prototype.negate=function(){return new u(-this.value)},a.prototype.abs=function(){return new a(this.value,!1)},s.prototype.abs=function(){return new s(Math.abs(this.value))},u.prototype.abs=function(){return new u(this.value>=0?this.value:-this.value)},a.prototype.multiply=function(t){var r,i,n,s=K(t),u=this.value,h=s.value,c=this.sign!==s.sign;if(s.isSmall){if(0===h)return o[0];if(1===h)return this;if(-1===h)return this.negate();if((r=Math.abs(h))0?function t(e,r){var i=Math.max(e.length,r.length);if(i<=30)return v(e,r);i=Math.ceil(i/2);var n=e.slice(i),o=e.slice(0,i),a=r.slice(i),s=r.slice(0,i),u=t(o,s),h=t(n,a),f=t(m(o,n),m(s,a)),c=m(m(u,M(y(y(f,u),h),i)),M(h,2*i));return l(c),c}(u,h):v(u,h),c)},a.prototype.times=a.prototype.multiply,s.prototype._multiplyBySmall=function(t){return h(t.value*this.value)?new s(t.value*this.value):$(Math.abs(t.value),f(Math.abs(this.value)),this.sign!==t.sign)},a.prototype._multiplyBySmall=function(t){return 0===t.value?o[0]:1===t.value?this:-1===t.value?this.negate():$(Math.abs(t.value),this.value,this.sign!==t.sign)},s.prototype.multiply=function(t){return K(t)._multiplyBySmall(this)},s.prototype.times=s.prototype.multiply,u.prototype.multiply=function(t){return new u(this.value*K(t).value)},u.prototype.times=u.prototype.multiply,a.prototype.square=function(){return new a(E(this.value),!1)},s.prototype.square=function(){var t=this.value*this.value;return h(t)?new s(t):new a(E(f(Math.abs(this.value))),!1)},u.prototype.square=function(t){return new u(this.value*this.value)},a.prototype.divmod=function(t){var e=A(this,t);return{quotient:e[0],remainder:e[1]}},u.prototype.divmod=s.prototype.divmod=a.prototype.divmod,a.prototype.divide=function(t){return A(this,t)[0]},u.prototype.over=u.prototype.divide=function(t){return new u(this.value/K(t).value)},s.prototype.over=s.prototype.divide=a.prototype.over=a.prototype.divide,a.prototype.mod=function(t){return A(this,t)[1]},u.prototype.mod=u.prototype.remainder=function(t){return new u(this.value%K(t).value)},s.prototype.remainder=s.prototype.mod=a.prototype.remainder=a.prototype.mod,a.prototype.pow=function(t){var e,r,i,n=K(t),a=this.value,u=n.value;if(0===u)return o[1];if(0===a)return o[0];if(1===a)return o[1];if(-1===a)return n.isEven()?o[1]:o[-1];if(n.sign)return o[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&h(e=Math.pow(a,u)))return new s(p(e));for(r=this,i=o[1];!0&u&&(i=i.times(r),--u),0!==u;)u/=2,r=r.square();return i},s.prototype.pow=a.prototype.pow,u.prototype.pow=function(t){var e=K(t),r=this.value,i=e.value,n=BigInt(0),a=BigInt(1),s=BigInt(2);if(i===n)return o[1];if(r===n)return o[0];if(r===a)return o[1];if(r===BigInt(-1))return e.isEven()?o[1]:o[-1];if(e.isNegative())return new u(n);for(var h=this,f=o[1];(i&a)===a&&(f=f.times(h),--i),i!==n;)i/=s,h=h.square();return f},a.prototype.modPow=function(t,e){if(t=K(t),(e=K(e)).isZero())throw new Error("Cannot take modPow with modulus 0");var r=o[1],i=this.mod(e);for(t.isNegative()&&(t=t.multiply(o[-1]),i=i.modInv(e));t.isPositive();){if(i.isZero())return o[0];t.isOdd()&&(r=r.multiply(i).mod(e)),t=t.divide(2),i=i.square().mod(e)}return r},u.prototype.modPow=s.prototype.modPow=a.prototype.modPow,a.prototype.compareAbs=function(t){var e=K(t),r=this.value,i=e.value;return e.isSmall?1:B(r,i)},s.prototype.compareAbs=function(t){var e=K(t),r=Math.abs(this.value),i=e.value;return e.isSmall?r===(i=Math.abs(i))?0:r>i?1:-1:-1},u.prototype.compareAbs=function(t){var e=this.value,r=K(t).value;return(e=e>=0?e:-e)===(r=r>=0?r:-r)?0:e>r?1:-1},a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,i=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:B(r,i)*(this.sign?-1:1)},a.prototype.compareTo=a.prototype.compare,s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,i=e.value;return e.isSmall?r==i?0:r>i?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},s.prototype.compareTo=s.prototype.compare,u.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=this.value,r=K(t).value;return e===r?0:e>r?1:-1},u.prototype.compareTo=u.prototype.compare,a.prototype.equals=function(t){return 0===this.compare(t)},u.prototype.eq=u.prototype.equals=s.prototype.eq=s.prototype.equals=a.prototype.eq=a.prototype.equals,a.prototype.notEquals=function(t){return 0!==this.compare(t)},u.prototype.neq=u.prototype.notEquals=s.prototype.neq=s.prototype.notEquals=a.prototype.neq=a.prototype.notEquals,a.prototype.greater=function(t){return this.compare(t)>0},u.prototype.gt=u.prototype.greater=s.prototype.gt=s.prototype.greater=a.prototype.gt=a.prototype.greater,a.prototype.lesser=function(t){return this.compare(t)<0},u.prototype.lt=u.prototype.lesser=s.prototype.lt=s.prototype.lesser=a.prototype.lt=a.prototype.lesser,a.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},u.prototype.geq=u.prototype.greaterOrEquals=s.prototype.geq=s.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals,a.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},u.prototype.leq=u.prototype.lesserOrEquals=s.prototype.leq=s.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals,a.prototype.isEven=function(){return 0==(1&this.value[0])},s.prototype.isEven=function(){return 0==(1&this.value)},u.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},a.prototype.isOdd=function(){return 1==(1&this.value[0])},s.prototype.isOdd=function(){return 1==(1&this.value)},u.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},a.prototype.isPositive=function(){return!this.sign},s.prototype.isPositive=function(){return this.value>0},u.prototype.isPositive=s.prototype.isPositive,a.prototype.isNegative=function(){return this.sign},s.prototype.isNegative=function(){return this.value<0},u.prototype.isNegative=s.prototype.isNegative,a.prototype.isUnit=function(){return!1},s.prototype.isUnit=function(){return 1===Math.abs(this.value)},u.prototype.isUnit=function(){return this.abs().value===BigInt(1)},a.prototype.isZero=function(){return!1},s.prototype.isZero=function(){return 0===this.value},u.prototype.isZero=function(){return this.value===BigInt(0)},a.prototype.isDivisibleBy=function(t){var e=K(t);return!e.isZero()&&(!!e.isUnit()||(0===e.compareAbs(2)?this.isEven():this.mod(e).isZero()))},u.prototype.isDivisibleBy=s.prototype.isDivisibleBy=a.prototype.isDivisibleBy,a.prototype.isPrime=function(t){var e=k(this);if(void 0!==e)return e;var r=this.abs(),i=r.bitLength();if(i<=64)return T(r,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var n=Math.log(2)*i.toJSNumber(),o=Math.ceil(!0===t?2*Math.pow(n,2):n),a=[],s=0;s-r?new s(t-1):new a(i,!0)},u.prototype.prev=function(){return new u(this.value-BigInt(1))};for(var x=[1];2*x[x.length-1]<=e;)x.push(2*x[x.length-1]);var I=x.length,P=x[I-1];function R(t){return Math.abs(t)<=e}function C(t,e,r){e=K(e);for(var i=t.isNegative(),n=e.isNegative(),o=i?t.not():t,a=n?e.not():e,s=0,u=0,h=null,f=null,c=[];!o.isZero()||!a.isZero();)s=(h=A(o,P))[1].toJSNumber(),i&&(s=P-1-s),u=(f=A(a,P))[1].toJSNumber(),n&&(u=P-1-u),o=h[0],a=f[0],c.push(r(s,u));for(var l=0!==r(i?1:0,n?1:0)?__bigInt_189(-1):__bigInt_189(0),d=c.length-1;d>=0;d-=1)l=l.multiply(P).add(__bigInt_189(c[d]));return l}a.prototype.shiftLeft=function(t){var e=K(t).toJSNumber();if(!R(e))throw new Error(String(e)+" is too large for shifting.");if(e<0)return this.shiftRight(-e);var r=this;if(r.isZero())return r;for(;e>=I;)r=r.multiply(P),e-=I-1;return r.multiply(x[e])},u.prototype.shiftLeft=s.prototype.shiftLeft=a.prototype.shiftLeft,a.prototype.shiftRight=function(t){var e,r=K(t).toJSNumber();if(!R(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftLeft(-r);for(var i=this;r>=I;){if(i.isZero()||i.isNegative()&&i.isUnit())return i;i=(e=A(i,P))[1].isNegative()?e[0].prev():e[0],r-=I-1}return(e=A(i,x[r]))[1].isNegative()?e[0].prev():e[0]},u.prototype.shiftRight=s.prototype.shiftRight=a.prototype.shiftRight,a.prototype.not=function(){return this.negate().prev()},u.prototype.not=s.prototype.not=a.prototype.not,a.prototype.and=function(t){return C(this,t,(function(t,e){return t&e}))},u.prototype.and=s.prototype.and=a.prototype.and,a.prototype.or=function(t){return C(this,t,(function(t,e){return t|e}))},u.prototype.or=s.prototype.or=a.prototype.or,a.prototype.xor=function(t){return C(this,t,(function(t,e){return t^e}))},u.prototype.xor=s.prototype.xor=a.prototype.xor;function O(t){var r=t.value,i="number"==typeof r?r|1<<30:"bigint"==typeof r?r|BigInt(1<<30):r[0]+r[1]*e|1073758208;return i&-i}function N(t,e){return t=K(t),e=K(e),t.greater(e)?t:e}function L(t,e){return t=K(t),e=K(e),t.lesser(e)?t:e}function D(t,e){if(t=K(t).abs(),e=K(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,i,n=o[1];t.isEven()&&e.isEven();)r=L(O(t),O(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(O(t));do{for(;e.isEven();)e=e.divide(O(e));t.greater(e)&&(i=e,e=t,t=i),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}a.prototype.bitLength=function(){var t=this;return t.compareTo(__bigInt_189(0))<0&&(t=t.negate().subtract(__bigInt_189(1))),0===t.compareTo(__bigInt_189(0))?__bigInt_189(0):__bigInt_189(function t(e,r){if(r.compareTo(e)<=0){var i=t(e,r.square(r)),n=i.p,o=i.e,a=n.multiply(r);return a.compareTo(e)<=0?{p:a,e:2*o+1}:{p:n,e:2*o}}return{p:__bigInt_189(1),e:0}}(t,__bigInt_189(2)).e).add(__bigInt_189(1))},u.prototype.bitLength=s.prototype.bitLength=a.prototype.bitLength;var U=function(t,e,r,i){r=r||"0123456789abcdefghijklmnopqrstuvwxyz",t=String(t),i||(t=t.toLowerCase(),r=r.toLowerCase());var n,o=t.length,a=Math.abs(e),s={};for(n=0;n=a){if("1"===f&&1===a)continue;throw new Error(f+" is not a valid digit in base "+e+".")}e=K(e);var u=[],h="-"===t[0];for(n=h?1:0;n"!==t[n]&&n=0;i--)n=n.add(t[i].times(a)),a=a.times(e);return r?n.negate():n}function H(t,e){if((e=__bigInt_189(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(t.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var i=!1;if(t.isNegative()&&e.isPositive()&&(i=!0,t=t.abs()),e.isUnit())return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(t.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:i};for(var n,o=[],a=t;a.isNegative()||a.compareAbs(e)>=0;){n=a.divmod(e),a=n.quotient;var s=n.remainder;s.isNegative()&&(s=e.minus(s).abs(),a=a.next()),o.push(s.toJSNumber())}return o.push(a.toJSNumber()),{value:o.reverse(),isNegative:i}}function z(t,e,r){var i=H(t,e);return(i.isNegative?"-":"")+i.value.map((function(t){return function(t,e){return t<(e=e||"0123456789abcdefghijklmnopqrstuvwxyz").length?e[t]:"<"+t+">"}(t,r)})).join("")}function q(t){if(h(+t)){var e=+t;if(e===p(e))return n?new u(BigInt(e)):new s(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var i=t.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+i.join("e"));if(2===i.length){var o=i[1];if("+"===o[0]&&(o=o.slice(1)),(o=+o)!==p(o)||!h(o))throw new Error("Invalid integer: "+o+" is not a valid exponent.");var f=i[0],c=f.indexOf(".");if(c>=0&&(o-=f.length-c-1,f=f.slice(0,c)+f.slice(c+1)),o<0)throw new Error("Cannot include negative exponent part for integers");t=f+=new Array(o+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);if(n)return new u(BigInt(r?"-"+t:t));for(var d=[],_=t.length,m=_-7;_>0;)d.push(+t.slice(m,_)),(m-=7)<0&&(m=0),_-=7;return l(d),new a(d,r)}function K(t){return"number"==typeof t?function(t){if(n)return new u(BigInt(t));if(h(t)){if(t!==p(t))throw new Error(t+" is not an integer.");return new s(t)}return q(t.toString())}(t):"string"==typeof t?q(t):"bigint"==typeof t?new u(t):t}a.prototype.toArray=function(t){return H(this,t)},s.prototype.toArray=function(t){return H(this,t)},u.prototype.toArray=function(t){return H(this,t)},a.prototype.toString=function(t,e){if(void 0===t&&(t=10),10!==t||e)return z(this,t,e);for(var r,i=this.value,n=i.length,o=String(i[--n]);--n>=0;)r=String(i[n]),o+="0000000".slice(r.length)+r;return(this.sign?"-":"")+o},s.prototype.toString=function(t,e){return void 0===t&&(t=10),10!=t||e?z(this,t,e):String(this.value)},u.prototype.toString=s.prototype.toString,u.prototype.toJSON=a.prototype.toJSON=s.prototype.toJSON=function(){return this.toString()},a.prototype.valueOf=function(){return parseInt(this.toString(),10)},a.prototype.toJSNumber=a.prototype.valueOf,s.prototype.valueOf=function(){return this.value},s.prototype.toJSNumber=s.prototype.valueOf,u.prototype.valueOf=u.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var F=0;F<1e3;F++)o[F]=K(F),F>0&&(o[-F]=K(-F));return o.one=o[1],o.zero=o[0],o.minusOne=o[-1],o.max=N,o.min=L,o.gcd=D,o.lcm=function(t,e){return t=K(t).abs(),e=K(e).abs(),t.divide(D(t,e)).multiply(e)},o.isInstance=function(t){return t instanceof a||t instanceof s||t instanceof u},o.randBetween=function(t,r,i){t=K(t),r=K(r);var n=i||Math.random,a=L(t,r),s=N(t,r).subtract(a).add(1);if(s.isSmall)return a.add(Math.floor(n()*s));for(var u=H(s,e).value,h=[],f=!0,c=0;c>e==0,"Invalid value: "+c+"."),u=u<=r;)h-=r,a[s]=u>>h&o,++s}return i?__validate_256(h0&&(a[s]=u<new _$bip32Utils_11.Chain(t.neutered()));return new _$bip32Utils_11.Account(e)}createChain(t){return new _$bip32Utils_11.Chain(t)}};const SEQUENCE_FINAL=4294967295,SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31,SEQUENCE_LOCKTIME_GRANULARITY=9,SEQUENCE_LOCKTIME_MASK=65535,SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22,BLOCKS_MAX=SEQUENCE_LOCKTIME_MASK,SECONDS_MOD=1<SECONDS_MAX)throw new TypeError("Expected Number seconds <= "+SECONDS_MAX);if(r%SECONDS_MOD!=0)throw new TypeError("Expected Number seconds as a multiple of "+SECONDS_MOD);return SEQUENCE_LOCKTIME_TYPE_FLAG|r>>SEQUENCE_LOCKTIME_GRANULARITY}if(!Number.isFinite(e))throw new TypeError("Expected Number blocks");if(e>SEQUENCE_LOCKTIME_MASK)throw new TypeError("Expected Number blocks <= "+BLOCKS_MAX);return e}};class __TransactionBuilder_40{static setAddress(t){__TransactionBuilder_40._address=t}constructor(t="mainnet"){let e;const r=(e="bitcoincash"===t||"mainnet"===t?_$coininfo_86.bitcoincash.main:_$coininfo_86.bitcoincash.test).toBitcoinJS();this.transaction=new _$src_55.TransactionBuilder(r),this.DEFAULT_SEQUENCE=4294967295,this.hashTypes={SIGHASH_ALL:1,SIGHASH_NONE:2,SIGHASH_SINGLE:3,SIGHASH_ANYONECANPAY:128,SIGHASH_BITCOINCASH_BIP143:64,ADVANCED_TRANSACTION_MARKER:0,ADVANCED_TRANSACTION_FLAG:1},this.signatureAlgorithms={ECDSA:_$src_55.ECSignature.ECDSA,SCHNORR:_$src_55.ECSignature.SCHNORR},this.bip66=_$bip66_212,this.bip68=_$bcBip68_152,this.p2shInput=!1}addInput(t,e,r=this.DEFAULT_SEQUENCE,i){this.transaction.addInput(t,e,r,i)}addInputScript(t,e){this.tx=this.transaction.buildIncomplete(),this.tx.setInputScript(t,e),this.p2shInput=!0}addInputScripts(t){this.tx=this.transaction.buildIncomplete(),t.forEach(t=>{this.tx.setInputScript(t.vout,t.script)}),this.p2shInput=!0}addOutput(t,e){try{this.transaction.addOutput(__TransactionBuilder_40._address.toLegacyAddress(t),e)}catch(r){this.transaction.addOutput(t,e)}}setLockTime(t){this.transaction.setLockTime(t)}sign(t,e,r,i=this.hashTypes.SIGHASH_ALL,n,o){this.transaction.sign(t,e,r,i,n,void 0,o)}build(){return!0===this.p2shInput?this.tx:this.transaction.build()}}var _$TransactionBuilder_40=__TransactionBuilder_40;class __ECPair_22{static setAddress(t){__ECPair_22._address=t}static fromWIF(t){let e,r;"L"===t[0]||"K"===t[0]?e="mainnet":"c"===t[0]&&(e="testnet");const i=(r="mainnet"===e?_$coininfo_86.bitcoincash.main:_$coininfo_86.bitcoincash.test).toBitcoinJS();return _$src_55.ECPair.fromWIF(t,i)}static toWIF(t){return t.toWIF()}static sign(t,e){return t.sign(e)}static verify(t,e,r){return t.verify(e,r)}static fromPublicKey(t){return _$src_55.ECPair.fromPublicKeyBuffer(t)}static toPublicKey(t){return t.getPublicKeyBuffer()}static toLegacyAddress(t){return t.getAddress()}static toCashAddress(t,e=!1){return __ECPair_22._address.toCashAddress(t.getAddress(),!0,e)}}var _$ECPair_22=__ECPair_22,_$script_33=class{constructor(){this.opcodes=_$index_45,this.nullData=_$src_55.script.nullData,this.multisig={input:{encode:t=>{const e=[];return t.forEach(t=>{e.push(t)}),_$src_55.script.multisig.input.encode(e)},decode:_$src_55.script.multisig.input.decode,check:_$src_55.script.multisig.input.check},output:{encode:(t,e)=>{const r=[];return e.forEach(t=>{r.push(t)}),_$src_55.script.multisig.output.encode(t,r)},decode:_$src_55.script.multisig.output.decode,check:_$src_55.script.multisig.output.check}},this.pubKey=_$src_55.script.pubKey,this.pubKeyHash=_$src_55.script.pubKeyHash,this.scriptHash=_$src_55.script.scriptHash}classifyInput(t){return _$src_55.script.classifyInput(t)}classifyOutput(t){return _$src_55.script.classifyOutput(t)}decode(t){return _$src_55.script.decompile(t)}encode(t){const e=[];return t.forEach(t=>{e.push(t)}),_$src_55.script.compile(e)}encode2(t){const e=[];return t.forEach(t=>{e.push(t)}),_$src_55.script.compile2(e)}toASM(t){return _$src_55.script.toASM(t)}fromASM(t){return _$src_55.script.fromASM(t)}},_$price_29=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.axios=_$axios_120}async getUsd(){try{return(await this.axios.get(this.restURL+"price/usd",this.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}async rates(){try{return(await this.axios.get(this.restURL+"price/rates",this.axiosOptions)).data}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getBchaUsd(){try{return 1e6*(await this.axios.get(this.restURL+"price/bchausd",this.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getXecUsd(){try{return(await this.axios.get(this.restURL+"price/bchausd",this.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getBchUsd(){try{return(await this.axios.get(this.restURL+"price/bchusd",this.axiosOptions)).data.usd}catch(err){throw err.response&&err.response.data?err.response.data:err}}async getPsffppPrice(){try{return(await this.axios.get(this.restURL+"price/psffpp",this.axiosOptions)).data.writePrice}catch(err){throw err.response&&err.response.data?err.response.data:err}}},_$randomBytes_414={};(function(t){(function(){"use strict";var r=_$cryptoBrowserify_266({}),i=r.randomBytes===r.pseudoRandomBytes?1:3;function n(t,e,i){r.randomBytes(t,(function(r,o){return r?--e?void setTimeout(n.bind(null,t,e,i),10):i(r):i(null,o)}))}(_$randomBytes_414=function(e,r){if(void 0!==r&&"function"!=typeof r)throw new TypeError("argument callback must be a function");if(!r&&!t.Promise)throw new TypeError("argument callback is required");return r?n(e,i,r):new Promise((function(t,r){n(e,i,(function(e,i){if(e)return r(e);t(i)}))}))}).sync=function(t){for(var n=null,o=0;o0)throw new Error(t+" must be an integer in the range 1..n-1")}var _$check_195={checkSessionParams:function(t,e,r,i,n){checkSignParams(e,r),checkBuffer("sessionId",t,32),checkBuffer("pubKeyCombined",i,33),checkBuffer("ell",n,32)},checkSignParams:checkSignParams,checkVerifyParams:function(t,e,r){checkBuffer("pubKey",t,33),checkBuffer("message",e,32),checkBuffer("signature",r,64)},checkBatchVerifyParams:function(t,e,r){if(checkPubKeyArr(t),function(t){checkArray("messages",t);for(let e=0;e=0)throw new Error("r is larger than or equal to field size");if(e.compareTo(n)>=0)throw new Error("s is larger than or equal to curve order")},checkPointExists:function(t,e){if(e.curve.isInfinity(e))throw new Error("point is at infinity");if(t!==e.affineY.isEven())throw new Error("point does not exist")},checkPubKeyArr:checkPubKeyArr,checkPubKeysUnique:function(t){const e=t.map(t=>t.toString("hex"));if(t.length!==e.filter((t,e,r)=>r.indexOf(t)===e).length)throw new Error("pubKeys must be an array with unique elements")},checkArray:checkArray,checkNonceArr:function(t){checkArray("nonces",t);for(let e=0;e>6,a[u++]=128|63&o):o<55296||o>=57344?(a[u++]=224|o>>12,a[u++]=128|o>>6&63,a[u++]=128|63&o):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++i)),a[u++]=240|o>>18,a[u++]=128|o>>12&63,a[u++]=128|o>>6&63,a[u++]=128|63&o);t=a}else{if("object"!==n)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR)}t.length>64&&(t=new Sha256(e,!0).update(t).array());var h=[],f=[];for(i=0;i<64;++i){var c=t[i]||0;h[i]=92^c,f[i]=54^c}Sha256.call(this,e,r),this.update(f),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}Sha256.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(ERROR);if(null===t)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw new Error(ERROR);e=!0}for(var i,n,o=0,a=t.length,s=this.blocks;o>2]|=t[o]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(s[n>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=64?(this.block=s[16],this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[3&e],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t,e,r,i,n,o,a,s,u,h=this.h0,f=this.h1,c=this.h2,l=this.h3,d=this.h4,p=this.h5,_=this.h6,m=this.h7,g=this.blocks;for(t=16;t<64;++t)e=((n=g[t-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,r=((n=g[t-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,g[t]=g[t-16]+e+g[t-7]+r<<0;for(u=f&c,t=0;t<64;t+=4)this.first?(this.is224?(o=300032,m=(n=g[0]-1413257819)-150054599<<0,l=n+24177077<<0):(o=704751109,m=(n=g[0]-210244248)-1521486534<<0,l=n+143694565<<0),this.first=!1):(e=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),i=(o=h&f)^h&c^u,m=l+(n=m+(r=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&p^~d&_)+K[t]+g[t])<<0,l=n+(e+i)<<0),e=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),i=(a=l&h)^l&f^o,_=c+(n=_+(r=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&d^~m&p)+K[t+1]+g[t+1])<<0,e=((c=n+(e+i)<<0)>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),i=(s=c&l)^c&h^a,p=f+(n=p+(r=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&m^~_&d)+K[t+2]+g[t+2])<<0,e=((f=n+(e+i)<<0)>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),i=(u=f&c)^f&l^s,d=h+(n=d+(r=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&_^~p&m)+K[t+3]+g[t+3])<<0,h=n+(e+i)<<0;this.h0=this.h0+h<<0,this.h1=this.h1+f<<0,this.h2=this.h2+c<<0,this.h3=this.h3+l<<0,this.h4=this.h4+d<<0,this.h5=this.h5+p<<0,this.h6=this.h6+_<<0,this.h7=this.h7+m<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,o=this.h5,a=this.h6,s=this.h7,u=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a];return this.is224||(u+=HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]),u},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,o=this.h5,a=this.h6,s=this.h7,u=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a];return this.is224||u.push(s>>24&255,s>>16&255,s>>8&255,255&s),u},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?_$sha256_378.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define((function(){return exports})))}()}).call(this)}).call(this,_$browser_401,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$sha256_378=_$sha256_378.exports;const __Buffer_196=_$safeBuffer_431.Buffer,__curve_196=_$lib_320.getCurveByName("secp256k1");function bufferToInt(t){return _$lib_192.fromBuffer(t)}var _$convert_196={bufferToInt:bufferToInt,intToBuffer:function(t){return t.toBuffer(32)},hash:function(t){return __Buffer_196.from(_$sha256_378.create().update(t).array())},pointToBuffer:function(t){return t.getEncoded(!0)},pubKeyToPoint:function(t){const e=t[0]-2==0,r=bufferToInt(t.slice(1,33)),i=__curve_196.pointFromX(!e,r);return _$check_195.checkPointExists(e,i),i}};const __Buffer_198=_$safeBuffer_431.Buffer,__curve_198=_$lib_320.getCurveByName("secp256k1"),__concat_198=__Buffer_198.concat,__G_198=__curve_198.G,__p_198=__curve_198.p,__n_198=__curve_198.n,__one_198=_$lib_192.ONE,__two_198=_$lib_192.valueOf(2);function jacobi(t){return t.modPow(__p_198.subtract(__one_198).divide(__two_198),__p_198).intValue()}var _$math_198={deterministicGetK0:function(t,e){_$check_195.checkSignParams(t,e);const r=_$convert_196.hash(__concat_198([_$convert_196.intToBuffer(t),e])),i=_$convert_196.bufferToInt(r).mod(__n_198);if(0===i.signum())throw new Error("k0 is zero");return i},jacobi:jacobi,getK:function(t,e){return 1===jacobi(t.affineY)?e:__n_198.subtract(e)},getE:function(t,e,r){return _$convert_196.bufferToInt(_$convert_196.hash(__concat_198([t,_$convert_196.pointToBuffer(e),r]))).mod(__n_198)},getR:function(t,e,r){const i=__G_198.multiply(t),n=r.multiply(e);return i.add(n.negate())},randomA:function(){let t=null;for(;;){t=_$convert_196.bufferToInt(__Buffer_198.from(_$randomBytes_414.sync(32)));try{return _$check_195.checkRange("a",t),t}catch(e){}}}};const __Buffer_200=_$safeBuffer_431.Buffer,__curve_200=_$lib_320.getCurveByName("secp256k1"),__concat_200=__Buffer_200.concat,__G_200=__curve_200.G,__p_200=__curve_200.p,__n_200=__curve_200.n,zero=_$lib_192.ZERO,__one_200=_$lib_192.ONE,__two_200=_$lib_192.valueOf(2),three=_$lib_192.valueOf(3),four=_$lib_192.valueOf(4),seven=_$lib_192.valueOf(7);var _$schnorr_200={sign:function(t,e){const r=_$math_198.deterministicGetK0(t,e),i=__G_200.multiply(r),n=_$math_198.getK(i,r),o=__G_200.multiply(t),a=_$convert_196.intToBuffer(i.affineX),s=_$math_198.getE(a,o,e);return __concat_200([a,_$convert_196.intToBuffer(n.add(s.multiply(t)).mod(__n_200))])},verify:function(t,e,r){_$check_195.checkVerifyParams(t,e,r);const i=_$convert_196.pubKeyToPoint(t),n=_$convert_196.bufferToInt(r.slice(0,32)),o=_$convert_196.bufferToInt(r.slice(32,64));_$check_195.checkSignatureInput(n,o);const a=_$math_198.getE(_$convert_196.intToBuffer(n),i,e),s=_$math_198.getR(o,a,i);if(s.curve.isInfinity(s)||1!==_$math_198.jacobi(s.affineY)||!s.affineX.equals(n))throw new Error("signature verification failed")},batchVerify:function(t,e,r){_$check_195.checkBatchVerifyParams(t,e,r);let i=zero,n=null;for(let o=0;o0||t===e?e:e-1}function c(t){for(var e,r,i=1,n=t.length,o=t[0]+"";ih^r?1:-1;for(s=(u=n.length)<(h=o.length)?u:h,a=0;ao[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function d(t,e,r,i){if(tr||t!==n(t))throw Error(o+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function p(t){var e=t.c.length-1;return f(t.e/14)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function m(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eR?p.c=p.e=null:t.e=10;h/=10,u++);return void(u>R?p.c=p.e=null:(p.e=u,p.c=[t]))}l=String(t)}else{if(!r.test(l=String(t)))return b(p,l,f);p.s=45==l.charCodeAt(0)?(l=l.slice(1),-1):1}(u=l.indexOf("."))>-1&&(l=l.replace(".","")),(h=l.search(/e/i))>0?(u<0&&(u=h),u+=+l.slice(h+1),l=l.substring(0,h)):u<0&&(u=l.length)}else{if(d(e,2,D.length,"Base"),10==e)return q(p=new U(t),k+p.e+1,T);if(l=String(t),f="number"==typeof t){if(0*t!=0)return b(p,l,f,e);if(p.s=1/t<0?(l=l.slice(1),-1):1,U.DEBUG&&l.replace(/^0\.0*|\./,"").length>15)throw Error(a+t)}else p.s=45===l.charCodeAt(0)?(l=l.slice(1),-1):1;for(i=D.slice(0,e),u=h=0,c=l.length;hu){u=c;continue}}else if(!s&&(l==l.toUpperCase()&&(l=l.toLowerCase())||l==l.toLowerCase()&&(l=l.toUpperCase()))){s=!0,h=-1,u=0;continue}return b(p,String(t),f,e)}f=!1,(u=(l=y(l,e,10,p.s)).indexOf("."))>-1?l=l.replace(".",""):u=l.length}for(h=0;48===l.charCodeAt(h);h++);for(c=l.length;48===l.charCodeAt(--c););if(l=l.slice(h,++c)){if(c-=h,f&&U.DEBUG&&c>15&&(t>9007199254740991||t!==n(t)))throw Error(a+p.s*t);if((u=u-h-1)>R)p.c=p.e=null;else if(u=I)?_(u,a):m(u,a,"0");else if(o=(t=q(new U(t),e,r)).e,s=(u=c(t.c)).length,1==i||2==i&&(e<=o||o<=x)){for(;ss){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=o-s)>0)for(o+1==s&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function H(t,e){for(var r,i=1,n=new U(t[0]);i=10;n/=10,i++);return(r=i+14*r-1)>R?t.c=t.e=null:r=10;c/=10,a++);if((h=e-a)<0)h+=14,f=e,p=(l=_[d=0])/m[a-f-1]%10|0;else if((d=i((h+1)/14))>=_.length){if(!o)break t;for(;_.length<=d;_.push(0));l=p=0,a=1,f=(h%=14)-14+1}else{for(l=c=_[d],a=1;c>=10;c/=10,a++);p=(f=(h%=14)-14+a)<0?0:l/m[a-f-1]%10|0}if(o=o||e<0||null!=_[d+1]||(f<0?l:l%m[a-f-1]),o=r<4?(p||o)&&(0==r||r==(t.s<0?3:2)):p>5||5==p&&(4==r||o||6==r&&(h>0?f>0?l/m[a-f]:0:_[d-1])%10&1||r==(t.s<0?8:7)),e<1||!_[0])return _.length=0,o?(e-=t.e+1,_[0]=m[(14-e%14)%14],t.e=-e||0):_[0]=t.e=0,t;if(0==h?(_.length=d,c=1,d--):(_.length=d+1,c=m[14-h],_[d]=f>0?n(l/m[a-f]%m[f])*c:0),o)for(;;){if(0==d){for(h=1,f=_[0];f>=10;f/=10,h++);for(f=_[0]+=c,c=1;f>=10;f/=10,c++);h!=c&&(t.e++,_[0]==s&&(_[0]=1));break}if(_[d]+=c,_[d]!=s)break;_[d--]=0,c=1}for(h=_.length;0===_[--h];_.pop());}t.e>R?t.c=t.e=null:t.e=I?_(e,r):m(e,r,"0"),t.s<0?"-"+e:e)}return U.clone=t,U.ROUND_UP=0,U.ROUND_DOWN=1,U.ROUND_CEIL=2,U.ROUND_FLOOR=3,U.ROUND_HALF_UP=4,U.ROUND_HALF_DOWN=5,U.ROUND_HALF_EVEN=6,U.ROUND_HALF_CEIL=7,U.ROUND_HALF_FLOOR=8,U.EUCLID=9,U.config=U.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(o+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(d(r=t[e],0,h,e),k=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(d(r=t[e],0,8,e),T=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(d(r[0],-h,0,e),d(r[1],0,h,e),x=r[0],I=r[1]):(d(r,-h,h,e),x=-(I=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)d(r[0],-h,-1,e),d(r[1],1,h,e),P=r[0],R=r[1];else{if(d(r,-h,h,e),!r)throw Error(o+e+" cannot be zero: "+r);P=-(R=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(o+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!r,Error(o+"crypto unavailable");C=r}else C=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(d(r=t[e],0,9,e),O=r),t.hasOwnProperty(e="POW_PRECISION")&&(d(r=t[e],0,h,e),N=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(o+e+" not an object: "+r);L=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(o+e+" invalid: "+r);D=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:T,EXPONENTIAL_AT:[x,I],RANGE:[P,R],CRYPTO:C,MODULO_MODE:O,POW_PRECISION:N,FORMAT:L,ALPHABET:D}},U.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!U.DEBUG)return!0;var e,r,i=t.c,a=t.e,u=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===u||-1===u)&&a>=-h&&a<=h&&a===n(a)){if(0===i[0]){if(0===a&&1===i.length)return!0;break t}if((e=(a+1)%14)<1&&(e+=14),String(i[0]).length==e){for(e=0;e=s||r!==n(r))break t;if(0!==r)return!0}}}else if(null===i&&null===a&&(null===u||1===u||-1===u))return!0;throw Error(o+"Invalid BigNumber: "+t)},U.maximum=U.max=function(){return H(arguments,A.lt)},U.minimum=U.min=function(){return H(arguments,A.gt)},U.random=(v=9007199254740992*Math.random()&2097151?function(){return n(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,a,s,f,c=0,l=[],p=new U(B);if(null==t?t=k:d(t,0,h),s=i(t/14),C)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(s*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(f%1e14),c+=2);c=s/2}else{if(!crypto.randomBytes)throw C=!1,Error(o+"crypto unavailable");for(e=crypto.randomBytes(s*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(f%1e14),c+=7);c=s/7}if(!C)for(;c=10;f/=10,c++);c<14&&(a-=14-c)}return p.e=a,p.c=l,p}),U.sum=function(){for(var t=1,e=arguments,r=new U(e[0]);tr-1&&(null==a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}return function(e,r,i,n,o){var a,s,u,h,f,l,d,p,_=e.indexOf("."),y=k,b=T;for(_>=0&&(h=N,N=0,e=e.replace(".",""),l=(p=new U(r)).pow(e.length-_),N=h,p.c=t(m(c(l.c),l.e,"0"),10,i,"0123456789"),p.e=p.c.length),u=h=(d=t(e,r,i,o?(a=D,"0123456789"):(a="0123456789",D))).length;0==d[--h];d.pop());if(!d[0])return a.charAt(0);if(_<0?--u:(l.c=d,l.e=u,l.s=n,d=(l=g(l,p,y,b,i)).c,f=l.r,u=l.e),_=d[s=u+y+1],h=i/2,f=f||s<0||null!=d[s+1],f=b<4?(null!=_||f)&&(0==b||b==(l.s<0?3:2)):_>h||_==h&&(4==b||f||6==b&&1&d[s-1]||b==(l.s<0?8:7)),s<1||!d[0])e=f?m(a.charAt(1),-y,a.charAt(0)):a.charAt(0);else{if(d.length=s,f)for(--i;++d[--s]>i;)d[s]=0,s||(++u,d=[1].concat(d));for(h=d.length;!d[--h];);for(_=0,e="";_<=h;e+=a.charAt(d[_++]));e=m(e,u,a.charAt(0))}return e}}(),g=function(){function t(t,e,r){var i,n,o,a,s=0,u=t.length,h=e%1e7,f=e/1e7|0;for(t=t.slice();u--;)s=((n=h*(o=t[u]%1e7)+(i=f*o+(a=t[u]/1e7|0)*h)%1e7*1e7+s)/r|0)+(i/1e7|0)+f*a,t[u]=n%r;return s&&(t=[s].concat(t)),t}function e(t,e,r,i){var n,o;if(r!=i)o=r>i?1:-1;else for(n=o=0;ne[n]?1:-1;break}return o}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,o,a,u,h){var c,l,d,p,_,m,g,y,b,v,w,M,$,E,S,A,B,k=i.s==o.s?1:-1,T=i.c,x=o.c;if(!(T&&T[0]&&x&&x[0]))return new U(i.s&&o.s&&(T?!x||T[0]!=x[0]:x)?T&&0==T[0]||!x?0*k:k/0:NaN);for(b=(y=new U(k)).c=[],k=a+(l=i.e-o.e)+1,h||(h=s,l=f(i.e/14)-f(o.e/14),k=k/14|0),d=0;x[d]==(T[d]||0);d++);if(x[d]>(T[d]||0)&&l--,k<0)b.push(1),p=!0;else{for(E=T.length,A=x.length,d=0,k+=2,(_=n(h/(x[0]+1)))>1&&(x=t(x,_,h),T=t(T,_,h),A=x.length,E=T.length),$=A,w=(v=T.slice(0,A)).length;w=h/2&&S++;do{if(_=0,(c=e(x,v,A,w))<0){if(M=v[0],A!=w&&(M=M*h+(v[1]||0)),(_=n(M/S))>1)for(_>=h&&(_=h-1),g=(m=t(x,_,h)).length,w=v.length;1==e(m,v,g,w);)_--,r(m,A=10;k/=10,d++);q(y,a+(y.e=d+14*l-1)+1,u,p)}else y.e=l,y.r=+p;return y}}(),w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,$=/^\.([^.]+)$/,E=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g,b=function(t,e,r,i){var n,a=r?e:e.replace(S,"");if(E.test(a))t.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(w,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,a=a.replace(M,"$1").replace($,"0.$1")),e!=a))return new U(a,n);if(U.DEBUG)throw Error(o+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},A.absoluteValue=A.abs=function(){var t=new U(this);return t.s<0&&(t.s=1),t},A.comparedTo=function(t,e){return l(this,new U(t,e))},A.decimalPlaces=A.dp=function(t,e){var r,i,n,o=this;if(null!=t)return d(t,0,h),null==e?e=T:d(e,0,8),q(new U(o),t+o.e+1,e);if(!(r=o.c))return null;if(i=14*((n=r.length-1)-f(this.e/14)),n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},A.dividedBy=A.div=function(t,e){return g(this,new U(t,e),k,T)},A.dividedToIntegerBy=A.idiv=function(t,e){return g(this,new U(t,e),0,1)},A.exponentiatedBy=A.pow=function(t,e){var r,a,s,u,h,f,c,l,d=this;if((t=new U(t)).c&&!t.isInteger())throw Error(o+"Exponent not an integer: "+K(t));if(null!=e&&(e=new U(e)),h=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return l=new U(Math.pow(+K(d),h?2-p(t):+K(t))),e?l.mod(e):l;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new U(NaN);(a=!f&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||h&&d.c[1]>=24e7:d.c[0]<8e13||h&&d.c[0]<=9999975e7)))return u=d.s<0&&p(t)?-0:0,d.e>-1&&(u=1/u),new U(f?1/u:u);N&&(u=i(N/14+2))}for(h?(r=new U(.5),f&&(t.s=1),c=p(t)):c=(s=Math.abs(+K(t)))%2,l=new U(B);;){if(c){if(!(l=l.times(d)).c)break;u?l.c.length>u&&(l.c.length=u):a&&(l=l.mod(e))}if(s){if(0===(s=n(s/2)))break;c=s%2}else if(q(t=t.times(r),t.e+1,1),t.e>14)c=p(t);else{if(0==(s=+K(t)))break;c=s%2}d=d.times(d),u?d.c&&d.c.length>u&&(d.c.length=u):a&&(d=d.mod(e))}return a?l:(f&&(l=B.div(l)),e?l.mod(e):u?q(l,N,T,void 0):l)},A.integerValue=function(t){var e=new U(this);return null==t?t=T:d(t,0,8),q(e,e.e+1,t)},A.isEqualTo=A.eq=function(t,e){return 0===l(this,new U(t,e))},A.isFinite=function(){return!!this.c},A.isGreaterThan=A.gt=function(t,e){return l(this,new U(t,e))>0},A.isGreaterThanOrEqualTo=A.gte=function(t,e){return 1===(e=l(this,new U(t,e)))||0===e},A.isInteger=function(){return!!this.c&&f(this.e/14)>this.c.length-2},A.isLessThan=A.lt=function(t,e){return l(this,new U(t,e))<0},A.isLessThanOrEqualTo=A.lte=function(t,e){return-1===(e=l(this,new U(t,e)))||0===e},A.isNaN=function(){return!this.s},A.isNegative=function(){return this.s<0},A.isPositive=function(){return this.s>0},A.isZero=function(){return!!this.c&&0==this.c[0]},A.minus=function(t,e){var r,i,n,o,a=this,u=a.s;if(e=(t=new U(t,e)).s,!u||!e)return new U(NaN);if(u!=e)return t.s=-e,a.plus(t);var h=a.e/14,c=t.e/14,l=a.c,d=t.c;if(!h||!c){if(!l||!d)return l?(t.s=-e,t):new U(d?a:NaN);if(!l[0]||!d[0])return d[0]?(t.s=-e,t):new U(l[0]?a:3==T?-0:0)}if(h=f(h),c=f(c),l=l.slice(),u=h-c){for((o=u<0)?(u=-u,n=l):(c=h,n=d),n.reverse(),e=u;e--;n.push(0));n.reverse()}else for(i=(o=(u=l.length)<(e=d.length))?u:e,u=e=0;e0)for(;e--;l[r++]=0);for(e=s-1;i>u;){if(l[--i]=0;){for(r=0,p=v[n]%1e7,_=v[n]/1e7|0,o=n+(a=h);o>n;)r=((c=p*(c=b[--a]%1e7)+(u=_*c+(l=b[a]/1e7|0)*p)%1e7*1e7+m[o]+r)/g|0)+(u/1e7|0)+_*l,m[o--]=c%g;m[o]=r}return r?++i:m.splice(0,1),z(t,m,i)},A.negated=function(){var t=new U(this);return t.s=-t.s||null,t},A.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new U(t,e)).s,!n||!e)return new U(NaN);if(n!=e)return t.s=-e,i.minus(t);var o=i.e/14,a=t.e/14,u=i.c,h=t.c;if(!o||!a){if(!u||!h)return new U(n/0);if(!u[0]||!h[0])return h[0]?t:new U(u[0]?i:0*n)}if(o=f(o),a=f(a),u=u.slice(),n=o-a){for(n>0?(a=o,r=h):(n=-n,r=u),r.reverse();n--;r.push(0));r.reverse()}for((n=u.length)-(e=h.length)<0&&(r=h,h=u,u=r,e=n),n=0;e;)n=(u[--e]=u[e]+h[e]+n)/s|0,u[e]=s===u[e]?0:u[e]%s;return n&&(u=[n].concat(u),++a),z(t,u,a)},A.precision=A.sd=function(t,e){var r,i,n,o=this;if(null!=t&&t!==!!t)return d(t,1,h),null==e?e=T:d(e,0,8),q(new U(o),t,e);if(!(r=o.c))return null;if(i=14*(n=r.length-1)+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&o.e+1>i&&(i=o.e+1),i},A.shiftedBy=function(t){return d(t,-9007199254740991,9007199254740991),this.times("1e"+t)},A.squareRoot=A.sqrt=function(){var t,e,r,i,n,o=this,a=o.c,s=o.s,u=o.e,h=k+4,l=new U("0.5");if(1!==s||!a||!a[0])return new U(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(s=Math.sqrt(+K(o)))||s==1/0?(((e=c(a)).length+u)%2==0&&(e+="0"),s=Math.sqrt(+e),u=f((u+1)/2)-(u<0||u%2),r=new U(e=s==1/0?"1e"+u:(e=s.toExponential()).slice(0,e.indexOf("e")+1)+u)):r=new U(s+""),r.c[0])for((s=(u=r.e)+h)<3&&(s=0);;)if(n=r,r=l.times(n.plus(g(o,n,h,1))),c(n.c).slice(0,s)===(e=c(r.c)).slice(0,s)){if(r.e0&&_>0){for(a=_%u||u,c=p.substr(0,a);a<_;a+=u)c+=f+p.substr(a,u);h>0&&(c+=f+p.slice(a)),d&&(c="-"+c)}i=l?c+(r.decimalSeparator||"")+((h=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+h+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):c}return(r.prefix||"")+i+(r.suffix||"")},A.toFraction=function(t){var e,r,i,n,a,s,h,f,l,d,p,_,m=this,y=m.c;if(null!=t&&(!(h=new U(t)).isInteger()&&(h.c||1!==h.s)||h.lt(B)))throw Error(o+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+K(h));if(!y)return new U(m);for(e=new U(B),l=r=new U(B),i=f=new U(B),_=c(y),a=e.e=_.length-m.e-1,e.c[0]=u[(s=a%14)<0?14+s:s],t=!t||h.comparedTo(e)>0?a>0?e:l:h,s=R,R=1/0,h=new U(_),f.c[0]=0;d=g(h,e,0,1),1!=(n=r.plus(d.times(i))).comparedTo(t);)r=i,i=n,l=f.plus(d.times(n=l)),f=n,e=h.minus(d.times(n=e)),h=n;return n=g(t.minus(r),i,0,1),f=f.plus(n.times(l)),r=r.plus(n.times(i)),f.s=l.s=m.s,p=g(l,i,a*=2,T).minus(m).abs().comparedTo(g(f,r,a,T).minus(m).abs())<1?[l,i]:[f,r],R=s,p},A.toNumber=function(){return+K(this)},A.toPrecision=function(t,e){return null!=t&&d(t,1,h),j(this,t,e,2)},A.toString=function(t){var e,r=this,i=r.s,n=r.e;return null===n?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=n<=x||n>=I?_(c(r.c),n):m(c(r.c),n,"0"):10===t?e=m(c((r=q(new U(r),k+n+1,T)).c),r.e,"0"):(d(t,2,D.length,"Base"),e=y(m(c(r.c),n,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},A.valueOf=A.toJSON=function(){return K(this)},A._isBigNumber=!0,null!=e&&U.set(e),U}()).default=e.BigNumber=e,"function"==typeof define&&define.amd?define((function(){return e})):_$bignumber_194.exports?_$bignumber_194.exports=e:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=e)}(this),_$bignumber_194=_$bignumber_194.exports;var _$util_458={};(function(t){(function(){"use strict";Object.defineProperty(_$util_458,"__esModule",{value:!0}),_$util_458.pushdata=e=>{if(0===e.length)return t.from(Uint8Array.from([76,0]));if(e.length<78)return t.concat([Uint8Array.from([e.length]),e]);if(e.length<255)return t.concat([Uint8Array.from([76,e.length]),e]);if(e.length<65535){const r=t.allocUnsafe(2);return r.writeUInt16LE(e.length,0),t.concat([Uint8Array.from([77]),r,e])}if(e.length<4294967295){const r=t.allocUnsafe(4);return r.writeUInt32LE(e.length,0),t.concat([Uint8Array.from([78]),r,e])}throw new Error("does not support bigger pushes yet")},_$util_458.BNToInt64BE=e=>{if(!e.isInteger())throw new Error("bn not an integer");if(!e.isPositive())throw new Error("bn not positive integer");const r=e.toString(16);if(r.length>16)throw new Error("bn outside of range");return t.from(r.padStart(16,"0"),"hex")},_$util_458.createOpReturnGenesis=(e,r,i,n,o,a,s,u)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof o){if(0!==o.length&&64!==o.length)throw new Error("documentHash must be either 0 or 32 hex bytes");if(64===o.length&&!o.match(/^[0-9a-fA-F]{64}$/))throw new Error("documentHash must be hex");o=t.from(o,"hex")}else if(0!==o.length&&32!==o.length)throw new Error("documentHash must be either 0 or 32 hex bytes");if(a<0||a>9)throw new Error("decimals out of range");if(null!==s&&(s<2||s>255))throw new Error("mintBatonVout out of range (0x02 < > 0xFF)");if(65===e){if(!u.isEqualTo(1))throw new Error("quantity must be 1 for NFT1 child genesis");if(0!==a)throw new Error("decimals must be 0 for NFT1 child genesis");if(null!==s)throw new Error("mintBatonVout must be null for NFT1 child genesis")}return t.concat([Uint8Array.from([106]),_$util_458.pushdata(t.from("SLP\0")),_$util_458.pushdata(Uint8Array.from([e])),_$util_458.pushdata(t.from("GENESIS")),_$util_458.pushdata(t.from(r)),_$util_458.pushdata(t.from(i)),_$util_458.pushdata(t.from(n)),_$util_458.pushdata(o),_$util_458.pushdata(Uint8Array.from([a])),_$util_458.pushdata(Uint8Array.from(null===s?[]:[s])),_$util_458.pushdata(_$util_458.BNToInt64BE(u))])},_$util_458.createOpReturnMint=(e,r,i,n)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof r){if(!r.match(/^[0-9a-fA-F]{64}$/))throw new Error("tokenIdHex does not pass regex");if(64!==r.length)throw new Error("tokenIdHex must be 32 bytes");r=t.from(r,"hex")}else if(32!==r.length)throw new Error("tokenIdHex must be 32 bytes");if(null!==i&&(i<2||i>255))throw new Error("mintBatonVout out of range (0x02 < > 0xFF)");return t.concat([Uint8Array.from([106]),_$util_458.pushdata(t.from("SLP\0")),_$util_458.pushdata(Uint8Array.from([e])),_$util_458.pushdata(t.from("MINT")),_$util_458.pushdata(r),_$util_458.pushdata(Uint8Array.from(null===i?[]:[i])),_$util_458.pushdata(_$util_458.BNToInt64BE(n))])},_$util_458.createOpReturnSend=(e,r,i)=>{if(![1,65,129].includes(e))throw new Error("unknown versionType");if("string"==typeof r){if(!r.match(/^[0-9a-fA-F]{64}$/))throw new Error("tokenIdHex does not pass regex");if(64!==r.length)throw new Error("tokenIdHex must be 32 bytes");r=t.from(r,"hex")}else if(32!==r.length)throw new Error("tokenIdHex must be 32 bytes");if(i.length<1)throw new Error("send requires at least one amount");if(i.length>19)throw new Error("too many slp amounts");return t.concat([Uint8Array.from([106]),_$util_458.pushdata(t.from("SLP\0")),_$util_458.pushdata(Uint8Array.from([e])),_$util_458.pushdata(t.from("SEND")),_$util_458.pushdata(r),...i.map(t=>_$util_458.pushdata(_$util_458.BNToInt64BE(t)))])}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$tokentype1_457={};Object.defineProperty(_$tokentype1_457,"__esModule",{value:!0}),_$tokentype1_457.default={genesis:(t,e,r,i,n,o,a)=>_$util_458.createOpReturnGenesis(1,t,e,r,i,n,o,a),mint:(t,e,r)=>_$util_458.createOpReturnMint(1,t,e,r),send:(t,e)=>_$util_458.createOpReturnSend(1,t,e)};var _$nft1_456={},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$nft1_456,"__esModule",{value:!0});const bignumber_js_1=__importDefault(_$bignumber_194);_$nft1_456.default={Group:{genesis:(t,e,r,i,n,o,a)=>_$util_458.createOpReturnGenesis(129,t,e,r,i,n,o,a),mint:(t,e,r)=>_$util_458.createOpReturnMint(129,t,e,r),send:(t,e)=>_$util_458.createOpReturnSend(129,t,e)},Child:{genesis:(t,e,r,i)=>_$util_458.createOpReturnGenesis(65,t,e,r,i,0,null,new bignumber_js_1.default(1)),send:(t,e)=>_$util_458.createOpReturnSend(65,t,e)}};var _$dist_455={},____importDefault_455=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$dist_455,"__esModule",{value:!0});const __bignumber_js_1_455=____importDefault_455(_$bignumber_194);_$dist_455.BN=__bignumber_js_1_455.default;const tokentype1_1=____importDefault_455(_$tokentype1_457);_$dist_455.TokenType1=tokentype1_1.default;const nft1_1=____importDefault_455(_$nft1_456);let addy,_this;_$dist_455.NFT1=nft1_1.default;var _$tokentype1_38=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},addy=new _$address_34(t),this.Script=new _$script_33,this.axios=_$axios_120,_$TransactionBuilder_40.setAddress(addy),_this=this}generateSendOpReturn(t,e){try{const r=t[0].tokenId,i=t[0].decimals,n=new _$bignumber_194(e).times(10**i),o=t.reduce((t,e)=>t.plus(new _$bignumber_194(e.tokenQty).times(10**i)),new _$bignumber_194(0)),a=o.minus(n);let s,u=1;if(a>0){u=2;const t=n.toString(),e=a.toString(),i=new _$bignumber_194(e).plus(new _$bignumber_194(t)),h=new _$bignumber_194(o);if("0"!==i.minus(h).toString())throw new Error("Token transaction inputs do not match outputs, cannot send transaction");s=_$dist_455.TokenType1.send(r,[new _$dist_455.BN(t),new _$dist_455.BN(e)])}else{const t=n.toString(),e=new _$bignumber_194(t),i=new _$bignumber_194(o);if("0"!==e.minus(i).toString())throw new Error("Token transaction inputs do not match outputs, cannot send transaction");s=_$dist_455.TokenType1.send(r,[new _$dist_455.BN(t)])}return{script:s,outputs:u}}catch(err){throw console.log("Error in generateSendOpReturn()"),err}}generateBurnOpReturn(t,e){try{const r=t[0].tokenId,i=t[0].decimals;let n=0;for(let e=0;en&&(e=n);let o=new _$bignumber_194(n-e).times(10**i);return o=o.absoluteValue(),o=(o=Math.floor(o)).toString(),_$dist_455.TokenType1.send(r,[new _$dist_455.BN(o)])}catch(err){throw console.log("Error in generateBurnOpReturn()"),err}}generateGenesisOpReturn(t){try{let e;return e=(e=0!==t.decimals?new _$bignumber_194(t.initialQty).times(10**t.decimals):new _$bignumber_194(t.initialQty)).absoluteValue(),e=(e=Math.floor(e)).toString(),t.documentHash||(t.documentHash=""),t.mintBatonVout||(t.mintBatonVout=null),_$dist_455.TokenType1.genesis(t.ticker,t.name,t.documentUrl,t.documentHash,t.decimals,t.mintBatonVout,new _$dist_455.BN(e))}catch(err){throw console.log("Error in generateGenesisOpReturn()"),err}}generateMintOpReturn(t,e,r=!1){try{if(!Array.isArray(t))throw new Error("tokenUtxos must be an array.");if(!e)throw new Error("mintQty must be a positive number.");let i;for(let e=0;e0){a=2;const t=Math.floor(e).toString(),i=Math.floor(n).toString();o=_$dist_455.NFT1.Child.send(r,[new _$dist_455.BN(t),new _$dist_455.BN(i)])}else{const t=Math.floor(e).toString();o=_$dist_455.NFT1.Child.send(r,[new _$dist_455.BN(t)])}return{script:o,outputs:a}}catch(err){throw console.log("Error in generateNFTChildSendOpReturn()"),err}}generateNFTGroupSendOpReturn(t,e){try{const r=t[0].tokenId;let i=0;for(let e=0;e0){a=2;const t=Math.floor(e).toString(),i=Math.floor(n).toString();o=_$dist_455.NFT1.Group.send(r,[new _$dist_455.BN(t),new _$dist_455.BN(i)])}else{const t=Math.floor(e).toString();o=_$dist_455.NFT1.Group.send(r,[new _$dist_455.BN(t)])}return{script:o,outputs:a}}catch(err){throw console.log("Error in generateNFTGroupSendOpReturn()"),err}}},_$dist_459={};(function(t){(function(){"use strict";var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_$dist_459,"__esModule",{value:!0});const r=e(_$bignumber_194);_$dist_459.BN=r.default,_$dist_459.parseSLP=e=>{"string"==typeof e&&(e=t.from(e,"hex"));let i=0,n=e;const o=(t,e)=>{if(t)throw Error(e)},a=()=>{const t=n.readUInt8(i);return i+=1,new r.default(t)},s=()=>{const t=n.readUInt16LE(i);return i+=2,new r.default(t)},u=()=>{const t=n.readUInt32LE(i);return i+=4,new r.default(t)};o(0===n.length,"scriptpubkey cannot be empty"),o(106!==n[i],"scriptpubkey not op_return"),o(n.length<10,"scriptpubkey too small"),++i;const h=()=>{if(i===n.length)return-1;const t=a().toNumber();return t>0&&t<76?i+t>n.length?(--i,-1):t:76===t?i+1>=n.length?(--i,-1):a().toNumber():77===t?i+2>=n.length?(--i,-1):s().toNumber():78===t?i+4>=n.length?(--i,-1):u().toNumber():(--i,-1)},f=()=>{if(1===n.length)return a();if(2===n.length)return s();if(4===n.length)return u();if(8===n.length)return(()=>{const t=n.readUInt32LE(i);i+=4;const e=n.readUInt32LE(i);return i+=4,new r.default(e).multipliedBy(Math.pow(2,32)).plus(t)})();throw new Error("extraction of number from buffer failed")},c=t=>32===t.length,l=[];for(let t=h();t>=0;t=h()){const e=n.slice(i,i+t);if(o(i+t>n.length,"pushdata data extraction failed"),i+=t,l.push(e),1===l.length){const t=l[0];o(4!==t.length,"lokad id wrong size"),o(t[0]!=="S".charCodeAt(0)||t[1]!=="L".charCodeAt(0)||t[2]!=="P".charCodeAt(0)||0!==t[3],"SLP not in first chunk")}}o(i!==n.length,"trailing data"),o(0===l.length,"chunks empty");let d=0;const p=()=>{o(++d===l.length,"parsing ended early"),i=0,n=l[d]};p();const _=n.reverse();o(1!==_.length&&2!==_.length,"token_type string length must be 1 or 2");const m=f().toNumber();o(![1,65,129].includes(m),"token_type not token-type1, nft1-group, or nft1-child"),p();const g=n.toString();if("GENESIS"===g){o(10!==l.length,"wrong number of chunks"),p();const t=n;p();const e=n;p();const r=n;p();const i=n;o(!(0===i.length||32===i.length),"document_hash must be size 0 or 32"),p(),o(1!==n.length,"decimals string length must be 1");const a=f().toNumber();o(a>9,"decimals bigger than 9"),p();const s=n;let u=0;o(s.length>=2,"mint_baton_vout string length must be 0 or 1"),s.length>0&&(u=f().toNumber(),o(u<2,"mint_baton_vout must be at least 2")),p();const h=n.reverse();o(8!==h.length,"initial_qty must be provided as an 8-byte buffer");const c=f();return 65===m&&(o(0!==a,"NFT1 child token must have divisibility set to 0 decimal places"),o(0!==u,"NFT1 child token must not have a minting baton"),o(!c.isEqualTo(1),"NFT1 child token must have quantity of 1")),{tokenType:m,transactionType:g,data:{ticker:t,name:e,documentUri:r,documentHash:i,decimals:a,mintBatonVout:u,qty:c}}}if("MINT"===g){o(65===m,"NFT1 Child cannot have MINT transaction type."),o(6!==l.length,"wrong number of chunks"),p();const t=n;o(!c(t),"tokenId invalid size"),p();const e=n;let r=0;o(e.length>=2,"mint_baton_vout string length must be 0 or 1"),e.length>0&&(r=f().toNumber(),o(r<2,"mint_baton_vout must be at least 2")),p();const i=n.reverse();return o(8!==i.length,"additional_qty must be provided as an 8-byte buffer"),{tokenType:m,transactionType:g,data:{tokenId:t,mintBatonVout:r,qty:f()}}}if("SEND"===g){o(l.length<4,"wrong number of chunks"),p();const t=n;o(!c(t),"tokenId invalid size"),p();const e=[];for(;d!==l.length;){const t=n.reverse();o(8!==t.length,"amount string size not 8 bytes");const r=f();e.push(r),n=l[++d],i=0}return o(0===e.length,"token_amounts size is 0"),o(e.length>19,"token_amounts size is greater than 19"),{tokenType:m,transactionType:g,data:{tokenId:t,amounts:e}}}return o(!0,"unknown action type"),{tokenType:m,transactionType:g,data:{}}}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$utils_39={};(function(t){(function(){let e;_$utils_39=class{constructor(t={}){this.restURL=t.restURL,this.apiToken=t.apiToken,this.slpParser=_$dist_459,this.authToken=t.authToken,this.axios=_$axios_120,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},e=this,this.whitelist=[],this.util=new _$util_42(t)}async decodeOpReturn(r,i=null,n=null){if(i){if(!(i instanceof Object))throw new Error("decodeOpReturn cache parameter must be Object");const t=i[r];if(t)return t}try{if(!r||""===r||"string"!=typeof r)throw new Error("txid string must be included.");const o=this.restURL+"rawtransactions/getRawTransaction",a=(await this.axios.post(o,{verbose:!0,txids:[r],usrObj:n},this.axiosOptions)).data[0].vout[0].scriptPubKey.hex,s=e.slpParser.parseSLP(t.from(a,"hex"));let u={};return"SEND"===s.transactionType?u={tokenType:s.tokenType,txType:s.transactionType,tokenId:s.data.tokenId.toString("hex"),amounts:s.data.amounts}:"GENESIS"===s.transactionType?u={tokenType:s.tokenType,txType:s.transactionType,ticker:s.data.ticker.toString(),name:s.data.name.toString(),tokenId:r,documentUri:s.data.documentUri.toString(),documentHash:s.data.documentHash.toString(),decimals:s.data.decimals,mintBatonVout:s.data.mintBatonVout,qty:s.data.qty}:"MINT"===s.transactionType&&(u={tokenType:s.tokenType,txType:s.transactionType,tokenId:s.data.tokenId.toString("hex"),mintBatonVout:s.data.mintBatonVout,qty:s.data.qty}),i&&(i[r]=u),u}catch(o){throw o}}}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$slp_37=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.Address=new _$address_34(t),this.ECPair=_$ecpair_35,this.TokenType1=new _$tokentype1_38(t),this.NFT1=new _$nft1_36(t),this.Utils=new _$utils_39(t)}};let ___this_24;var _$encryption_24=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.axios=_$axios_120,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_24=this}async getPubKey(t){try{if(!t||"string"!=typeof t)throw new Error("Input must be a valid Bitcoin Cash address.");return(await ___this_24.axios.get(`${this.restURL}encryption/publickey/${t}`,this.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}},_$electrumx_23=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.blockchain=new _$blockchain_17(t)}async utxo(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}electrumx/utxos/${t}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"electrumx/utxos",{addresses:t},this.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async balance(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}electrumx/balance/${t}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"electrumx/balance",{addresses:t},this.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async transactions(t,e=null,r=!1){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}electrumx/transactions/${t}/${r}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"electrumx/transactions",{addresses:t,usrObj:e,allTxs:r},this.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(i){throw i.response&&i.response.data?i.response.data:i}}async unconfirmed(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}electrumx/unconfirmed/${t}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"electrumx/unconfirmed",{addresses:t},this.axiosOptions)).data;throw new Error("Input address must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async blockHeader(t,e=1){try{return(await _$axios_120.get(`${this.restURL}electrumx/block/headers/${t}?count=${e}`,this.axiosOptions)).data}catch(r){throw r.response&&r.response.data?r.response&&r.response.data?new Error(r.response.data.error):r.response.data:r}}async txData(t){try{if("string"==typeof t)return(await _$axios_120.get(`${this.restURL}electrumx/tx/data/${t}`,this.axiosOptions)).data;if(Array.isArray(t))return(await _$axios_120.post(this.restURL+"electrumx/tx/data",{txids:t},this.axiosOptions)).data;throw new Error("Input txId must be a string or array of strings.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async broadcast(t){try{if("string"==typeof t)return(await _$axios_120.post(this.restURL+"electrumx/tx/broadcast",{txHex:t},this.axiosOptions)).data;throw new Error("Input txHex must be a string.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}sortConfTxs(t,e="DESCENDING"){try{return t=t.filter(t=>t.height>0),"DESCENDING"===e?t.sort((t,e)=>e.height-t.height):t.sort((t,e)=>t.height-e.height)}catch(err){throw console.log("Error in util.js/sortConfTxs()"),err}}async sortAllTxs(t,e="DESCENDING"){try{const r=await this.blockchain.getBlockCount()+1,i=t.map(t=>(t.height<=0&&(t.height=r),t));return this.sortConfTxs(i,e)}catch(err){throw console.log("Error in util.js/sort0ConfTxs"),console.log("electrumx.js restURL: ",this.restURL),err}}},_$psfSlpIndexer_30=class{constructor(t={}){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},this.rawTransaction=new _$rawTransactions_31(t),this.slpUtils=new _$utils_39(t)}async status(){try{return(await _$axios_120.get(this.restURL+"psf/slp/status",this.axiosOptions)).data}catch(t){throw t.response&&t.response.data?t.response.data:t}}async balance(t){try{if("string"==typeof t)return(await _$axios_120.post(this.restURL+"psf/slp/address",{address:t},this.axiosOptions)).data;throw new Error("Input address must be a string.")}catch(e){throw e.response&&e.response.data?e.response.data:e}}async tokenStats(t,e=!1){try{if("string"==typeof t)return(await _$axios_120.post(this.restURL+"psf/slp/token",{tokenId:t,withTxHistory:e},this.axiosOptions)).data;throw new Error("Input tokenId must be a string.")}catch(r){throw r.response&&r.response.data?r.response.data:r}}async tx(t){try{if("string"==typeof t)return(await _$axios_120.post(this.restURL+"psf/slp/txid",{txid:t},this.axiosOptions)).data;throw new Error("Input txid must be a string.")}catch(e){if(e.response&&e.response.data&&e.response.data.error&&e.response.data.error.includes("Key not found in database")){const e=await this.checkBlacklist(t),r=await this.rawTransaction.getTxData(t);return r.isValidSlp=!!e&&null,{txData:r}}throw e}}async checkBlacklist(t){try{const e=["dd21be4532d93661e8ffe16db6535af0fb8ee1344d1fef81a193e2b4cfa9fbc9"],r=await this.slpUtils.decodeOpReturn(t);for(let t=0;t!0===t.isSlp&&"token"===t.type&&1===t.tokenType);s=await this.hydrateTokenData(s);const u=r.filter(t=>!1===t.isSlp&&t.value>1e3),h=r.filter(t=>!1===t.isSlp&&t.value<=1e3);let f=r.filter(t=>!0===t.isSlp&&"baton"===t.type&&1===t.tokenType);f=await this.hydrateTokenData(f);let c=r.filter(t=>!0===t.isSlp&&"token"===t.type&&129===t.tokenType);c=await this.hydrateTokenData(c);let l=r.filter(t=>!0===t.isSlp&&"baton"===t.type&&129===t.tokenType);l=await this.hydrateTokenData(l);let d=r.filter(t=>!0===t.isSlp&&"token"===t.type&&65===t.tokenType);return{address:e,bchUtxos:u,infoUtxos:h,slpUtxos:{type1:{tokens:s,mintBatons:f},group:{tokens:c,mintBatons:l},nft:{tokens:d=await this.hydrateTokenData(d)}},nullUtxos:r.filter(t=>null===t.isSlp)}}catch(err){if(console.error("Error in bchjs.Utxo.get(): ",err),err.error)throw new Error(err.error);throw err}}async hydrateTokenData(t){try{let e=t.map(t=>t.tokenId);e=[...new Set(e)];const r=[];for(let t=0;tt.tokenData.tokenId===e.tokenId);if(e.ticker=n[0].tokenData.ticker,e.name=n[0].tokenData.name,e.documentUri=n[0].tokenData.documentUri,e.documentHash=n[0].tokenData.documentHash,e.decimals=n[0].tokenData.decimals,"baton"!==e.type){const t=new _$bignumber_194(e.qty).dividedBy(10**parseInt(e.decimals));e.qtyStr=t.toString(),e.tokenQty=e.qtyStr}}return t}catch(err){throw console.log("Error in hydrateTokenData()"),err}}findBiggestUtxo(t){let e=0,r=0;if(!Array.isArray(t))throw new Error("utxos input to findBiggestUtxo() must be an array");for(let i=0;ie&&(e=n.satoshis,r=i)}return t[r]}async isValid(t){try{const e=t.txid||t.tx_hash,r=t.vout|t.tx_pos,i=await this.blockchain.getTxOut(e,r,!0);let n=null;return n=null!==i}catch(err){throw console.log("Error in Utxo.isValid()"),err}}},_$transaction_41=class{constructor(t={}){this.slpUtils=new _$utils_39(t),this.rawTransaction=new _$rawTransactions_31(t),this.blockchain=new _$blockchain_17(t),this.psfSlpIndexer=new _$psfSlpIndexer_30(t)}async get(t){return await this.psfSlpIndexer.tx(t)}async getTokenInfo(t){try{return await this.slpUtils.decodeOpReturn(t)}catch(err){return!1}}};let ___this_20;var _$dsproof_20=class{constructor(t){this.restURL=t.restURL,this.apiToken=t.apiToken,this.authToken=t.authToken,this.axios=_$axios_120,this.authToken?this.axiosOptions={headers:{authorization:this.authToken}}:this.axiosOptions={headers:{authorization:"Token "+this.apiToken}},___this_20=this}async getDSProof(t){try{if(!t)throw new Error("txid is required");if(64!==t.length)throw new Error(`txid must be of length 64 (not ${t.length})`);return(await ___this_20.axios.get(`${this.restURL}dsproof/getdsproof/${t}`,this.axiosOptions)).data}catch(e){throw e.response&&e.response.data?e.response.data:e}}},_$ecash_21=class{toSatoshi(t){if("number"!=typeof t)throw new Error("input must be a floating number representing XEC");return Math.floor(100*t)}toXec(t){if("number"!=typeof t)throw new Error("input must be a floating number representing satoshis");return t/100}},_$bchJs_15={};(function(t,e){(function(){_$bchJs_15=class{constructor(r){if(r&&r.restURL&&""!==r.restURL?this.restURL=r.restURL:t.env.RESTURL&&""!==t.env.RESTURL?this.restURL=t.env.RESTURL:this.restURL="https://api.fullstack.cash/v5/",this.apiToken="",r&&r.apiToken&&""!==r.apiToken?this.apiToken=r.apiToken:this.apiToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxY2YxZTc2OGFlZjk0MDAxMjUwZTZkYiIsImVtYWlsIjoiY2hyaXMudHJvdXRuZXJAZ21haWwuY29tIiwiYXBpTGV2ZWwiOjYwLCJyYXRlTGltaXQiOjMsInBvaW50c1RvQ29uc3VtZSI6MTYsImR1cmF0aW9uIjozMCwiaWF0IjoxNzM5MTE3NTkyLCJleHAiOjE3NDE3MDk1OTJ9.LJDAZGgziH0dJ9F_zhK_ffB4_TX235vVJ2X28Ng8l7E",this.authPass="",r&&r.authPass&&""!==r.authPass?this.authPass=r.authPass:t.env.BCHJSAUTHPASS&&""!==t.env.BCHJSAUTHPASS&&(this.authPass=t.env.BCHJSAUTHPASS),this.authToken="",this.authPass){const t="fullstackcash:"+this.authPass,r=e.from(t).toString("base64");this.authToken="Basic "+r}const i={restURL:this.restURL,apiToken:this.apiToken,authToken:this.authToken};this.Electrumx=new _$electrumx_23(i),this.Control=new _$control_18(i),this.Mining=new _$mining_27(i),this.RawTransactions=new _$rawTransactions_31(i),this.Address=new _$address_14(i),this.BitcoinCash=new _$bitcoincash_16(this.Address),this.Blockchain=new _$blockchain_17(i),this.Crypto=_$crypto_19,this.ECPair=_$ECPair_22,this.ECPair.setAddress(this.Address),this.encryption=new _$encryption_24(i),this.Generating=new _$generating_25(i),this.HDNode=new _$hdnode_26(this.Address),this.Mnemonic=new _$mnemonic_28(this.Address),this.Price=new _$price_29(i),this.Script=new _$script_33,this.TransactionBuilder=_$TransactionBuilder_40,this.TransactionBuilder.setAddress(this.Address),this.Util=new _$util_42(i),this.Schnorr=new _$schnorr_32(i),this.SLP=new _$slp_37(i),this.SLP.HDNode=this.HDNode,this.Utxo=new _$utxo_43(i),this.Transaction=new _$transaction_41(i),this.DSProof=new _$dsproof_20(i),this.eCash=new _$ecash_21,this.PsfSlpIndexer=new _$psfSlpIndexer_30(i)}}}).call(this)}).call(this,_$browser_401,_$buffer_251({}).Buffer);var _$core_269={};(function(t){(function(){var r;r=function(){var r=r||function(r,i){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==t&&t.crypto&&(n=t.crypto),!n)try{n=_$cryptoBrowserify_266({})}catch(err){}var o=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(err){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(err){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),s={},u=s.lib={},h=u.Base={extend:function(t){var e=a(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},f=u.WordArray=h.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o>>2]>>>24-o%4*8&255;e[i+o>>>2]|=a<<24-(i+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=r.ceil(e/4)},clone:function(){var t=h.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new f.init(r,e/2)}},d=c.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new f.init(r,e)}},p=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(d.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return d.parse(unescape(encodeURIComponent(t)))}},_=u.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e,i=this._data,n=i.words,o=i.sigBytes,a=this.blockSize,s=o/(4*a),u=(s=t?r.ceil(s):r.max((0|s)-this._minBufferSize,0))*a,h=r.min(4*u,o);if(u){for(var c=0;c>>2]|=t[n]<<24-n%4*8;r.call(this,i,e)}else r.apply(this,arguments)}).prototype=e}}(),t.lib.WordArray},"object"==typeof _$libTypedarrays_276?_$libTypedarrays_276=_$libTypedarrays_276=__factory_276(_$core_269):"function"==typeof define&&define.amd?define(["./core"],__factory_276):__factory_276(__root_276.CryptoJS);var _$encUtf16_271={},__root_271,__factory_271;__root_271=this,__factory_271=function(t){return function(){var e=t,r=e.lib.WordArray,i=e.enc;function n(t){return t<<8&4278255360|t>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>1]|=t.charCodeAt(n)<<16-n%2*16;return r.create(i,2*e)}},i.Utf16LE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],o=0;o>>2]>>>16-o%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(t){for(var e=t.length,i=[],o=0;o>>1]|=n(t.charCodeAt(o)<<16-o%2*16);return r.create(i,2*e)}}}(),t.enc.Utf16},"object"==typeof _$encUtf16_271?_$encUtf16_271=_$encUtf16_271=__factory_271(_$core_269):"function"==typeof define&&define.amd?define(["./core"],__factory_271):__factory_271(__root_271.CryptoJS);var _$encBase64_270={},__root_270,__factory_270;__root_270=this,__factory_270=function(t){return r=(e=t).lib.WordArray,e.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,i=this._map;t.clamp();for(var n=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var u=i.charAt(64);if(u)for(;n.length%4;)n.push(u);return n.join("")},parse:function(t){var e=t.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o>>6-a%4*2;n[o>>>2]|=s<<24-o%4*8,o++}return r.create(n,o)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},t.enc.Base64;var e,r},"object"==typeof _$encBase64_270?_$encBase64_270=_$encBase64_270=__factory_270(_$core_269):"function"==typeof define&&define.amd?define(["./core"],__factory_270):__factory_270(__root_270.CryptoJS);var _$md5_277={},__root_277,__factory_277;__root_277=this,__factory_277=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var i=e+r,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,a=t[e+0],u=t[e+1],d=t[e+2],p=t[e+3],_=t[e+4],m=t[e+5],g=t[e+6],y=t[e+7],b=t[e+8],v=t[e+9],w=t[e+10],M=t[e+11],$=t[e+12],E=t[e+13],S=t[e+14],A=t[e+15],B=o[0],k=o[1],T=o[2],x=o[3];B=h(B,k,T,x,a,7,s[0]),x=h(x,B,k,T,u,12,s[1]),T=h(T,x,B,k,d,17,s[2]),k=h(k,T,x,B,p,22,s[3]),B=h(B,k,T,x,_,7,s[4]),x=h(x,B,k,T,m,12,s[5]),T=h(T,x,B,k,g,17,s[6]),k=h(k,T,x,B,y,22,s[7]),B=h(B,k,T,x,b,7,s[8]),x=h(x,B,k,T,v,12,s[9]),T=h(T,x,B,k,w,17,s[10]),k=h(k,T,x,B,M,22,s[11]),B=h(B,k,T,x,$,7,s[12]),x=h(x,B,k,T,E,12,s[13]),T=h(T,x,B,k,S,17,s[14]),B=f(B,k=h(k,T,x,B,A,22,s[15]),T,x,u,5,s[16]),x=f(x,B,k,T,g,9,s[17]),T=f(T,x,B,k,M,14,s[18]),k=f(k,T,x,B,a,20,s[19]),B=f(B,k,T,x,m,5,s[20]),x=f(x,B,k,T,w,9,s[21]),T=f(T,x,B,k,A,14,s[22]),k=f(k,T,x,B,_,20,s[23]),B=f(B,k,T,x,v,5,s[24]),x=f(x,B,k,T,S,9,s[25]),T=f(T,x,B,k,p,14,s[26]),k=f(k,T,x,B,b,20,s[27]),B=f(B,k,T,x,E,5,s[28]),x=f(x,B,k,T,d,9,s[29]),T=f(T,x,B,k,y,14,s[30]),B=c(B,k=f(k,T,x,B,$,20,s[31]),T,x,m,4,s[32]),x=c(x,B,k,T,b,11,s[33]),T=c(T,x,B,k,M,16,s[34]),k=c(k,T,x,B,S,23,s[35]),B=c(B,k,T,x,u,4,s[36]),x=c(x,B,k,T,_,11,s[37]),T=c(T,x,B,k,y,16,s[38]),k=c(k,T,x,B,w,23,s[39]),B=c(B,k,T,x,E,4,s[40]),x=c(x,B,k,T,a,11,s[41]),T=c(T,x,B,k,p,16,s[42]),k=c(k,T,x,B,g,23,s[43]),B=c(B,k,T,x,v,4,s[44]),x=c(x,B,k,T,$,11,s[45]),T=c(T,x,B,k,A,16,s[46]),B=l(B,k=c(k,T,x,B,d,23,s[47]),T,x,a,6,s[48]),x=l(x,B,k,T,y,10,s[49]),T=l(T,x,B,k,S,15,s[50]),k=l(k,T,x,B,m,21,s[51]),B=l(B,k,T,x,$,6,s[52]),x=l(x,B,k,T,p,10,s[53]),T=l(T,x,B,k,w,15,s[54]),k=l(k,T,x,B,u,21,s[55]),B=l(B,k,T,x,b,6,s[56]),x=l(x,B,k,T,A,10,s[57]),T=l(T,x,B,k,g,15,s[58]),k=l(k,T,x,B,E,21,s[59]),B=l(B,k,T,x,_,6,s[60]),x=l(x,B,k,T,M,10,s[61]),T=l(T,x,B,k,d,15,s[62]),k=l(k,T,x,B,v,21,s[63]),o[0]=o[0]+B|0,o[1]=o[1]+k|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var o=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,u=s.words,h=0;h<4;h++){var f=u[h];u[h]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function h(t,e,r,i,n,o,a){var s=t+(e&r|~e&i)+n+a;return(s<>>32-o)+e}function f(t,e,r,i,n,o,a){var s=t+(e&i|r&~i)+n+a;return(s<>>32-o)+e}function c(t,e,r,i,n,o,a){var s=t+(e^r^i)+n+a;return(s<>>32-o)+e}function l(t,e,r,i,n,o,a){var s=t+(r^(e|~i))+n+a;return(s<>>32-o)+e}r.MD5=o._createHelper(u),r.HmacMD5=o._createHmacHelper(u)}(Math),t.MD5},"object"==typeof _$md5_277?_$md5_277=_$md5_277=__factory_277(_$core_269):"function"==typeof define&&define.amd?define(["./core"],__factory_277):__factory_277(__root_277.CryptoJS);var _$sha1_293={},__root_293,__factory_293;__root_293=this,__factory_293=function(t){var e,r,i,n,o,a,s;return r=(e=t).lib,i=r.WordArray,n=r.Hasher,o=e.algo,a=[],s=o.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],u=r[4],h=0;h<80;h++){if(h<16)a[h]=0|t[e+h];else{var f=a[h-3]^a[h-8]^a[h-14]^a[h-16];a[h]=f<<1|f>>>31}var c=(i<<5|i>>>27)+u+a[h];c+=h<20?1518500249+(n&o|~n&s):h<40?1859775393+(n^o^s):h<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,u=s,s=o,o=n<<30|n>>>2,n=i,i=c}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(i+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA1=n._createHelper(s),e.HmacSHA1=n._createHmacHelper(s),t.SHA1},"object"==typeof _$sha1_293?_$sha1_293=_$sha1_293=__factory_293(_$core_269):"function"==typeof define&&define.amd?define(["./core"],__factory_293):__factory_293(__root_293.CryptoJS);var _$sha256_295={},__root_295,__factory_295;__root_295=this,__factory_295=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=[],u=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(s[n]=r(e.pow(i,.5))),u[n]=r(e.pow(i,1/3)),n++),i++}();var h=[],f=a.SHA256=o.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],f=r[5],c=r[6],l=r[7],d=0;d<64;d++){if(d<16)h[d]=0|t[e+d];else{var p=h[d-15],_=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=h[d-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;h[d]=_+h[d-7]+g+h[d-16]}var y=i&n^i&o^n&o,b=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),v=l+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&c)+u[d]+h[d];l=c,c=f,f=s,s=a+v|0,a=o,o=n,n=i,i=v+(b+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+c|0,r[7]=r[7]+l|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});r.SHA256=o._createHelper(f),r.HmacSHA256=o._createHmacHelper(f)}(Math),t.SHA256},"object"==typeof _$sha256_295?_$sha256_295=_$sha256_295=__factory_295(_$core_269):"function"==typeof define&&define.amd?define(["./core"],__factory_295):__factory_295(__root_295.CryptoJS);var _$sha224_294={},__root_294,__factory_294;__root_294=this,__factory_294=function(t){var e,r,i,n,o;return r=(e=t).lib.WordArray,i=e.algo,n=i.SHA256,o=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}}),e.SHA224=n._createHelper(o),e.HmacSHA224=n._createHmacHelper(o),t.SHA224},"object"==typeof _$sha224_294?_$sha224_294=_$sha224_294=__factory_294(_$core_269,_$sha256_295):"function"==typeof define&&define.amd?define(["./core","./sha256"],__factory_294):__factory_294(__root_294.CryptoJS);var _$sha512_298={},__root_298,__factory_298;__root_298=this,__factory_298=function(t){return function(){var e=t,r=e.lib.Hasher,i=e.x64,n=i.Word,o=i.WordArray,a=e.algo;function s(){return n.create.apply(n,arguments)}var u=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],h=[];!function(){for(var t=0;t<80;t++)h[t]=s()}();var f=a.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],f=r[5],c=r[6],l=r[7],d=i.high,p=i.low,_=n.high,m=n.low,g=o.high,y=o.low,b=a.high,v=a.low,w=s.high,M=s.low,$=f.high,E=f.low,S=c.high,A=c.low,B=l.high,k=l.low,T=d,x=p,I=_,P=m,R=g,C=y,O=b,N=v,L=w,D=M,U=$,j=E,H=S,z=A,q=B,K=k,F=0;F<80;F++){var V,G,W=h[F];if(F<16)G=W.high=0|t[e+2*F],V=W.low=0|t[e+2*F+1];else{var Z=h[F-15],J=Z.high,Y=Z.low,X=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Q=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),tt=h[F-2],et=tt.high,rt=tt.low,it=(et>>>19|rt<<13)^(et<<3|rt>>>29)^et>>>6,nt=(rt>>>19|et<<13)^(rt<<3|et>>>29)^(rt>>>6|et<<26),ot=h[F-7],at=ot.high,st=ot.low,ut=h[F-16],ht=ut.high,ft=ut.low;G=(G=(G=X+at+((V=Q+st)>>>0>>0?1:0))+it+((V+=nt)>>>0>>0?1:0))+ht+((V+=ft)>>>0>>0?1:0),W.high=G,W.low=V}var ct,lt=L&U^~L&H,dt=D&j^~D&z,pt=T&I^T&R^I&R,_t=x&P^x&C^P&C,mt=(T>>>28|x<<4)^(T<<30|x>>>2)^(T<<25|x>>>7),gt=(x>>>28|T<<4)^(x<<30|T>>>2)^(x<<25|T>>>7),yt=(L>>>14|D<<18)^(L>>>18|D<<14)^(L<<23|D>>>9),bt=(D>>>14|L<<18)^(D>>>18|L<<14)^(D<<23|L>>>9),vt=u[F],wt=vt.high,Mt=vt.low,$t=q+yt+((ct=K+bt)>>>0>>0?1:0),Et=gt+_t;q=H,K=z,H=U,z=j,U=L,j=D,L=O+($t=($t=($t=$t+lt+((ct+=dt)>>>0
>>0?1:0))+wt+((ct+=Mt)>>>0>>0?1:0))+G+((ct+=V)>>>0>>0?1:0))+((D=N+ct|0)>>>0>>0?1:0)|0,O=R,N=C,R=I,C=P,I=T,P=x,T=$t+(mt+pt+(Et>>>0>>0?1:0))+((x=ct+Et|0)>>>0>>0?1:0)|0}p=i.low=p+x,i.high=d+T+(p>>>0>>0?1:0),m=n.low=m+P,n.high=_+I+(m>>>0

>>0?1:0),y=o.low=y+C,o.high=g+R+(y>>>0>>0?1:0),v=a.low=v+N,a.high=b+O+(v>>>0>>0?1:0),M=s.low=M+D,s.high=w+L+(M>>>0>>0?1:0),E=f.low=E+j,f.high=$+U+(E>>>0>>0?1:0),A=c.low=A+z,c.high=S+H+(A>>>0>>0?1:0),k=l.low=k+K,l.high=B+q+(k>>>0>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(i+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=r._createHelper(f),e.HmacSHA512=r._createHmacHelper(f)}(),t.SHA512},"object"==typeof _$sha512_298?_$sha512_298=_$sha512_298=__factory_298(_$core_269,_$x64Core_300):"function"==typeof define&&define.amd?define(["./core","./x64-core"],__factory_298):__factory_298(__root_298.CryptoJS);var _$sha384_297={},__root_297,__factory_297;__root_297=this,__factory_297=function(t){var e,r,i,n,o,a,s;return r=(e=t).x64,i=r.Word,n=r.WordArray,o=e.algo,a=o.SHA512,s=o.SHA384=a.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=16,t}}),e.SHA384=a._createHelper(s),e.HmacSHA384=a._createHmacHelper(s),t.SHA384},"object"==typeof _$sha384_297?_$sha384_297=_$sha384_297=__factory_297(_$core_269,_$x64Core_300,_$sha512_298):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],__factory_297):__factory_297(__root_297.CryptoJS);var _$sha3_296={},__root_296,__factory_296;__root_296=this,__factory_296=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.x64.Word,s=r.algo,u=[],h=[],f=[];!function(){for(var t=1,e=0,r=0;r<24;r++){u[t+5*e]=(r+1)*(r+2)/2%64;var i=(2*t+3*e)%5;t=e%5,e=i}for(t=0;t<5;t++)for(e=0;e<5;e++)h[t+5*e]=e+(2*t+3*e)%5*5;for(var n=1,o=0;o<24;o++){for(var s=0,c=0,l=0;l<7;l++){if(1&n){var d=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[n]).high^=a,k.low^=o}for(var s=0;s<24;s++){for(var l=0;l<5;l++){for(var d=0,p=0,_=0;_<5;_++)d^=(k=r[l+5*_]).high,p^=k.low;var m=c[l];m.high=d,m.low=p}for(l=0;l<5;l++){var g=c[(l+4)%5],y=c[(l+1)%5],b=y.high,v=y.low;for(d=g.high^(b<<1|v>>>31),p=g.low^(v<<1|b>>>31),_=0;_<5;_++)(k=r[l+5*_]).high^=d,k.low^=p}for(var w=1;w<25;w++){var M=(k=r[w]).high,$=k.low,E=u[w];E<32?(d=M<>>32-E,p=$<>>32-E):(d=$<>>64-E,p=M<>>64-E);var S=c[h[w]];S.high=d,S.low=p}var A=c[0],B=r[0];for(A.high=B.high,A.low=B.low,l=0;l<5;l++)for(_=0;_<5;_++){var k=r[w=l+5*_],T=c[w],x=c[(l+1)%5+5*_],I=c[(l+2)%5+5*_];k.high=T.high^~x.high&I.high,k.low=T.low^~x.low&I.low}k=r[0];var P=f[s];k.high^=P.high,k.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words,i=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,h=[],f=0;f>>24)|4278255360&(l<<24|l>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),h.push(d),h.push(l)}return new n.init(h,s)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),r=0;r<25;r++)e[r]=e[r].clone();return t}});r.SHA3=o._createHelper(l),r.HmacSHA3=o._createHmacHelper(l)}(Math),t.SHA3},"object"==typeof _$sha3_296?_$sha3_296=_$sha3_296=__factory_296(_$core_269,_$x64Core_300):"function"==typeof define&&define.amd?define(["./core","./x64-core"],__factory_296):__factory_296(__root_296.CryptoJS);var _$ripemd160_292={},__root_292,__factory_292;__root_292=this,__factory_292=function(t){return function(e){var r=t,i=r.lib,n=i.WordArray,o=i.Hasher,a=r.algo,s=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),h=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=n.create([0,1518500249,1859775393,2400959708,2840853838]),l=n.create([1352829926,1548603684,1836072691,2053994217,0]),d=a.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var i=e+r,n=t[i];t[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o,a,d,v,w,M,$,E,S,A,B,k=this._hash.words,T=c.words,x=l.words,I=s.words,P=u.words,R=h.words,C=f.words;for(M=o=k[0],$=a=k[1],E=d=k[2],S=v=k[3],A=w=k[4],r=0;r<80;r+=1)B=o+t[e+I[r]]|0,B+=r<16?p(a,d,v)+T[0]:r<32?_(a,d,v)+T[1]:r<48?m(a,d,v)+T[2]:r<64?g(a,d,v)+T[3]:y(a,d,v)+T[4],B=(B=b(B|=0,R[r]))+w|0,o=w,w=v,v=b(d,10),d=a,a=B,B=M+t[e+P[r]]|0,B+=r<16?y($,E,S)+x[0]:r<32?g($,E,S)+x[1]:r<48?m($,E,S)+x[2]:r<64?_($,E,S)+x[3]:p($,E,S)+x[4],B=(B=b(B|=0,C[r]))+A|0,M=A,A=S,S=b(E,10),E=$,$=B;B=k[1]+d+S|0,k[1]=k[2]+v+A|0,k[2]=k[3]+w+M|0,k[3]=k[4]+o+$|0,k[4]=k[0]+a+E|0,k[0]=B},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process();for(var n=this._hash,o=n.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return n},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,r){return t^e^r}function _(t,e,r){return t&e|~t&r}function m(t,e,r){return(t|~e)^r}function g(t,e,r){return t&r|e&~r}function y(t,e,r){return t^(e|~r)}function b(t,e){return t<>>32-e}r.RIPEMD160=o._createHelper(d),r.HmacRIPEMD160=o._createHmacHelper(d)}(Math),t.RIPEMD160},"object"==typeof _$ripemd160_292?_$ripemd160_292=_$ripemd160_292=__factory_292(_$core_269):"function"==typeof define&&define.amd?define(["./core"],__factory_292):__factory_292(__root_292.CryptoJS);var _$hmac_274={},__root_274,__factory_274;__root_274=this,__factory_274=function(t){var e,r,i;r=(e=t).lib.Base,i=e.enc.Utf8,e.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),a=this._iKey=e.clone(),s=o.words,u=a.words,h=0;h>>2];t.sigBytes-=e}},_=(i.BlockCipher=f.extend({cfg:f.cfg.extend({mode:d,padding:p}),reset:function(){var t;f.reset.call(this);var e=this.cfg,r=e.iv,i=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=i.createEncryptor:(t=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(i,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),i.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),m=(r.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(e):e).toString(u)},parse:function(t){var e,r=u.parse(t),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(e=o.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),_.create({ciphertext:r,salt:e})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:m}),encrypt:function(t,e,r,i){i=this.cfg.extend(i);var n=t.createEncryptor(r,i),o=n.finalize(e),a=n.cfg;return _.create({ciphertext:o,key:r,iv:a.iv,algorithm:t,mode:a.mode,padding:a.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,r,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),t.createDecryptor(r,i).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),y=(r.kdf={}).OpenSSL={execute:function(t,e,r,i){i||(i=o.random(8));var n=h.create({keySize:e+r}).compute(t,i),a=o.create(n.words.slice(e),4*r);return n.sigBytes=4*e,_.create({key:n,iv:a,salt:i})}},b=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(t,e,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,t.keySize,t.ivSize);i.iv=n.iv;var o=g.encrypt.call(this,t,e,n.key,i);return o.mixIn(n),o},decrypt:function(t,e,r,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var n=i.kdf.execute(r,t.keySize,t.ivSize,e.salt);return i.iv=n.iv,g.decrypt.call(this,t,e,n.key,i)}})}()},"object"==typeof _$cipherCore_268?_$cipherCore_268=_$cipherCore_268=__factory_268(_$core_269,_$evpkdf_272):"function"==typeof define&&define.amd?define(["./core","./evpkdf"],__factory_268):__factory_268(__root_268.CryptoJS);var _$modeCfb_278={},__root_278,__factory_278;__root_278=this,__factory_278=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function r(t,e,r,i){var n,o=this._iv;o?(n=o.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var e=t>>16&255,r=t>>8&255,i=255&t;255===e?(e=0,255===r?(r=0,255===i?i=0:++i):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=i}else t+=1<<24;return t}var i=e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,n=i.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),function(t){0===(t[0]=r(t[0]))&&(t[1]=r(t[1]))}(a);var s=a.slice(0);i.encryptBlock(s,0);for(var u=0;u>>2]|=n<<24-o%4*8,t.sigBytes+=n},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923},"object"==typeof _$padAnsix923_283?_$padAnsix923_283=_$padAnsix923_283=__factory_283(_$core_269,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_283):__factory_283(__root_283.CryptoJS);var _$padIso10126_284={},__root_284,__factory_284;__root_284=this,__factory_284=function(t){return t.pad.Iso10126={pad:function(e,r){var i=4*r,n=i-e.sigBytes%i;e.concat(t.lib.WordArray.random(n-1)).concat(t.lib.WordArray.create([n<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126},"object"==typeof _$padIso10126_284?_$padIso10126_284=_$padIso10126_284=__factory_284(_$core_269,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_284):__factory_284(__root_284.CryptoJS);var _$padIso97971_285={},__root_285,__factory_285;__root_285=this,__factory_285=function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971},"object"==typeof _$padIso97971_285?_$padIso97971_285=_$padIso97971_285=__factory_285(_$core_269,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_285):__factory_285(__root_285.CryptoJS);var _$padZeropadding_287={},__root_287,__factory_287;__root_287=this,__factory_287=function(t){return t.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){var e=t.words,r=t.sigBytes-1;for(r=t.sigBytes-1;r>=0;r--)if(e[r>>>2]>>>24-r%4*8&255){t.sigBytes=r+1;break}}},t.pad.ZeroPadding},"object"==typeof _$padZeropadding_287?_$padZeropadding_287=_$padZeropadding_287=__factory_287(_$core_269,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_287):__factory_287(__root_287.CryptoJS);var _$padNopadding_286={},__root_286,__factory_286;__root_286=this,__factory_286=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding},"object"==typeof _$padNopadding_286?_$padNopadding_286=_$padNopadding_286=__factory_286(_$core_269,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_286):__factory_286(__root_286.CryptoJS);var _$formatHex_273={},__root_273,__factory_273;__root_273=this,__factory_273=function(t){var e,r,i;return r=(e=t).lib.CipherParams,i=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(i)},parse:function(t){var e=i.parse(t);return r.create({ciphertext:e})}},t.format.Hex},"object"==typeof _$formatHex_273?_$formatHex_273=_$formatHex_273=__factory_273(_$core_269,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],__factory_273):__factory_273(__root_273.CryptoJS);var _$aes_267={},__root_267,__factory_267;__root_267=this,__factory_267=function(t){return function(){var e=t,r=e.lib.BlockCipher,i=e.algo,n=[],o=[],a=[],s=[],u=[],h=[],f=[],c=[],l=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var r=0,i=0;for(e=0;e<256;e++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,o[p]=r;var _=t[r],m=t[_],g=t[m],y=257*t[p]^16843008*p;a[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,u[r]=y<<8|y>>>24,h[r]=y,y=16843009*g^65537*m^257*_^16843008*r,f[p]=y<<24|y>>>8,c[p]=y<<16|y>>>16,l[p]=y<<8|y>>>24,d[p]=y,r?(r=_^t[t[t[g^_]]],i^=t[t[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],_=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,i=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a6&&a%r==4&&(h=n[h>>>24]<<24|n[h>>>16&255]<<16|n[h>>>8&255]<<8|n[255&h]):(h=n[(h=h<<8|h>>>24)>>>24]<<24|n[h>>>16&255]<<16|n[h>>>8&255]<<8|n[255&h],h^=p[a/r|0]<<24),o[a]=o[a-r]^h);for(var s=this._invKeySchedule=[],u=0;u>>24]]^c[n[h>>>16&255]]^l[n[h>>>8&255]]^d[n[255&h]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,s,u,h,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,f,c,l,d,o),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,i,n,o,a,s){for(var u=this._nRounds,h=t[e]^r[0],f=t[e+1]^r[1],c=t[e+2]^r[2],l=t[e+3]^r[3],d=4,p=1;p>>24]^n[f>>>16&255]^o[c>>>8&255]^a[255&l]^r[d++],m=i[f>>>24]^n[c>>>16&255]^o[l>>>8&255]^a[255&h]^r[d++],g=i[c>>>24]^n[l>>>16&255]^o[h>>>8&255]^a[255&f]^r[d++],y=i[l>>>24]^n[h>>>16&255]^o[f>>>8&255]^a[255&c]^r[d++];h=_,f=m,c=g,l=y}_=(s[h>>>24]<<24|s[f>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^r[d++],m=(s[f>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[d++],g=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&f])^r[d++],y=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[f>>>8&255]<<8|s[255&c])^r[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=y},keySize:8});e.AES=r._createHelper(_)}(),t.AES},"object"==typeof _$aes_267?_$aes_267=_$aes_267=__factory_267(_$core_269,_$encBase64_270,_$md5_277,_$evpkdf_272,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_267):__factory_267(__root_267.CryptoJS);var _$tripledes_299={},__root_299,__factory_299;__root_299=this,__factory_299=function(t){return function(){var e=t,r=e.lib,i=r.WordArray,n=r.BlockCipher,o=e.algo,a=[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],s=[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],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{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}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=n.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var i=a[r]-1;e[r]=t[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],o=0;o<16;o++){var h=n[o]=[],f=u[o];for(r=0;r<24;r++)h[r/6|0]|=e[(s[r]-1+f)%28]<<31-r%6,h[4+(r/6|0)]|=e[28+(s[r+24]-1+f)%28]<<31-r%6;for(h[0]=h[0]<<1|h[0]>>>31,r=1;r<7;r++)h[r]=h[r]>>>4*(r-1)+3;h[7]=h[7]<<5|h[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=n[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],l.call(this,4,252645135),l.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),l.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],o=this._lBlock,a=this._rBlock,s=0,u=0;u<8;u++)s|=h[u][((a^n[u])&f[u])>>>0];this._lBlock=a,this._rBlock=o^s}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,l.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),l.call(this,16,65535),l.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function l(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),n=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=c.createEncryptor(i.create(e)),this._des2=c.createEncryptor(i.create(r)),this._des3=c.createEncryptor(i.create(n))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),t.TripleDES},"object"==typeof _$tripledes_299?_$tripledes_299=_$tripledes_299=__factory_299(_$core_269,_$encBase64_270,_$md5_277,_$evpkdf_272,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_299):__factory_299(__root_299.CryptoJS);var _$rc4_291={},__root_291,__factory_291;__root_291=this,__factory_291=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=i.RC4=r.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var o=0;n<256;n++){var a=n%r,s=e[a>>>2]>>>24-a%4*8&255;o=(o+i[n]+s)%256;var u=i[n];i[n]=i[o],i[o]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var t=this._S,e=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+t[e=(e+1)%256])%256;var o=t[e];t[e]=t[r],t[r]=o,i|=t[(t[e]+t[r])%256]<<24-8*n}return this._i=e,this._j=r,i}e.RC4=r._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)o.call(this)}});e.RC4Drop=r._createHelper(a)}(),t.RC4},"object"==typeof _$rc4_291?_$rc4_291=_$rc4_291=__factory_291(_$core_269,_$encBase64_270,_$md5_277,_$evpkdf_272,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_291):__factory_291(__root_291.CryptoJS);var _$rabbit_290={},__root_290,__factory_290;__root_290=this,__factory_290=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=[],o=[],a=[],s=i.Rabbit=r.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var i=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)u.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(e){var o=e.words,a=o[0],s=o[1],h=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),c=h>>>16|4294901760&f,l=f<<16|65535&h;for(n[0]^=h,n[1]^=c,n[2]^=f,n[3]^=l,n[4]^=h,n[5]^=c,n[6]^=f,n[7]^=l,r=0;r<4;r++)u.call(this)}},_doProcessBlock:function(t,e){var r=this._X;u.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,r=0;r<8;r++)o[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0,r=0;r<8;r++){var i=t[r]+e[r],n=65535&i,s=i>>>16,u=((n*n>>>17)+n*s>>>15)+s*s,h=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=u^h}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=r._createHelper(s)}(),t.Rabbit},"object"==typeof _$rabbit_290?_$rabbit_290=_$rabbit_290=__factory_290(_$core_269,_$encBase64_270,_$md5_277,_$evpkdf_272,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_290):__factory_290(__root_290.CryptoJS);var _$rabbitLegacy_289={},__root_289,__factory_289;__root_289=this,__factory_289=function(t){return function(){var e=t,r=e.lib.StreamCipher,i=e.algo,n=[],o=[],a=[],s=i.RabbitLegacy=r.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(e){var o=e.words,a=o[0],s=o[1],h=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),c=h>>>16|4294901760&f,l=f<<16|65535&h;for(i[0]^=h,i[1]^=c,i[2]^=f,i[3]^=l,i[4]^=h,i[5]^=c,i[6]^=f,i[7]^=l,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var r=this._X;u.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,r=0;r<8;r++)o[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0>>0?1:0)|0,this._b=e[7]>>>0>>0?1:0,r=0;r<8;r++){var i=t[r]+e[r],n=65535&i,s=i>>>16,u=((n*n>>>17)+n*s>>>15)+s*s,h=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=u^h}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=r._createHelper(s)}(),t.RabbitLegacy},"object"==typeof _$rabbitLegacy_289?_$rabbitLegacy_289=_$rabbitLegacy_289=__factory_289(_$core_269,_$encBase64_270,_$md5_277,_$evpkdf_272,_$cipherCore_268):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],__factory_289):__factory_289(__root_289.CryptoJS);var _$cryptoJs_275={},__root_275,__factory_275;__root_275=this,__factory_275=function(t){return t},"object"==typeof _$cryptoJs_275?_$cryptoJs_275=_$cryptoJs_275=__factory_275(_$core_269,_$x64Core_300,_$libTypedarrays_276,_$encUtf16_271,_$encBase64_270,_$md5_277,_$sha1_293,_$sha256_295,_$sha224_294,_$sha512_298,_$sha384_297,_$sha3_296,_$ripemd160_292,_$hmac_274,_$pbkdf2_288,_$evpkdf_272,_$cipherCore_268,_$modeCfb_278,_$modeCtr_280,_$modeCtrGladman_279,_$modeOfb_282,_$modeEcb_281,_$padAnsix923_283,_$padIso10126_284,_$padIso97971_285,_$padZeropadding_287,_$padNopadding_286,_$formatHex_273,_$aes_267,_$tripledes_299,_$rc4_291,_$rabbit_290,_$rabbitLegacy_289):"function"==typeof define&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy"],__factory_275):__root_275.CryptoJS=__factory_275(__root_275.CryptoJS);const orgs=[{org:"psf",description:"Permissionless Software Foundation",website:"https://psfoundation.cash",addresses:{donations:"bitcoincash:qqsrke9lh257tqen99dkyy2emh4uty0vky9y0z0lsr"}},{org:"abc",description:"Bitcoin ABC",website:"https://www.bitcoinabc.org/",addresses:{donations:"bitcoincash:qqeht8vnwag20yv8dvtcrd4ujx09fwxwsqqqw93w88"}},{org:"bchd",description:"BCHD full node in Go",website:"https://bchd.cash/",addresses:{donations:"bitcoincash:qrhea03074073ff3zv9whh0nggxc7k03ssh8jv9mkx"}}];var _$bchDonation_186=function(t){const e=orgs.filter(e=>e.org===t);if(!e)throw new Error("Could not find an organization with that handle.");if(e.length>1)throw new Error("Multiple organizations were found!");return e[0].addresses};const PSF_DONATION=2e3;var _$sendBch_5=class{constructor(t={}){if(this.bchjs=t.bchjs,!this.bchjs)throw new Error("Must pass instance of bch-js when instantiating SendBCH.");if(this.ar=t.ar,!this.ar)throw new Error("Must pass instance of Adapter Router.");this.restURL=t.restURL,this.apiToken=t.apiToken}async sendBch(t,e,r){try{const i=await this.createTransaction(t,e,r);return await this.ar.sendTx(i.hex)}catch(err){throw console.error("Error in send-bch.js/sendBch()"),err}}async createTransaction(t,e,r){try{if(!r||0===r.length)throw new Error("UTXO list is empty");e.fee||(e.fee=1);const{necessaryUtxos:i,change:n}=this.getNecessaryUtxosAndChange(t,r,e.fee),o=new this.bchjs.TransactionBuilder;i.forEach(t=>{o.addInput(t.tx_hash,t.tx_pos)}),t.forEach(t=>{o.addOutput(this.bchjs.Address.toLegacyAddress(t.address),t.amountSat)}),o.addOutput(_$bchDonation_186("psf").donations,PSF_DONATION),n&&n>546&&o.addOutput(e.cashAddress,n);const a=await this.getKeyPairFromMnemonic(e);i.forEach((t,e)=>{o.sign(e,a,void 0,o.hashTypes.SIGHASH_ALL,t.value)});const s=o.build();return{hex:s.toHex(),txid:s.getId()}}catch(err){throw console.error("Error in send-bch.js/createTransaction()"),err}}getNecessaryUtxosAndChange(t,e,r=1,i={}){const n=i.utxoSortingFn?i.utxoSortingFn(e):this.sortUtxosBySize(e,"ASCENDING"),o=this.calculateFee(0,t.length+1,r);let a=t.reduce((t,e)=>t+e.amountSat,0)+o+PSF_DONATION,s=0;const u=[];for(const f of n)if(u.push(f),(s+=f.value)>=(a+=148))break;const h=s-a;if(h<0)throw console.error(`Available satoshis (${s}) below needed satoshis (${a}).`),new Error("Insufficient balance");return{necessaryUtxos:u,change:h}}sortUtxosBySize(t,e="ASCENDING"){return"ASCENDING"===e?t.sort((t,e)=>t.value-e.value):t.sort((t,e)=>e.value-t.value)}calculateFee(t,e,r){try{const i=this.bchjs.BitcoinCash.getByteCount({P2PKH:t},{P2PKH:e+1}),n=Math.ceil(i*r);if(isNaN(n))throw new Error("Invalid input. Fee could not be calculated.");return n}catch(err){throw console.error("Error in send-bch.js/calculateFee()"),err}}async getKeyPairFromMnemonic(t){if(t.mnemonic){const e=await this.bchjs.Mnemonic.toSeed(t.mnemonic),r=this.bchjs.HDNode.fromSeed(e),i=this.bchjs.HDNode.derivePath(r,t.hdPath);return this.bchjs.HDNode.toKeyPair(i)}if(!t.privateKey)throw new Error("Wallet has no mnemonic or private key!");return this.bchjs.ECPair.fromWIF(t.privateKey)}async sendAllBch(t,e,r){try{const i=await this.createSendAllTx(t,e,r);return await this.ar.sendTx(i.hex)}catch(err){throw console.error("Error in send-bch.js/sendAllBch()"),err}}async createSendAllTx(t,e,r){try{if(!t||"string"!=typeof t)throw new Error("Address to send must be a bch address");if(!r||0===r.length)throw new Error("UTXO list is empty");const i=new this.bchjs.TransactionBuilder;e.fee||(e.fee=1);const n=e.fee;let o=0,a=this.calculateFee(0,2,n);a+=PSF_DONATION,r.forEach(t=>{o+=t.value,a+=148,i.addInput(t.tx_hash,t.tx_pos)}),i.addOutput(t,o-a),i.addOutput(_$bchDonation_186("psf").donations,PSF_DONATION);const s=await this.getKeyPairFromMnemonic(e);r.forEach((t,e)=>{i.sign(e,s,void 0,i.hashTypes.SIGHASH_ALL,t.value)});const u=i.build();return{hex:u.toHex(),txid:u.getId()}}catch(err){throw console.error("Error in send-bch.js/createSendAllTx()"),err}}},_$utxos_7=class{constructor(t={}){if(this.bchjs=t.bchjs,!this.bchjs)throw new Error("Must pass instance of bch-js when instantiating AdapterRouter.");if(this.ar=t.ar,!this.ar)throw new Error("Must pass instance of Adapter Router.");this.utxoStore={},this.temp=[]}async initUtxoStore(t){try{this.utxoStore=[];const e=await this.ar.getUtxos(t);if(e.status>399)throw new Error(e.message);return this.utxoStore=e,this.utxoStore}catch(err){throw console.error("Error in utxos.js/initUtxoStore()"),err}}getSpendableTokenUtxos(){try{return this.utxoStore.slpUtxos.type1.tokens.concat(this.utxoStore.slpUtxos.nft.tokens,this.utxoStore.slpUtxos.group.tokens)}catch(err){throw console.error("Error in utxos.js/getSpendableTokenUtxos()"),err}}},_$tokens_6={};(function(t){(function(){_$tokens_6=class{constructor(t={}){if(this.bchjs=t.bchjs,!this.bchjs)throw new Error("Must pass instance of bch-js when instantiating Tokens library.");if(this.ar=t.ar,!this.ar)throw new Error("Must pass instance of Adapter Router.");this.sendBch=new _$sendBch_5(t),this.utxos=new _$utxos_7(t)}async listTokensFromAddress(t){try{if(!t)throw new Error("Address not provided");t=this.bchjs.SLP.Address.toCashAddress(t),await this.utxos.initUtxoStore(t);const e=this.utxos.getSpendableTokenUtxos();return this.listTokensFromUtxos(e)}catch(err){throw console.error("Error in tokens.js/listTokensFromAddress()"),err}}async getTokenBalance(t,e){try{if(!t)throw new Error("token ID not provided");if(!e)throw new Error("Address not provided");console.log("tokenId: ",t);const r=(await this.listTokensFromAddress(e)).filter(e=>e.tokenId===t);return r.length?r[0].qty:0}catch(err){throw console.error("Error in tokens.js/getTokenBalance()"),err}}listTokensFromUtxos(t){try{const e=[];return t.forEach(t=>{if(!t.isSlp||"token"!==t.type)return;const r=e.findIndex(e=>e.tokenId===t.tokenId);if(r<0){const r={tokenId:t.tokenId,ticker:t.ticker,name:t.name,decimals:t.decimals,tokenType:t.tokenType,url:t.documentUri,qty:Number(t.qtyStr)};e.push(r)}else e[r].qty+=Number(t.qtyStr)}),e}catch(err){throw console.error("Error in tokens.js/listTokensFromUtxos()"),err}}async sendTokens(t,e,r,i,n=1,o={}){try{const a=await this.createTransaction(t,e,r,i,n,o);return await this.ar.sendTx(a.hex)}catch(err){throw console.error("Error in tokens.js/sendTokens()"),err}}async createTransaction(e,r,i,n,o=1,a={}){try{if(!i||0===i.length)throw new Error("BCH UTXO list is empty");if(!n||0===n.length)throw new Error("Token UTXO list is empty");const s=e.tokenId;if(0===(n=n.filter(t=>t.tokenId===s&&"token"===t.type)).length)throw new Error(`Token UTXO with token ID ${s} not found!`);const u=[{address:r.cashAddress,amountSat:500+50*o}],{necessaryUtxos:h,change:f}=this.sendBch.getNecessaryUtxosAndChange(u,i,o,a),c=new this.bchjs.TransactionBuilder;a.tokenUtxosFilter&&(n=a.tokenUtxosFilter(n)),n.forEach(t=>{c.addInput(t.tx_hash,t.tx_pos)}),h.forEach(t=>{c.addInput(t.tx_hash,t.tx_pos)}),n=n.map(t=>(t.tokenQty=parseFloat(t.qtyStr),t));let l={};if(1===n[0].tokenType)l=await this.bchjs.SLP.TokenType1.generateSendOpReturn(n,e.qty);else if(65===n[0].tokenType)l=await this.bchjs.SLP.NFT1.generateNFTChildSendOpReturn(n,e.qty);else{if(129!==n[0].tokenType)throw new Error(`Token Type ${n[0].tokenType} unknown`);l=await this.bchjs.SLP.NFT1.generateNFTGroupSendOpReturn(n,e.qty)}const d=t.from(l.script,"hex");c.addOutput(d,0),c.addOutput(this.bchjs.SLP.Address.toLegacyAddress(e.address),546),l.outputs>1&&c.addOutput(this.bchjs.SLP.Address.toLegacyAddress(r.address),546),c.addOutput(_$bchDonation_186("psf").donations,2e3),f&&f>546&&c.addOutput(r.cashAddress,f);const p=await this.sendBch.getKeyPairFromMnemonic(r);n.forEach((t,e)=>{c.sign(e,p,void 0,c.hashTypes.SIGHASH_ALL,t.value)}),h.forEach((t,e)=>{c.sign(n.length+e,p,void 0,c.hashTypes.SIGHASH_ALL,t.value)});const _=c.build();return{hex:_.toHex(),txid:_.getId()}}catch(err){throw console.error("Error in tokens.js/createTransaction()"),err}}async createBurnTransaction(t,e,r,i,n,o=1){try{if(!t||"number"!=typeof t)throw new Error("qty must be number");if(!e||"string"!=typeof e)throw new Error("tokenId must be string");if(!r||"object"!=typeof r)throw new Error("walletInfo must be a object");if(!i||0===i.length)throw new Error("BCH UTXO list is empty");if(!n||0===n.length)throw new Error("Token UTXO list is empty");if(!(n=n.filter(t=>t.tokenId===e&&"token"===t.type)).length)throw new Error("tokenId does not match");let a=0;for(let t=0;t{f.addInput(t.tx_hash,t.tx_pos)}),u.forEach(t=>{f.addInput(t.tx_hash,t.tx_pos)}),n.map(t=>(t.tokenQty=t.qtyStr,t));const c=await this.bchjs.SLP.TokenType1.generateBurnOpReturn(n,t);f.addOutput(c,0),f.addOutput(this.bchjs.SLP.Address.toLegacyAddress(r.address),546),f.addOutput(_$bchDonation_186("psf").donations,2e3),h&&h>546&&f.addOutput(r.cashAddress,h);const l=await this.sendBch.getKeyPairFromMnemonic(r);n.forEach((t,e)=>{f.sign(e,l,void 0,f.hashTypes.SIGHASH_ALL,t.value)}),u.forEach((t,e)=>{f.sign(n.length+e,l,void 0,f.hashTypes.SIGHASH_ALL,t.value)});const d=f.build();return{hex:d.toHex(),txid:d.getId()}}catch(err){throw console.error("Error in tokens.js/createBurnTransaction()"),err}}async burnTokens(t,e,r,i,n,o=1){try{const a=await this.createBurnTransaction(t,e,r,i,n,o);return await this.ar.sendTx(a.hex)}catch(err){throw console.error("Error in tokens.js/burnTokens()"),err}}async burnAll(t,e,r,i){try{if(!t||"string"!=typeof t)throw new Error("tokenId must be a string");if(!e||"object"!=typeof e)throw new Error("walletInfo is required");if(!r||0===r.length)throw new Error("BCH UTXO list is empty");if(!i||0===i.length)throw new Error("SLP UTXO list is empty");if(0===(i=i.filter(e=>e.tokenId===t&&"token"===e.type)).length)throw new Error("No token UTXOs found to burn after filtering, for token ID "+t);const n=i.concat(r);return await this.sendBch.sendAllBch(e.cashAddress,e,n)}catch(err){throw console.error("Error in tokens.js/burnAll()"),err}}}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$bind_174=function(t,e){return function(){for(var r=new Array(arguments.length),i=0;i=0)return;n[e]="set-cookie"===e?(n[e]?n[e]:[]).concat([r]):n[e]?n[e]+", "+r:r}})),n):n},_$isURLSameOrigin_180=_$utils_185.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(t){var i=t;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return t=i(window.location.href),function(e){var r=_$utils_185.isString(e)?i(e):e;return r.protocol===t.protocol&&r.host===t.host}}():function(){return!0},_$Cancel_160={};function __Cancel_160(t){this.message=t}__Cancel_160.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},__Cancel_160.prototype.__CANCEL__=!0,_$Cancel_160=__Cancel_160;var __defaults_171=_$defaults_172({}),_$transformData_171=function(t,e,r){var i=this||__defaults_171;return _$utils_185.forEach(r,(function(r){t=r.call(i,t,e)})),t},_$isCancel_162=function(t){return!(!t||!t.__CANCEL__)},__defaults_167=_$defaults_172({});function __throwIfCancellationRequested_167(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _$Cancel_160("canceled")}var _$dispatchRequest_167=function(t){return __throwIfCancellationRequested_167(t),t.headers=t.headers||{},t.data=_$transformData_171.call(t,t.data,t.headers,t.transformRequest),t.headers=_$utils_185.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),_$utils_185.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||__defaults_167.adapter)(t).then((function(e){return __throwIfCancellationRequested_167(t),e.data=_$transformData_171.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return _$isCancel_162(e)||(__throwIfCancellationRequested_167(t),e&&e.response&&(e.response.data=_$transformData_171.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},_$mergeConfig_169=function(t,e){e=e||{};var r={};function i(t,e){return _$utils_185.isPlainObject(t)&&_$utils_185.isPlainObject(e)?_$utils_185.merge(t,e):_$utils_185.isPlainObject(e)?_$utils_185.merge({},e):_$utils_185.isArray(e)?e.slice():e}function n(r){return _$utils_185.isUndefined(e[r])?_$utils_185.isUndefined(t[r])?void 0:i(void 0,t[r]):i(t[r],e[r])}function o(t){if(!_$utils_185.isUndefined(e[t]))return i(void 0,e[t])}function a(r){return _$utils_185.isUndefined(e[r])?_$utils_185.isUndefined(t[r])?void 0:i(void 0,t[r]):i(void 0,e[r])}function s(r){return r in e?i(t[r],e[r]):r in t?i(void 0,t[r]):void 0}var u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return _$utils_185.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||n,i=e(t);_$utils_185.isUndefined(i)&&e!==s||(r[t]=i)})),r},_$data_173={version:"0.25.0"},_$validator_184={},__VERSION_184=_$data_173.version,__validators_184={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){__validators_184[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));var __deprecatedWarnings_184={};__validators_184.transitional=function(t,e,r){function i(t,e){return"[Axios v"+__VERSION_184+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(r,n,o){if(!1===t)throw new Error(i(n," has been removed"+(e?" in "+e:"")));return e&&!__deprecatedWarnings_184[n]&&(__deprecatedWarnings_184[n]=!0,console.warn(i(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,o)}},_$validator_184={assertOptions:function(t,e,r){if("object"!=typeof t)throw new TypeError("options must be an object");for(var i=Object.keys(t),n=i.length;n-- >0;){var o=i[n],a=e[o];if(a){var s=t[o],u=void 0===s||a(s,o,t);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:__validators_184};var _$Axios_163={},__validators_163=_$validator_184.validators;function __Axios_163(t){this.defaults=t,this.interceptors={request:new _$InterceptorManager_164,response:new _$InterceptorManager_164}}__Axios_163.prototype.request=function(t,e){if("string"==typeof t?(e=e||{}).url=t:e=t||{},!e.url)throw new Error("Provided config url is not valid");(e=_$mergeConfig_169(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;void 0!==r&&_$validator_184.assertOptions(r,{silentJSONParsing:__validators_163.transitional(__validators_163.boolean),forcedJSONParsing:__validators_163.transitional(__validators_163.boolean),clarifyTimeoutError:__validators_163.transitional(__validators_163.boolean)},!1);var i=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,i.unshift(t.fulfilled,t.rejected))}));var o,a=[];if(this.interceptors.response.forEach((function(t){a.push(t.fulfilled,t.rejected)})),!n){var s=[_$dispatchRequest_167,void 0];for(Array.prototype.unshift.apply(s,i),s=s.concat(a),o=Promise.resolve(e);s.length;)o=o.then(s.shift(),s.shift());return o}for(var u=e;i.length;){var h=i.shift(),f=i.shift();try{u=h(u)}catch(c){f(c);break}}try{o=_$dispatchRequest_167(u)}catch(c){return Promise.reject(c)}for(;a.length;)o=o.then(a.shift(),a.shift());return o},__Axios_163.prototype.getUri=function(t){if(!t.url)throw new Error("Provided config url is not valid");return t=_$mergeConfig_169(this.defaults,t),_$buildURL_175(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},_$utils_185.forEach(["delete","get","head","options"],(function(t){__Axios_163.prototype[t]=function(e,r){return this.request(_$mergeConfig_169(r||{},{method:t,url:e,data:(r||{}).data}))}})),_$utils_185.forEach(["post","put","patch"],(function(t){__Axios_163.prototype[t]=function(e,r,i){return this.request(_$mergeConfig_169(i||{},{method:t,url:e,data:r}))}})),_$Axios_163=__Axios_163;var _$CancelToken_161={};function __CancelToken_161(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var r=this;this.promise.then((function(t){if(r._listeners){var e,i=r._listeners.length;for(e=0;e20)throw new Error("addr parameter must not exceed 20 elements");const e={addresses:t};return(await this.axios.post(this.restURL+"/bch/utxosBulk",e)).data}}async sendTx(t){if("string"!=typeof t)throw new Error("Input must be a string containing hex representation of a transaction");const e={hex:t};return(await this.axios.post(this.restURL+"/bch/broadcast",e)).data}async getTxData(t){if(!Array.isArray(t))throw new Error("Input must be an array of strings representing TXIDs");const e={txids:t};return(await this.axios.post(this.restURL+"/bch/txData",e)).data.txData}async getUsd(){return(await this.axios.get(this.restURL+"/price/usd")).data.usd}async utxoIsValid(t){const e={utxo:t};return(await this.axios.post(this.restURL+"/bch/utxoIsValid",e)).data}async getTokenData(t,e=!1){const r={tokenId:t,withTxHistory:e};return(await this.axios.post(this.restURL+"/bch/getTokenData",r)).data}async getTokenData2(t,e=!1){console.log("getTokenData2() updateCache: ",e);const r={tokenId:t,updateCache:e};return(await this.axios.post(this.restURL+"/bch/getTokenData2",r)).data}async getPsffppWritePrice(){return(await this.axios.get(this.restURL+"/price/psffpp")).data.psfPrice}async cid2json(t={}){const{cid:e}=t;if(!e)throw new Error("cid is required");return(await this.axios.get(`${this.restURL}/ipfs/cid2json/${e}`)).data}},_$msg_156=class{constructor(t={}){if(this.restURL=t.restURL,!this.restURL)throw new Error("restURL required when instantiating Message library");this.axios=_$axios_157}async getPubKey(t){if("string"!=typeof t)throw new Error("Input must be a string containing bitcoincash address");const e={address:t};return(await this.axios.post(this.restURL+"/bch/pubkey",e)).data}},_$bchConsumer_153=class{constructor(t={}){this.restURL=t.restURL,this.restURL||(this.restURL="https://free-bch.fullstack.cash",t.restURL=this.restURL),this.bch=new _$bch_154(t),this.msg=new _$msg_156(t)}},_$router_2=class{constructor(t={}){if(this.bchjs=t.bchjs,!this.bchjs)throw new Error("Must pass instance of bch-js when instantiating AdapterRouter.");this.interface="rest-api","consumer-api"===t.interface&&(this.interface="consumer-api",t.restURL?this.bchConsumer=new _$bchConsumer_153({restURL:t.restURL}):this.bchConsumer=new _$bchConsumer_153),console.log("Initializing minimal-slp-wallet routers with this interface: "+this.interface),this.getBalance=this.getBalance.bind(this),this.getUtxos=this.getUtxos.bind(this),this.getTransactions=this.getTransactions.bind(this),this.getTxData=this.getTxData.bind(this),this.sendTx=this.sendTx.bind(this),this.getUsd=this.getUsd.bind(this),this.utxoIsValid=this.utxoIsValid.bind(this),this.getTokenData=this.getTokenData.bind(this),this.getTokenData2=this.getTokenData2.bind(this),this.getPubKey=this.getPubKey.bind(this),this.getPsfWritePrice=this.getPsfWritePrice.bind(this),this.cid2json=this.cid2json.bind(this)}async getBalance(t){try{if(!t)throw new Error("Address string required when calling getBalance()");if("rest-api"===this.interface)return await this.bchjs.Electrumx.balance(t);if("consumer-api"===this.interface){const e=await this.bchConsumer.bch.getBalance(t);if(!e.success)throw new Error(e.message);return{success:e.success,balance:e.balances[0].balance}}throw new Error("this.interface is not specified")}catch(err){throw console.error("Error in router.js/getBalance()"),err}}async getUtxos(t){try{if(!t)throw new Error("Address string required when calling getUtxos()");if("rest-api"===this.interface)return await this.bchjs.Utxo.get(t);if("consumer-api"===this.interface){const e=await this.bchConsumer.bch.getUtxos(t);if(!1===e[0].success)throw new Error(e[0].message);return e[0]}throw new Error("this.interface is not specified")}catch(err){throw console.error("Error in router.js/getUtxos()"),err}}async getTransactions(t,e="DESCENDING"){try{if(!t)throw new Error("Address string required when calling getTransactions()");if("rest-api"===this.interface){const r=await this.bchjs.Electrumx.transactions(t),i=await this.bchjs.Electrumx.sortAllTxs(r.transactions,e);return r.transactions=i,r}if("consumer-api"===this.interface){const r=await this.bchConsumer.bch.getTxHistory(t,e);return{success:r.success,transactions:r.txs}}throw new Error("this.interface is not specified")}catch(err){throw console.error("Error in router.js/getBalance()"),err}}async getTxData(t){try{if(!Array.isArray(t))throw new Error("Input txids must be an array of TXIDs. Up to 20.");if("rest-api"===this.interface){const e=[];for(let r=0;rt+e.amountSat,0)+o+2e3,s=0;const u=[];for(const f of n)if(u.push(f),(s+=f.value)>=(a+=148))break;const h=s-a;if(h<0)throw console.error(`Available satoshis (${s}) below needed satoshis (${a}).`),new Error("Insufficient balance");return{necessaryUtxos:u,change:h}}async createTransaction(e,r,i="",n="6d02",o=[],a=1){try{if(!r||0===r.length)throw new Error("BCH UTXO list is empty");const s=[this.bchjs.Script.opcodes.OP_RETURN,t.from(n,"hex"),t.from(i)],u=this.bchjs.Script.encode2(s),{necessaryUtxos:h,change:f}=this.getNecessaryUtxosAndChange(o,r,u.length,a),c=new this.bchjs.TransactionBuilder;h.forEach(t=>{c.addInput(t.tx_hash,t.tx_pos)}),c.addOutput(u,0),c.addOutput(_$bchDonation_186("psf").donations,2e3),f&&f>546&&c.addOutput(e.cashAddress,f);for(let t=0;t{c.sign(e,l,void 0,c.hashTypes.SIGHASH_ALL,t.value)});const d=c.build();return{hex:d.toHex(),txid:d.getId()}}catch(err){throw console.error("Error in op-return.js/createTransaction()"),err}}async sendOpReturn(t,e,r="",i="6d02",n=[],o=1){const{hex:a}=await this.createTransaction(t,e,r,i,n,o);return await this.ar.sendTx(a)}}}).call(this)}).call(this,_$buffer_251({}).Buffer);var _$eventemitter3_348={exports:{}},__has_348=Object.prototype.hasOwnProperty,__prefix_348="~";function Events(){}function __EE_348(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function addListener(t,e,r,i,n){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new __EE_348(r,i||t,n),a=__prefix_348?__prefix_348+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function clearEvent(t,e){0==--t._eventsCount?t._events=new Events:delete t._events[e]}function __EventEmitter_348(){this._events=new Events,this._eventsCount=0}Object.create&&(Events.prototype=Object.create(null),(new Events).__proto__||(__prefix_348=!1)),__EventEmitter_348.prototype.eventNames=function(){var t,e,r=[];if(0===this._eventsCount)return r;for(e in t=this._events)__has_348.call(t,e)&&r.push(__prefix_348?e.slice(1):e);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},__EventEmitter_348.prototype.listeners=function(t){var e=__prefix_348?__prefix_348+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,n=r.length,o=new Array(n);i=e.priority)return void this._queue.push(r);const i=function(t,e,r){let i=0,n=t.length;for(;n>0;){const r=n/2|0;let a=i+r;o=t[a],e.priority-o.priority<=0?(i=++a,n-=r+1):n=r}var o;return i}(this._queue,r);this._queue.splice(i,0,r)}dequeue(){return this._queue.shift().run}get size(){return this._queue.length}}class PQueue extends _$eventemitter3_348{constructor(t){if(super(),!("number"==typeof(t=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:PriorityQueue},t)).concurrency&&t.concurrency>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t.concurrency}\` (${typeof t.concurrency})`);if(!("number"==typeof t.intervalCap&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap}\` (${typeof t.intervalCap})`);if(!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval}\` (${typeof t.interval})`);this._carryoverConcurrencyCount=t.carryoverConcurrencyCount,this._isIntervalIgnored=t.intervalCap===1/0||0===t.interval,this._intervalCount=0,this._intervalCap=t.intervalCap,this._interval=t.interval,this._intervalId=null,this._intervalEnd=0,this._timeoutId=null,this.queue=new t.queueClass,this._queueClass=t.queueClass,this._pendingCount=0,this._concurrency=t.concurrency,this._isPaused=!1===t.autoStart,this._resolveEmpty=()=>{},this._resolveIdle=()=>{}}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount{},0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=()=>{})}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=null}_intervalPaused(){const t=Date.now();if(null===this._intervalId){const e=this._intervalEnd-t;if(!(e<0))return null===this._timeoutId&&(this._timeoutId=setTimeout(()=>this._onResumeInterval(),e)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this.queue.size)return clearInterval(this._intervalId),this._intervalId=null,this._resolvePromises(),!1;if(!this._isPaused){const t=!this._intervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this.queue.dequeue()(),t&&this._initializeIntervalIfNeeded(),!0}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||null!==this._intervalId||(this._intervalId=setInterval(()=>this._onInterval(),this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){for(0===this._intervalCount&&0===this._pendingCount&&(clearInterval(this._intervalId),this._intervalId=null),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;this._tryToStartAnother(););}add(t,e){return new Promise((r,i)=>{this.queue.enqueue(()=>{this._pendingCount++,this._intervalCount++;try{Promise.resolve(t()).then(t=>{r(t),this._next()},t=>{i(t),this._next()})}catch(e){i(e),this._next()}},e),this._tryToStartAnother()})}addAll(t,e){return Promise.all(t.map(t=>this.add(t,e)))}start(){if(this._isPaused)for(this._isPaused=!1;this._tryToStartAnother(););}pause(){this._isPaused=!0}clear(){this.queue=new this._queueClass}onEmpty(){return 0===this.queue.size?Promise.resolve():new Promise(t=>{const e=this._resolveEmpty;this._resolveEmpty=()=>{e(),t()}})}onIdle(){return 0===this._pendingCount&&0===this.queue.size?Promise.resolve():new Promise(t=>{const e=this._resolveIdle;this._resolveIdle=()=>{e(),t()}})}get size(){return this.queue.size}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}}_$pQueue_386=PQueue,_$pQueue_386.default=PQueue;var _$retry_operation_429={};function RetryOperation(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}_$retry_operation_429=RetryOperation,RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},RetryOperation.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var i=this;return this._timer=setTimeout((function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout((function(){i._operationTimeoutCb(i._attempts)}),i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)}),r),this._options.unref&&this._timer.unref(),!0},RetryOperation.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},RetryOperation.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},RetryOperation.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},RetryOperation.prototype.start=RetryOperation.prototype.try,RetryOperation.prototype.errors=function(){return this._errors},RetryOperation.prototype.attempts=function(){return this._attempts},RetryOperation.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,i=0;i=r&&(e=n,r=a)}return e};var _$retry_428={operation:function(t){var e=_$retry_428.timeouts(t);return new _$retry_operation_429(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},timeouts:function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],n=0;nnew Promise((r,i)=>{e={onFailedAttempt:()=>{},retries:10,...e};const n=_$retry_427.operation(e);n.attempt(async o=>{try{r(await t(o))}catch(s){if(!(s instanceof Error))return void i(new TypeError(`Non-error was thrown: "${s}". You should only throw errors.`));if(s instanceof AbortError)n.stop(),i(s.originalError);else if(s instanceof TypeError&&(a=s.message,!networkErrorMsgs.includes(a)))n.stop(),i(s);else{((t,e,r)=>{const i=r.retries-(e-1);t.attemptNumber=e,t.retriesLeft=i})(s,o,e);try{await e.onFailedAttempt(s)}catch(s){return void i(s)}n.retry(s)||i(n.mainError())}}var a})});_$pRetry_387=pRetry,_$pRetry_387.default=pRetry,_$pRetry_387.AbortError=AbortError;var _$retryQueue_13=class{constructor(t={}){let e=1;this.attempts=5,this.retryPeriod=5e3,t.concurrency&&(e=t.concurrency),t.attempts&&(this.attempts=t.attempts),t.retryPeriod&&(this.retryPeriod=t.retryPeriod),this.validationQueue=new _$pQueue_386({concurrency:e}),this.pRetry=_$pRetry_387,this.addToQueue=this.addToQueue.bind(this),this.retryWrapper=this.retryWrapper.bind(this),this.handleValidationError=this.handleValidationError.bind(this)}async addToQueue(t,e){try{if(!t)throw new Error("function handler is required");if(!e)throw new Error("input object is required");return await this.validationQueue.add(()=>this.retryWrapper(t,e))}catch(err){throw console.error("Error in addToQueue(): ",err),err}}async retryWrapper(t,e){try{if(!t)throw new Error("function handler is required");if(!e)throw new Error("input object is required");return this.pRetry(async()=>await t(e),{onFailedAttempt:this.handleValidationError,retries:this.attempts})}catch(err){throw console.error("Error in retryWrapper(): ",err),err}}async handleValidationError(t){try{console.log("Error object: ",t);const e=`Attempt ${t.attemptNumber} failed. There are ${t.retriesLeft} retries left. Waiting before trying again.`;console.log(e);const r=this.retryPeriod;console.log(`Waiting ${r} milliseconds before trying again.\n`),await this.sleep(r)}catch(err){throw console.error("Error in handleValidationError()"),err}}sleep(t){return new Promise(e=>setTimeout(e,t))}},_$RetryQueue_12=_$retryQueue_13,_$consolidateUtxos_3=class{constructor(t){if(this.wallet=t,!this.wallet)throw new Error("Must pass an instance of the wallet.");this.bchjs=t.bchjs,this.retryQueue=new _$RetryQueue_12({attempts:3,retryPeriod:1e3}),this.start=this.start.bind(this),this.consolidateTokenUtxos=this.consolidateTokenUtxos.bind(this),this.countTokenUtxos=this.countTokenUtxos.bind(this),this.updateUtxos=this.updateUtxos.bind(this),this.countBchUtxos=this.countBchUtxos.bind(this)}async start(t={}){try{const e={},{dryRun:r}=t;return await this.retryQueue.addToQueue(this.updateUtxos,{}),e.bchUtxoCnt=this.countBchUtxos(),e.bchTxid=null,e.bchUtxoCnt>1&&!r&&(e.bchTxid=await this.retryQueue.addToQueue(this.wallet.sendAll,this.wallet.walletInfo.cashAddress),await this.bchjs.Util.sleep(3e3),await this.retryQueue.addToQueue(this.updateUtxos,{})),e.tokenUtxos=this.countTokenUtxos(),e.tokenTxids=[],r||(e.tokenTxids=await this.retryQueue.addToQueue(this.consolidateTokenUtxos,e.tokenUtxos)),e}catch(err){throw console.error("Error in conslidate-utxos.js/start()"),err}}async consolidateTokenUtxos(t){const e=[];for(let r=0;r1){const t={address:this.wallet.walletInfo.cashAddress,tokenId:i.tokenId,qty:i.qty},r=await this.wallet.sendTokens(t);e.push(r),await this.bchjs.Util.sleep(3e3),await this.updateUtxos()}}return e}countTokenUtxos(){const t=this.wallet.utxos.utxoStore.slpUtxos.type1.tokens,e=this.wallet.tokens.listTokensFromUtxos(t),r=[];for(let i=0;i