!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("WalletConnectProvider",[],e):"object"==typeof exports?exports.WalletConnectProvider=e():t.WalletConnectProvider=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=165)}([function(t,e,r){"use strict";(function(t){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.removeHexLeadingZeros=e.sanitizeHex=e.addHexPrefix=e.removeHexPrefix=e.padRight=e.padLeft=e.sanitizeBytes=e.swapHex=e.swapBytes=e.splitBytes=e.calcByteLength=e.trimRight=e.trimLeft=e.concatArrays=e.concatBuffers=e.getEncoding=e.getType=e.isArrayBuffer=e.isTypedArray=e.isBuffer=e.isHexString=e.isBinaryString=e.binaryToNumber=e.binaryToUtf8=e.binaryToHex=e.binaryToArray=e.binaryToBuffer=e.numberToBinary=e.numberToUtf8=e.numberToHex=e.numberToArray=e.numberToBuffer=e.utf8ToBinary=e.utf8ToNumber=e.utf8ToHex=e.utf8ToArray=e.utf8ToBuffer=e.hexToBinary=e.hexToNumber=e.hexToUtf8=e.hexToArray=e.hexToBuffer=e.arrayToBinary=e.arrayToNumber=e.arrayToUtf8=e.arrayToHex=e.arrayToBuffer=e.bufferToBinary=e.bufferToNumber=e.bufferToUtf8=e.bufferToHex=e.bufferToArray=void 0;const i=n(r(79)),o=n(r(170));function s(t){return new Uint8Array(t)}function a(t,e=!1){const r=t.toString("hex");return e?L(r):r}function u(t){return t.toString("utf8")}function c(t){return t.readUIntBE(0,t.length)}function f(t){return o.default(t)}function h(t,e=!1){return a(f(t),e)}function l(t){return u(f(t))}function d(t){return c(f(t))}function p(t){return Array.from(t).map(_).join("")}function m(e){return t.from(B(e),"hex")}function g(t){return s(m(t))}function b(t){return p(g(t))}function y(e){return t.from(e,"utf8")}function v(t){return s(y(t))}function _(t){return P((t>>>0).toString(2))}function w(t){return f(M(t))}function M(t){return new Uint8Array(C(t).map(t=>parseInt(t,2)))}function S(t,e){return h(M(t),e)}function x(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}function E(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}function k(e){return t.isBuffer(e)}function A(t){return i.default.strict(t)&&!k(t)}function R(t){return!A(t)&&!k(t)&&void 0!==t.byteLength}function T(t,e=8){const r=t%e;return r?(t-r)/e*e+e:t}function C(t,e=8){const r=P(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(r||[])}function O(t){return C(t).map(j).join("")}function P(t,e=8,r="0"){return I(t,T(t.length,e),r)}function I(t,e,r="0"){return N(t,e,!0,r)}function B(t){return t.replace(/^0x/,"")}function L(t){return t.startsWith("0x")?t:"0x"+t}function j(t){return t.split("").reverse().join("")}function N(t,e,r,n="0"){const i=e-t.length;let o=t;if(i>0){const e=n.repeat(i);o=r?e+t:t+e}return o}e.bufferToArray=s,e.bufferToHex=a,e.bufferToUtf8=u,e.bufferToNumber=c,e.bufferToBinary=function(t){return p(s(t))},e.arrayToBuffer=f,e.arrayToHex=h,e.arrayToUtf8=l,e.arrayToNumber=d,e.arrayToBinary=p,e.hexToBuffer=m,e.hexToArray=g,e.hexToUtf8=function(t){return u(m(t))},e.hexToNumber=function(t){return d(g(t))},e.hexToBinary=b,e.utf8ToBuffer=y,e.utf8ToArray=v,e.utf8ToHex=function(t,e=!1){return a(y(t),e)},e.utf8ToNumber=function(t){const e=parseInt(t,10);return function(t,e){if(!t)throw new Error(e)}(!function(t){return void 0===t}(e),"Number can only safely store up to 53 bits"),e},e.utf8ToBinary=function(t){return p(v(t))},e.numberToBuffer=function(t){return w(_(t))},e.numberToArray=function(t){return M(_(t))},e.numberToHex=function(t,e){return S(_(t),e)},e.numberToUtf8=function(t){return""+t},e.numberToBinary=_,e.binaryToBuffer=w,e.binaryToArray=M,e.binaryToHex=S,e.binaryToUtf8=function(t){return l(M(t))},e.binaryToNumber=function(t){return d(M(t))},e.isBinaryString=x,e.isHexString=E,e.isBuffer=k,e.isTypedArray=A,e.isArrayBuffer=R,e.getType=function(t){return k(t)?"buffer":A(t)?"typed-array":R(t)?"array-buffer":Array.isArray(t)?"array":typeof t},e.getEncoding=function(t){return x(t)?"binary":E(t)?"hex":"utf8"},e.concatBuffers=function(...e){return t.concat(e)},e.concatArrays=function(...t){let e=[];return t.forEach(t=>e=e.concat(Array.from(t))),new Uint8Array([...e])},e.trimLeft=function(t,e){const r=t.length-e;return r>0&&(t=t.slice(r)),t},e.trimRight=function(t,e){return t.slice(0,e)},e.calcByteLength=T,e.splitBytes=C,e.swapBytes=O,e.swapHex=function(t){return S(O(b(t)))},e.sanitizeBytes=P,e.padLeft=I,e.padRight=function(t,e,r="0"){return N(t,e,!1,r)},e.removeHexPrefix=B,e.addHexPrefix=L,e.sanitizeHex=function(t){return(t=P(t=B(t),2))&&(t=L(t)),t},e.removeHexLeadingZeros=function(t){const e=t.startsWith("0x");return t=(t=B(t)).startsWith("0")?t.substring(1):t,e?L(t):t}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";r.r(e);var n=r(76);const i=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],o=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],s=["eth_accounts","eth_chainId","net_version"],a={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var u=r(9),c=r.n(u),f=r(0);function h(t){return f.arrayToBuffer(new Uint8Array(t))}function l(t){return f.arrayToUtf8(new Uint8Array(t))}function d(t,e){return f.arrayToHex(new Uint8Array(t),!e)}function p(t){return f.arrayToNumber(new Uint8Array(t))}function m(...t){return f.hexToArray(t.map(t=>f.arrayToHex(new Uint8Array(t))).join("")).buffer}function g(t){return f.bufferToArray(t).buffer}function b(t){return f.bufferToUtf8(t)}function y(t,e){return f.bufferToHex(t,!e)}function v(t){return f.bufferToNumber(t)}function _(...t){return f.concatBuffers(...t)}function w(t){return f.utf8ToArray(t).buffer}function M(t){return f.utf8ToBuffer(t)}function S(t,e){return f.utf8ToHex(t,!e)}function x(t){return new c.a(t,10).toNumber()}function E(t){return f.hexToBuffer(t)}function k(t){return f.hexToArray(t).buffer}function A(t){return f.hexToUtf8(t)}function R(t){return new c.a(f.removeHexPrefix(t),"hex").toNumber()}function T(t){return f.numberToBuffer(t)}function C(t){return f.numberToArray(t).buffer}function O(t){return new c.a(t).toString()}function P(t,e){const r=f.removeHexPrefix(f.sanitizeHex(new c.a(t).toString(16)));return e?r:f.addHexPrefix(r)}var I=r(159);function B(t){return f.sanitizeHex(t)}function L(t){return f.addHexPrefix(t)}function j(t){return f.removeHexPrefix(t)}function N(t){return f.removeHexLeadingZeros(f.addHexPrefix(t))}const q=r(160).payloadId;function U(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function D(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function H(t,e){let r;const n=a[t];return n&&(r=`https://${n}.infura.io/v3/${e}`),r}function z(t,e){let r;const n=H(t,e.infuraId);return e.custom&&e.custom[t]?r=e.custom[t]:n&&(r=n),r}function F(t){return""===t||"string"==typeof t&&""===t.trim()}function W(t){return!(t&&t.length)}function K(t){return f.isBuffer(t)}function V(t){return f.isTypedArray(t)}function J(t){return f.isArrayBuffer(t)}function Z(t){return f.getType(t)}function G(t){return f.getEncoding(t)}function Y(t,e){return f.isHexString(t,e)}function $(t){return"object"==typeof t.params}function X(t){return void 0!==t.method}function Q(t){return void 0!==t.result}function tt(t){return void 0!==t.error}function et(t){return void 0!==t.event}function rt(t){return i.includes(t)||t.startsWith("wc_")}function nt(t){return!!t.method.startsWith("wc_")||!o.includes(t.method)}function it(t){t=Object(f.removeHexPrefix)(t.toLowerCase());const e=Object(f.removeHexPrefix)(Object(I.keccak_256)(M(t)));let r="";for(let n=0;n7?r+=t[n].toUpperCase():r+=t[n];return Object(f.addHexPrefix)(r)}const ot=t=>!!t&&("0x"===t.toLowerCase().substring(0,2)&&(!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t))||t===it(t))));function st(t){return W(t)||Y(t[0])||(t[0]=S(t[0])),t}function at(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!ot(t.from))throw new Error("Transaction object must include a valid 'from' value.");function e(t){let e=t;return("number"==typeof t||"string"==typeof t&&!F(t))&&(Y(t)?"string"==typeof t&&(e=B(t)):e=P(t)),"string"==typeof e&&(e=N(e)),e}const r={from:B(t.from),to:void 0===t.to?"":B(t.to),gasPrice:void 0===t.gasPrice?"":e(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":e(t.gasLimit):e(t.gas),value:void 0===t.value?"":e(t.value),nonce:void 0===t.nonce?"":e(t.nonce),data:void 0===t.data?"":B(t.data)||"0x"},n=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach(t=>{!r[t].trim().length&&n.includes(t)&&delete r[t]}),r}function ut(t,e){return async(...r)=>new Promise((n,i)=>{t.apply(e,[...r,(t,e)=>{null==t&&i(t),n(e)}])})}function ct(t){const e=t.message||"Failed or Rejected Request";let r=-32e3;if(t&&!t.code)switch(e){case"Parse error":r=-32700;break;case"Invalid request":r=-32600;break;case"Method not found":r=-32601;break;case"Invalid params":r=-32602;break;case"Internal error":r=-32603;break;default:r=-32e3}return{code:r,message:e}}var ft=r(77);function ht(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function lt(t,e){let r=dt(t);return r=Object.assign(Object.assign({},r),e),t=pt(r)}function dt(t){return ft.parse(t)}function pt(t){return ft.stringify(t)}function mt(t){return void 0!==t.bridge}function gt(t){const e=t.indexOf(":"),r=-1!==t.indexOf("?")?t.indexOf("?"):void 0,n=t.substring(0,e);const i=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,r));const o=function(t){const e=dt(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==r?t.substr(r):"");return Object.assign(Object.assign({protocol:n},i),o)}r.d(e,"detectEnv",(function(){return n.detectEnv})),r.d(e,"detectOS",(function(){return n.detectOS})),r.d(e,"isAndroid",(function(){return n.isAndroid})),r.d(e,"isIOS",(function(){return n.isIOS})),r.d(e,"isMobile",(function(){return n.isMobile})),r.d(e,"isNode",(function(){return n.isNode})),r.d(e,"isBrowser",(function(){return n.isBrowser})),r.d(e,"getFromWindow",(function(){return n.getFromWindow})),r.d(e,"getFromWindowOrThrow",(function(){return n.getFromWindowOrThrow})),r.d(e,"getDocumentOrThrow",(function(){return n.getDocumentOrThrow})),r.d(e,"getDocument",(function(){return n.getDocument})),r.d(e,"getNavigatorOrThrow",(function(){return n.getNavigatorOrThrow})),r.d(e,"getNavigator",(function(){return n.getNavigator})),r.d(e,"getLocationOrThrow",(function(){return n.getLocationOrThrow})),r.d(e,"getLocation",(function(){return n.getLocation})),r.d(e,"getCryptoOrThrow",(function(){return n.getCryptoOrThrow})),r.d(e,"getCrypto",(function(){return n.getCrypto})),r.d(e,"getLocalStorageOrThrow",(function(){return n.getLocalStorageOrThrow})),r.d(e,"getLocalStorage",(function(){return n.getLocalStorage})),r.d(e,"getClientMeta",(function(){return n.getClientMeta})),r.d(e,"safeJsonParse",(function(){return n.safeJsonParse})),r.d(e,"safeJsonStringify",(function(){return n.safeJsonStringify})),r.d(e,"setLocal",(function(){return n.setLocal})),r.d(e,"getLocal",(function(){return n.getLocal})),r.d(e,"removeLocal",(function(){return n.removeLocal})),r.d(e,"mobileLinkChoiceKey",(function(){return n.mobileLinkChoiceKey})),r.d(e,"formatIOSMobile",(function(){return n.formatIOSMobile})),r.d(e,"saveMobileLinkInfo",(function(){return n.saveMobileLinkInfo})),r.d(e,"getMobileRegistryEntry",(function(){return n.getMobileRegistryEntry})),r.d(e,"getMobileLinkRegistry",(function(){return n.getMobileLinkRegistry})),r.d(e,"getWalletRegistryUrl",(function(){return n.getWalletRegistryUrl})),r.d(e,"getDappRegistryUrl",(function(){return n.getDappRegistryUrl})),r.d(e,"getAppLogoUrl",(function(){return n.getAppLogoUrl})),r.d(e,"formatMobileRegistryEntry",(function(){return n.formatMobileRegistryEntry})),r.d(e,"formatMobileRegistry",(function(){return n.formatMobileRegistry})),r.d(e,"reservedEvents",(function(){return i})),r.d(e,"signingMethods",(function(){return o})),r.d(e,"stateMethods",(function(){return s})),r.d(e,"infuraNetworks",(function(){return a})),r.d(e,"convertArrayBufferToBuffer",(function(){return h})),r.d(e,"convertArrayBufferToUtf8",(function(){return l})),r.d(e,"convertArrayBufferToHex",(function(){return d})),r.d(e,"convertArrayBufferToNumber",(function(){return p})),r.d(e,"concatArrayBuffers",(function(){return m})),r.d(e,"convertBufferToArrayBuffer",(function(){return g})),r.d(e,"convertBufferToUtf8",(function(){return b})),r.d(e,"convertBufferToHex",(function(){return y})),r.d(e,"convertBufferToNumber",(function(){return v})),r.d(e,"concatBuffers",(function(){return _})),r.d(e,"convertUtf8ToArrayBuffer",(function(){return w})),r.d(e,"convertUtf8ToBuffer",(function(){return M})),r.d(e,"convertUtf8ToHex",(function(){return S})),r.d(e,"convertUtf8ToNumber",(function(){return x})),r.d(e,"convertHexToBuffer",(function(){return E})),r.d(e,"convertHexToArrayBuffer",(function(){return k})),r.d(e,"convertHexToUtf8",(function(){return A})),r.d(e,"convertHexToNumber",(function(){return R})),r.d(e,"convertNumberToBuffer",(function(){return T})),r.d(e,"convertNumberToArrayBuffer",(function(){return C})),r.d(e,"convertNumberToUtf8",(function(){return O})),r.d(e,"convertNumberToHex",(function(){return P})),r.d(e,"toChecksumAddress",(function(){return it})),r.d(e,"isValidAddress",(function(){return ot})),r.d(e,"parsePersonalSign",(function(){return st})),r.d(e,"parseTransactionData",(function(){return at})),r.d(e,"sanitizeHex",(function(){return B})),r.d(e,"addHexPrefix",(function(){return L})),r.d(e,"removeHexPrefix",(function(){return j})),r.d(e,"removeHexLeadingZeros",(function(){return N})),r.d(e,"payloadId",(function(){return q})),r.d(e,"uuid",(function(){return U})),r.d(e,"logDeprecationWarning",(function(){return D})),r.d(e,"getInfuraRpcUrl",(function(){return H})),r.d(e,"getRpcUrl",(function(){return z})),r.d(e,"promisify",(function(){return ut})),r.d(e,"formatRpcError",(function(){return ct})),r.d(e,"isWalletConnectSession",(function(){return mt})),r.d(e,"parseWalletConnectUri",(function(){return gt})),r.d(e,"getQueryString",(function(){return ht})),r.d(e,"appendToQueryString",(function(){return lt})),r.d(e,"parseQueryString",(function(){return dt})),r.d(e,"formatQueryString",(function(){return pt})),r.d(e,"isEmptyString",(function(){return F})),r.d(e,"isEmptyArray",(function(){return W})),r.d(e,"isBuffer",(function(){return K})),r.d(e,"isTypedArray",(function(){return V})),r.d(e,"isArrayBuffer",(function(){return J})),r.d(e,"getType",(function(){return Z})),r.d(e,"getEncoding",(function(){return G})),r.d(e,"isHexString",(function(){return Y})),r.d(e,"isJsonRpcSubscription",(function(){return $})),r.d(e,"isJsonRpcRequest",(function(){return X})),r.d(e,"isJsonRpcResponseSuccess",(function(){return Q})),r.d(e,"isJsonRpcResponseError",(function(){return tt})),r.d(e,"isInternalEvent",(function(){return et})),r.d(e,"isReservedEvent",(function(){return rt})),r.d(e,"isSilentPayload",(function(){return nt}))},function(t,e,r){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var n=r(168),i=r(169),o=r(78);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return D(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 T(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var h=!0,l=0;li&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function k(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+h<=r)switch(h){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),f=t.slice(e,r),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function I(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,o){return o||L(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,o){return o||L(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=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 H(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(6))},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";r.d(e,"b",(function(){return 256})),r.d(e,"g",(function(){return 256})),r.d(e,"a",(function(){return"AES-CBC"})),r.d(e,"f",(function(){return"SHA-256"})),r.d(e,"e",(function(){return"HMAC"})),r.d(e,"i",(function(){return"SHA-256"})),r.d(e,"j",(function(){return"SHA-512"})),r.d(e,"h",(function(){return 512})),r.d(e,"d",(function(){return"encrypt"})),r.d(e,"c",(function(){return"decrypt"})),r.d(e,"k",(function(){return"sign"})),r.d(e,"l",(function(){return"verify"}))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,c=[],f=!1,h=-1;function l(){f&&u&&(f=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!f){var t=a(l);f=!0;for(var e=c.length;e;){for(u=c,c=[];++h1)for(var r=1;r=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=a(t,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=a(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var 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"],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],h=[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 n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(s=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&s}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.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 l=f[t],d=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:c[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.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>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),c[a]=s;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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.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)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);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()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);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,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.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,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],b=8191&g,y=g>>>13,v=0|s[3],_=8191&v,w=v>>>13,M=0|s[4],S=8191&M,x=M>>>13,E=0|s[5],k=8191&E,A=E>>>13,R=0|s[6],T=8191&R,C=R>>>13,O=0|s[7],P=8191&O,I=O>>>13,B=0|s[8],L=8191&B,j=B>>>13,N=0|s[9],q=8191&N,U=N>>>13,D=0|a[0],H=8191&D,z=D>>>13,F=0|a[1],W=8191&F,K=F>>>13,V=0|a[2],J=8191&V,Z=V>>>13,G=0|a[3],Y=8191&G,$=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ft=0|a[8],ht=8191&ft,lt=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(h,H))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(l,H)|0))<<13)|0;c=((o=Math.imul(l,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(m,H)|0,o=Math.imul(m,z);var bt=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(l,W)|0))<<13)|0;c=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(y,H)|0,o=Math.imul(y,z),n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var yt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(_,H),i=(i=Math.imul(_,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,W)|0,o=o+Math.imul(y,K)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var vt=(c+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(l,Y)|0))<<13)|0;c=((o=o+Math.imul(l,$)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(x,H)|0,o=Math.imul(x,z),n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,K)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,$)|0;var _t=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(k,H),i=(i=Math.imul(k,z))+Math.imul(A,H)|0,o=Math.imul(A,z),n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Z)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var wt=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(l,rt)|0))<<13)|0;c=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(T,H),i=(i=Math.imul(T,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(c+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(I,H)|0,o=Math.imul(I,z),n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(c+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,H),i=(i=Math.imul(L,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,K)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var xt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(q,H),i=(i=Math.imul(q,z))+Math.imul(U,H)|0,o=Math.imul(U,z),n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,$)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Et=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(q,W),i=(i=Math.imul(q,K))+Math.imul(U,W)|0,o=Math.imul(U,K),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,Z)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Z)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,lt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,lt)|0;var kt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(q,J),i=(i=Math.imul(q,Z))+Math.imul(U,J)|0,o=Math.imul(U,Z),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,$)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,lt)|0;var At=(c+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(q,Y),i=(i=Math.imul(q,$))+Math.imul(U,Y)|0,o=Math.imul(U,$),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,lt)|0;var Rt=(c+(n=n+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(q,Q),i=(i=Math.imul(q,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(k,ht)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,lt)|0;var Tt=(c+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(q,rt),i=(i=Math.imul(q,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,n=n+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,lt)|0;var Ct=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(q,ot),i=(i=Math.imul(q,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,ct)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var Ot=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(q,ut),i=(i=Math.imul(q,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,lt)|0;var Pt=(c+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(q,ht),i=(i=Math.imul(q,lt))+Math.imul(U,ht)|0,o=Math.imul(U,lt);var It=(c+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(j,pt)|0))<<13)|0;c=((o=o+Math.imul(j,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Bt=(c+(n=Math.imul(q,pt))|0)+((8191&(i=(i=Math.imul(q,mt))+Math.imul(U,pt)|0))<<13)|0;return c=((o=Math.imul(U,mt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=gt,u[1]=bt,u[2]=yt,u[3]=vt,u[4]=_t,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=xt,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Rt,u[13]=Tt,u[14]=Ct,u[15]=Ot,u[16]=Pt,u[17]=It,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=l),o.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 n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),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)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):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&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);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},o.prototype.idivn=function(t){n(t<=67108863);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()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.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 n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},b.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 n=e0?r.isub(this.p):r.strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},i(y,b),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&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]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new v;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return g[t]=e,e},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},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();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var h=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===f)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},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},o.mont=function(t){return new S(t)},i(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(25)(t))},function(t,e,r){"use strict";function n(t){let e=void 0;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function i(t){const e=n(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=n,e.getFromWindowOrThrow=i,e.getDocumentOrThrow=function(){return i("document")},e.getDocument=function(){return n("document")},e.getNavigatorOrThrow=function(){return i("navigator")},e.getNavigator=function(){return n("navigator")},e.getLocationOrThrow=function(){return i("location")},e.getLocation=function(){return n("location")},e.getCryptoOrThrow=function(){return i("crypto")},e.getCrypto=function(){return n("crypto")},e.getLocalStorageOrThrow=function(){return i("localStorage")},e.getLocalStorage=function(){return n("localStorage")}},function(t,e,r){"use strict";var n=e,i=r(16),o=r(22),s=r(120);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),s=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(s),a=0==(1&c)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}b(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&b(t,"error",e,r)}(t,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,r,n){var i,o,s,a;if(c(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),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=f(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function l(){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)}function d(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function p(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,f=g(u,c);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e,r){var n=r(2),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return a})),r.d(e,"c",(function(){return u})),r.d(e,"d",(function(){return c})),r.d(e,"e",(function(){return f})),r.d(e,"f",(function(){return h}));var n=r(8),i=r(4);async function o(t,e=i.a){return n.getSubtleCrypto().importKey("raw",t,function(t){return t===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(e),!0,function(t){return t===i.a?[i.d,i.c]:[i.k,i.l]}(e))}async function s(t,e,r){const s=n.getSubtleCrypto(),a=await o(e,i.a),u=await s.encrypt({iv:t,name:i.a},a,r);return new Uint8Array(u)}async function a(t,e,r){const s=n.getSubtleCrypto(),a=await o(e,i.a),u=await s.decrypt({iv:t,name:i.a},a,r);return new Uint8Array(u)}async function u(t,e){const r=n.getSubtleCrypto(),s=await o(t,i.e),a=await r.sign({length:i.g,name:i.e},s,e);return new Uint8Array(a)}async function c(t,e){const r=n.getSubtleCrypto(),s=await o(t,i.e),a=await r.sign({length:i.h,name:i.e},s,e);return new Uint8Array(a)}async function f(t){const e=n.getSubtleCrypto(),r=await e.digest({name:i.i},t);return new Uint8Array(r)}async function h(t){const e=n.getSubtleCrypto(),r=await e.digest({name:i.j},t);return new Uint8Array(r)}},function(t,e,r){"use strict";var n=r(22),i=r(3);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(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}e.inherits=i,e.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),i=0;i>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,c=e;return u+=(c=c+n>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,c){var f=0,h=e;return f+=(h=h+n>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,c){return e+n+o+a+c>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){(function(t){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.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 s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(245).Buffer}catch(t){}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 u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","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],l=[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 d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(s=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&s}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?f[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.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],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.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>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,c=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),c[a]=s;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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.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)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);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()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);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,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.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,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],b=8191&g,y=g>>>13,v=0|s[3],_=8191&v,w=v>>>13,M=0|s[4],S=8191&M,x=M>>>13,E=0|s[5],k=8191&E,A=E>>>13,R=0|s[6],T=8191&R,C=R>>>13,O=0|s[7],P=8191&O,I=O>>>13,B=0|s[8],L=8191&B,j=B>>>13,N=0|s[9],q=8191&N,U=N>>>13,D=0|a[0],H=8191&D,z=D>>>13,F=0|a[1],W=8191&F,K=F>>>13,V=0|a[2],J=8191&V,Z=V>>>13,G=0|a[3],Y=8191&G,$=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ft=0|a[8],ht=8191&ft,lt=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(h,H))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(l,H)|0))<<13)|0;c=((o=Math.imul(l,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(m,H)|0,o=Math.imul(m,z);var bt=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(l,W)|0))<<13)|0;c=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(y,H)|0,o=Math.imul(y,z),n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var yt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(_,H),i=(i=Math.imul(_,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,W)|0,o=o+Math.imul(y,K)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var vt=(c+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(l,Y)|0))<<13)|0;c=((o=o+Math.imul(l,$)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(x,H)|0,o=Math.imul(x,z),n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,K)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,$)|0;var _t=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(k,H),i=(i=Math.imul(k,z))+Math.imul(A,H)|0,o=Math.imul(A,z),n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Z)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var wt=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(l,rt)|0))<<13)|0;c=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(T,H),i=(i=Math.imul(T,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(c+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(I,H)|0,o=Math.imul(I,z),n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(c+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,H),i=(i=Math.imul(L,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,K)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var xt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(q,H),i=(i=Math.imul(q,z))+Math.imul(U,H)|0,o=Math.imul(U,z),n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,$)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Et=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(q,W),i=(i=Math.imul(q,K))+Math.imul(U,W)|0,o=Math.imul(U,K),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,Z)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Z)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,lt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,lt)|0;var kt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(q,J),i=(i=Math.imul(q,Z))+Math.imul(U,J)|0,o=Math.imul(U,Z),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,$)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,lt)|0;var At=(c+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(q,Y),i=(i=Math.imul(q,$))+Math.imul(U,Y)|0,o=Math.imul(U,$),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,lt)|0;var Rt=(c+(n=n+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(q,Q),i=(i=Math.imul(q,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(k,ht)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,lt)|0;var Tt=(c+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(q,rt),i=(i=Math.imul(q,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,n=n+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,lt)|0;var Ct=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(q,ot),i=(i=Math.imul(q,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,ct)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var Ot=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(q,ut),i=(i=Math.imul(q,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,lt)|0;var Pt=(c+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(q,ht),i=(i=Math.imul(q,lt))+Math.imul(U,ht)|0,o=Math.imul(U,lt);var It=(c+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(j,pt)|0))<<13)|0;c=((o=o+Math.imul(j,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Bt=(c+(n=Math.imul(q,pt))|0)+((8191&(i=(i=Math.imul(q,mt))+Math.imul(U,pt)|0))<<13)|0;return c=((o=Math.imul(U,mt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=gt,u[1]=bt,u[2]=yt,u[3]=vt,u[4]=_t,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=xt,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Rt,u[13]=Tt,u[14]=Ct,u[15]=Ot,u[16]=Pt,u[17]=It,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),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)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):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&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);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},o.prototype.idivn=function(t){n(t<=67108863);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()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.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 n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.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 n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(v,y),v.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},v.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]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new _;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return b[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},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();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var h=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===f)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},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},o.mont=function(t){return new x(t)},i(x,S),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(25)(t))},function(t,e){var r,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return n[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');r=t},e.isKanjiModeEnabled=function(){return void 0!==r},e.toSJIS=function(t){return r(t)}},function(t,e,r){var n=r(99),i=r(100);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!n.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return r}}},function(t,e,r){"use strict";var n=r(43),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var o=Object.create(r(35));o.inherits=r(3);var s=r(105),a=r(53);o.inherits(h,s);for(var u=i(a.prototype),c=0;c>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,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(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 u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=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 c(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 f(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 h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.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)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.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}},function(t,e,r){(function(t){var n=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(r)?n.showHidden=r:r&&e._extend(n,r),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),f(n,t,n.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function c(t,e){return t}function f(t,r,n){if(t.customInspect&&r&&S(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return b(i)||(i=f(t,i,n)),i}var o=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(g(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(o)return o;var s=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),M(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(r);if(0===s.length){if(S(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(v(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return t.stylize(Date.prototype.toString.call(r),"date");if(M(r))return h(r)}var c,_="",x=!1,E=["{","}"];(d(r)&&(x=!0,E=["[","]"]),S(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),M(r)&&(_=" "+h(r)),0!==s.length||x&&0!=r.length?n<0?v(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),c=x?function(t,e,r,n,i){for(var o=[],s=0,a=e.length;s=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,_,E)):E[0]+_+E[1]}function h(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),R(n,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?f(t,u.value,null):f(t,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),y(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return"number"==typeof t}function b(t){return"string"==typeof t}function y(t){return void 0===t}function v(t){return _(t)&&"[object RegExp]"===x(t)}function _(t){return"object"==typeof t&&null!==t}function w(t){return _(t)&&"[object Date]"===x(t)}function M(t){return _(t)&&("[object Error]"===x(t)||t instanceof Error)}function S(t){return"function"==typeof t}function x(t){return Object.prototype.toString.call(t)}function E(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(o)&&(o=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=t.pid;s[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,n,t)}}else s[r]=function(){};return s[r]},e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=g,e.isString=b,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=v,e.isObject=_,e.isDate=w,e.isError=M,e.isFunction=S,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(225);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(){var t=new Date,e=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":");return[t.getDate(),k[t.getMonth()],e].join(" ")}function R(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",A(),e.format.apply(e,arguments))},e.inherits=r(226),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var T="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function C(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(T&&t[T]){var e;if("function"!=typeof(e=t[T]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,T,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),i=[],o=0;oe.code===t);return e||n.e[n.a]}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";var n=r(50);o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var i=o.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function o(t,e,r){return o.TYPED_ARRAY_SUPPORT||this instanceof o?"number"==typeof t?u(this,t):function(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer)return function(t,e,r,n){if(r<0||e.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function a(t,e){var r;return o.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e)).__proto__=o.prototype:(null===(r=t)&&(r=new o(e)),r.length=e),r}function u(t,e){var r=a(t,e<0?0:0|s(e));if(!o.TYPED_ARRAY_SUPPORT)for(var n=0;n55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=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 h(t){return o.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:f(t).length)}o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),o.prototype.write=function(t,e,r){void 0===e||void 0===r&&"string"==typeof e?(r=this.length,e=0):isFinite(e)&&(e|=0,isFinite(r)?r|=0: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");return function(t,e,r,n){return function(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}(f(e,t.length-r),t,r,n)}(this,t,e,r)},o.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i2?"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))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,s,a;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(u," ").concat(n," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var i=r(112),o=r(116);r(3)(c,i);for(var s=n(o.prototype),a=0;a2?"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))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,i,s,a;if("string"==typeof e&&(i="not ",e.substr(!s||s<0?0:+s,i.length)===i)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(n," ").concat(o(e,"type"));else{var u=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(u," ").concat(n," ").concat(o(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var i=r(128),o=r(132);r(3)(c,i);for(var s=n(o.prototype),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 n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e,r){"use strict";(function(e){var n=r(136),i=r(293);function o(t){var e=t;if("string"!=typeof e)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof e+", while padToEven.");return e.length%2&&(e="0"+e),e}function s(t){return"0x"+t.toString(16)}t.exports={arrayContainsArray:function(t,e,r){if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof t+"'");if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof e+"'");return e[Boolean(r)?"some":"every"]((function(e){return t.indexOf(e)>=0}))},intToBuffer:function(t){var r=s(t);return new e(o(r.slice(2)),"hex")},getBinarySize:function(t){if("string"!=typeof t)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof t+"'.");return e.byteLength(t,"utf8")},isHexPrefixed:n,stripHexPrefix:i,padToEven:o,intToHex:s,fromAscii:function(t){for(var e="",r=0;r0&&"0"===r.toString();)r=(t=t.slice(1))[0];return t},e.toBuffer=function(t){if(!p.isBuffer(t))if(Array.isArray(t))t=p.from(t);else if("string"==typeof t)t=e.isHexString(t)?p.from(e.padToEven(e.stripHexPrefix(t)),"hex"):p.from(t);else if("number"==typeof t)t=e.intToBuffer(t);else if(null==t)t=p.allocUnsafe(0);else if(l.isBN(t))t=t.toArrayLike(p);else{if(!t.toArray)throw new Error("invalid type");t=p.from(t.toArray())}return t},e.bufferToInt=function(t){return new l(e.toBuffer(t)).toNumber()},e.bufferToHex=function(t){return"0x"+(t=e.toBuffer(t)).toString("hex")},e.fromSigned=function(t){return new l(t).fromTwos(256)},e.toUnsigned=function(t){return p.from(t.toTwos(256).toArray())},e.keccak=function(t,r){switch(t=e.toBuffer(t),r||(r=256),r){case 224:return o(t);case 256:return a(t);case 384:return s(t);case 512:return u(t);default:throw new Error("Invald algorithm: keccak"+r)}},e.keccak256=function(t){return e.keccak(t)},e.sha3=e.keccak,e.sha256=function(t){return t=e.toBuffer(t),d("sha256").update(t).digest()},e.ripemd160=function(t,r){t=e.toBuffer(t);var n=d("rmd160").update(t).digest();return!0===r?e.setLength(n,32):n},e.rlphash=function(t){return e.keccak(h.encode(t))},e.isValidPrivate=function(t){return c.privateKeyVerify(t)},e.isValidPublic=function(t,e){return 64===t.length?c.publicKeyVerify(p.concat([p.from([4]),t])):!!e&&c.publicKeyVerify(t)},e.pubToAddress=e.publicToAddress=function(t,r){return t=e.toBuffer(t),r&&64!==t.length&&(t=c.publicKeyConvert(t,!1).slice(1)),f(64===t.length),e.keccak(t).slice(-20)};var m=e.privateToPublic=function(t){return t=e.toBuffer(t),c.publicKeyCreate(t,!1).slice(1)};e.importPublic=function(t){return 64!==(t=e.toBuffer(t)).length&&(t=c.publicKeyConvert(t,!1).slice(1)),t},e.ecsign=function(t,e){var r=c.sign(t,e),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},e.hashPersonalMessage=function(t){var r=e.toBuffer("Ethereum Signed Message:\n"+t.length.toString());return e.keccak(p.concat([r,t]))},e.ecrecover=function(t,r,n,i){var o=p.concat([e.setLength(n,32),e.setLength(i,32)],64),s=r-27;if(0!==s&&1!==s)throw new Error("Invalid signature v value");var a=c.recover(t,o,s);return c.publicKeyConvert(a,!1).slice(1)},e.toRpcSig=function(t,r,n){if(27!==t&&28!==t)throw new Error("Invalid recovery id");return e.bufferToHex(p.concat([e.setLengthLeft(r,32),e.setLengthLeft(n,32),e.toBuffer(t-27)]))},e.fromRpcSig=function(t){if(65!==(t=e.toBuffer(t)).length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},e.privateToAddress=function(t){return e.publicToAddress(m(t))},e.isValidAddress=function(t){return/^0x[0-9a-fA-F]{40}$/.test(t)},e.isZeroAddress=function(t){return e.zeroAddress()===e.addHexPrefix(t)},e.toChecksumAddress=function(t){t=e.stripHexPrefix(t).toLowerCase();for(var r=e.keccak(t).toString("hex"),n="0x",i=0;i=8?n+=t[i].toUpperCase():n+=t[i];return n},e.isValidChecksumAddress=function(t){return e.isValidAddress(t)&&e.toChecksumAddress(t)===t},e.generateAddress=function(t,r){return t=e.toBuffer(t),r=(r=new l(r)).isZero()?null:p.from(r.toArray()),e.rlphash([t,r]).slice(-20)},e.isPrecompiled=function(t){var r=e.unpad(t);return 1===r.length&&r[0]>=1&&r[0]<=8},e.addHexPrefix=function(t){return"string"!=typeof t||e.isHexPrefixed(t)?t:"0x"+t},e.isValidSignature=function(t,e,r,n){var i=new l("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new l("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===e.length&&32===r.length&&((27===t||28===t)&&(e=new l(e),r=new l(r),!(e.isZero()||e.gt(o)||r.isZero()||r.gt(o))&&(!1!==n||1!==new l(r).cmp(i))))},e.baToJSON=function(t){if(p.isBuffer(t))return"0x"+t.toString("hex");if(t instanceof Array){for(var r=[],n=0;n=i.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===i.length||!r.length||f(r.length===i.length,"The field "+r.name+" must have byte length of "+r.length),t.raw[n]=i}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:i,set:o}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:o,get:i})})),i)if("string"==typeof i&&(i=p.from(e.stripHexPrefix(i),"hex")),p.isBuffer(i)&&(i=h.decode(i)),Array.isArray(i)){if(i.length>t._fields.length)throw new Error("wrong number of fields in data");i.forEach((function(r,n){t[t._fields[n]]=e.toBuffer(r)}))}else{if("object"!==(void 0===i?"undefined":n(i)))throw new Error("invalid data");var o=Object.keys(i);r.forEach((function(e){-1!==o.indexOf(e.name)&&(t[e.name]=i[e.name]),-1!==o.indexOf(e.alias)&&(t[e.alias]=i[e.alias])}))}}},function(t,e,r){"use strict";var n=r(15),i=r(22);function o(){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}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.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=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o"latest"===t||"earliest"===e?1:"latest"===e||"earliest"===t?-1:n(t)-n(e))}function n(t){return null==t?t:Number.parseInt(t,16)}function i(t){if(null==t)return t;let e=t.toString(16);return e.length%2&&(e="0"+e),"0x"+e}function o(){return Math.floor(16*Math.random()).toString(16)}t.exports={minBlockRef:function(...t){return r(t)[0]},maxBlockRef:function(...t){const e=r(t);return e[e.length-1]},sortBlockRefs:r,bnToHex:function(t){return"0x"+t.toString(16)},blockRefIsNumber:function(t){return t&&!["earliest","latest","pending"].includes(t)},hexToInt:n,incrementHexInt:function(t){if(null==t)return t;return i(n(t)+1)},intToHex:i,unsafeRandomBytes:function(t){let e="0x";for(let r=0;r0&&"0"===e.toString();)e=(t=t.slice(1))[0];return t},e.stripZeros=e.unpad,e.toBuffer=function(e){if(!t.isBuffer(e))if(Array.isArray(e))e=t.from(e);else if("string"==typeof e){if(!n.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);e=t.from(n.padToEven(n.stripHexPrefix(e)),"hex")}else if("number"==typeof e)e=n.intToBuffer(e);else if(null==e)e=t.allocUnsafe(0);else if(i.isBN(e))e=e.toArrayLike(t);else{if(!e.toArray)throw new Error("invalid type");e=t.from(e.toArray())}return e},e.bufferToInt=function(t){return new i(e.toBuffer(t)).toNumber()},e.bufferToHex=function(t){return"0x"+(t=e.toBuffer(t)).toString("hex")},e.fromSigned=function(t){return new i(t).fromTwos(256)},e.toUnsigned=function(e){return t.from(e.toTwos(256).toArray())},e.addHexPrefix=function(t){return"string"!=typeof t||n.isHexPrefixed(t)?t:"0x"+t},e.baToJSON=function(r){if(t.isBuffer(r))return"0x"+r.toString("hex");if(r instanceof Array){for(var n=[],i=0;i0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<=s;f--)u=(u<<1)+n[f];c.push(u)}for(var h=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s=0;c--){for(var f=0;c>=0&&0===s[c];c--)f++;if(c>=0&&f++,u=u.dblp(f),c<0)break;var h=s[c];a(0!==h),u="affine"===t.type?h>0?u.mixedAdd(i[h-1>>1]):u.mixedAdd(i[-h-1>>1].neg()):h>0?u.add(i[h-1>>1]):u.add(i[-h-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var a,u,c,f=this._wnafT1,h=this._wnafT2,l=this._wnafT3,d=0;for(a=0;a=1;a-=2){var m=a-1,g=a;if(1===f[m]&&1===f[g]){var b=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(b[1]=e[m].add(e[g]),b[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(b[1]=e[m].toJ().mixedAdd(e[g]),b[2]=e[m].add(e[g].neg())):(b[1]=e[m].toJ().mixedAdd(e[g]),b[2]=e[m].toJ().mixedAdd(e[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[m],r[g]);for(d=Math.max(v[0].length,d),l[m]=new Array(d),l[g]=new Array(d),u=0;u=0;a--){for(var x=0;a>=0;){var E=!0;for(u=0;u=0&&x++,M=M.dblp(x),a<0)break;for(u=0;u0?c=h[u][k-1>>1]:k<0&&(c=h[u][-k-1>>1].neg()),M="affine"===c.type?M.mixedAdd(c):M.add(c))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;ir.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(a=r.slice(i,h)).length)throw new Error("invalid rlp, List has a invalid length");for(;a.length;)u=e(a),c.push(u.data),a=u.remainder;return{data:c,remainder:r.slice(h)}}(c(e));if(r)return n;if(0!==n.remainder.length)throw new Error("invalid remainder");return n.data},e.getLength=function(e){if(!e||0===e.length)return t.from([]);var r=c(e),n=r[0];if(n<=127)return r.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;var i=n-246;return i+o(r.slice(1,i).toString("hex"),16)}}).call(this,r(2).Buffer)},function(t,e,r){var n=r(300),i=r(144);t.exports=function(t){return null!=t&&i(t.length)&&!n(t)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){e|=0;for(var r=Math.max(t.length-e,0),n=Array(r),i=0;i=0&&t.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(t){return r}}},function(t,e,r){var n=r(2),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,n,i){var o=r(43);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;y.WritableState=b;var c=Object.create(r(35));c.inherits=r(3);var f={deprecate:r(54)},h=r(106),l=r(52).Buffer,d=i.Uint8Array||function(){};var p,m=r(107);function g(){}function b(t,e){a=a||r(19),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:f,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,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(x,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),x(t,e))}(t,r,n,e,i);else{var s=M(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),n?u(_,t,r,s,i):_(t,r,s,i)}}(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 s(this)}function y(t){if(a=a||r(19),!(p.call(y,this)||this instanceof a))return new y(t);this._writableState=new b(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)),h.call(this)}function v(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function _(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),x(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,v(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,f=r.encoding,h=r.callback;if(v(t,e,!1,e.objectMode?1:c.length,c,f,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function M(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),x(t,e)}))}function x(t,e){var r=M(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}c.inherits(y,h),b.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(b.prototype,"buffer",{get:f.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]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof b)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var n,i=this._writableState,s=!1,a=!i.objectMode&&(n=t,l.isBuffer(n)||n instanceof d);return a&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=g),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(n,s),i=!1),i}(this,i,t,r))&&(i.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,x(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(5),r(108).setImmediate,r(6))},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(6))},function(t,e,r){"use strict";var n=r(213),i=r(214);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=v,e.resolve=function(t,e){return v(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?v(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=v(t));return t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(c),h=["%","/","?",";","#"].concat(f),l=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(215);function v(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),a=-1!==o&&o127?I+="x":I+=P[B];if(!I.match(d)){var j=C.slice(0,A),N=C.slice(A+1),q=P.match(p);q&&(j.push(q[1]),N.unshift(q[2])),N.length&&(v="/"+N.join(".")+v),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+U,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!m[M])for(A=0,O=f.length;A0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var E=S.slice(-1)[0],k=(r.host||t.host||S.length>1)&&("."===E||".."===E)||""===E,A=0,R=S.length;R>=0;R--)"."===(E=S[R])?S.splice(R,1):".."===E?(S.splice(R,1),A++):A&&(S.splice(R,1),A--);if(!w&&!M)for(;A--;A)S.unshift("..");!w||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),k&&"/"!==S.join("/").substr(-1)&&S.push("");var T,C=""===S[0]||S[0]&&"/"===S[0].charAt(0);x&&(r.hostname=r.host=C?"":S.length?S.shift():"",(T=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift()));return(w=w||r.host&&S.length)&&!C&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){this.listeners={}}return t.prototype.addEventListener=function(t,e){t=t.toLowerCase(),this.listeners[t]=this.listeners[t]||[],this.listeners[t].push(e.handleEvent||e)},t.prototype.removeEventListener=function(t,e){if(t=t.toLowerCase(),this.listeners[t]){var r=this.listeners[t].indexOf(e.handleEvent||e);r<0||this.listeners[t].splice(r,1)}},t.prototype.dispatchEvent=function(t){var e=t.type.toLowerCase();if(t.target=this,this.listeners[e])for(var r=0,n=this.listeners[e];r * @license MIT */function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i=0;c--)if(f[c]!==h[c])return!1;for(c=f.length-1;c>=0;c--)if(a=f[c],!v(t[a],e[a],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function _(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function w(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function M(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&b(i,r,"Missing expected exception"+n);var o="string"==typeof n,a=!t&&i&&!r;if((!t&&s.isError(i)&&o&&w(i,r)||a)&&b(i,r,"Got unwanted exception"+n),t&&i&&r&&!w(i,r)||!t&&i)throw i}l.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(g(t.actual),128)+" "+t.operator+" "+m(g(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=p(e),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},s.inherits(l.AssertionError,Error),l.fail=b,l.ok=y,l.equal=function(t,e,r){t!=e&&b(t,e,r,"==",l.equal)},l.notEqual=function(t,e,r){t==e&&b(t,e,r,"!=",l.notEqual)},l.deepEqual=function(t,e,r){v(t,e,!1)||b(t,e,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(t,e,r){v(t,e,!0)||b(t,e,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(t,e,r){v(t,e,!1)&&b(t,e,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function t(e,r,n){v(e,r,!0)&&b(e,r,n,"notDeepStrictEqual",t)},l.strictEqual=function(t,e,r){t!==e&&b(t,e,r,"===",l.strictEqual)},l.notStrictEqual=function(t,e,r){t===e&&b(t,e,r,"!==",l.notStrictEqual)},l.throws=function(t,e,r){M(!0,t,e,r)},l.doesNotThrow=function(t,e,r){M(!1,t,e,r)},l.ifError=function(t){if(t)throw t},l.strict=n((function t(e,r){e||b(e,!0,r,"==",t)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var S=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}}).call(this,r(6))},function(t,e,r){"use strict";var n=r(29).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{e?(delete n.result,n.error={message:e.message||e}):n.result=r,t?t(i):i()})}),(function(t){if(t)return r(t);r(null,n.result)}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(12);function i(t,e,r){try{Reflect.apply(t,e,r)}catch(t){setTimeout(()=>{throw t})}}class o extends n.EventEmitter{emit(t,...e){let r="error"===t;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let t;if(e.length>0&&([t]=e),t instanceof Error)throw t;const r=new Error("Unhandled error."+(t?` (${t.message})`:""));throw r.context=t,r}const o=n[t];if(void 0===o)return!1;if("function"==typeof o)i(o,this,e);else{const t=o.length,r=function(t){const e=t.length,r=new Array(e);for(let n=0;n=1e3&&t<=4999}(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,e,r)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.errorValues=e.errorCodes=void 0,e.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},e.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}}},function(t,e,r){const n=r(69).default;t.exports=class extends n{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(t){this.updates=this.updates.concat(t),t.forEach(t=>this.emit("update",t))}addInitialResults(t){}getChangesAndClear(){const t=this.updates;return this.updates=[],t}}},function(t,e){function r(t){return null==t?t:Number.parseInt(t,16)}function n(t){if(null==t)return t;return"0x"+t.toString(16)}t.exports=async function({provider:t,fromBlock:e,toBlock:i}){e||(e=i);const o=r(e),s=r(i),a=Array(s-o+1).fill().map((t,e)=>o+e).map(n);return await Promise.all(a.map(e=>function(t,e,r){return new Promise((n,i)=>{t.sendAsync({id:1,jsonrpc:"2.0",method:e,params:r},(t,e)=>{if(t)return i(t);n(e.result)})})}(t,"eth_getBlockByNumber",[e,!1])))}},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.ecdhUnsafe=e.ecdh=e.recover=e.verify=e.sign=e.signatureImportLax=e.signatureImport=e.signatureExport=e.signatureNormalize=e.publicKeyCombine=e.publicKeyTweakMul=e.publicKeyTweakAdd=e.publicKeyVerify=e.publicKeyConvert=e.publicKeyCreate=e.privateKeyTweakMul=e.privateKeyTweakAdd=e.privateKeyModInverse=e.privateKeyNegate=e.privateKeyImport=e.privateKeyExport=e.privateKeyVerify=void 0;var n=r(118),i=r(361),o=r(362);e.privateKeyVerify=function(t){return 32===t.length&&n.privateKeyVerify(Uint8Array.from(t))},e.privateKeyExport=function(t,e){if(32!==t.length)throw new RangeError("private key length is invalid");var r=i.privateKeyExport(t,e);return o.privateKeyExport(t,r,e)},e.privateKeyImport=function(t){if(null!==(t=o.privateKeyImport(t))&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error("couldn't import from DER format")},e.privateKeyNegate=function(e){return t.from(n.privateKeyNegate(Uint8Array.from(e)))},e.privateKeyModInverse=function(e){if(32!==e.length)throw new Error("private key length is invalid");return t.from(i.privateKeyModInverse(Uint8Array.from(e)))},e.privateKeyTweakAdd=function(e,r){return t.from(n.privateKeyTweakAdd(Uint8Array.from(e),r))},e.privateKeyTweakMul=function(e,r){return t.from(n.privateKeyTweakMul(Uint8Array.from(e),Uint8Array.from(r)))},e.publicKeyCreate=function(e,r){return t.from(n.publicKeyCreate(Uint8Array.from(e),r))},e.publicKeyConvert=function(e,r){return t.from(n.publicKeyConvert(Uint8Array.from(e),r))},e.publicKeyVerify=function(t){return(33===t.length||65===t.length)&&n.publicKeyVerify(Uint8Array.from(t))},e.publicKeyTweakAdd=function(e,r,i){return t.from(n.publicKeyTweakAdd(Uint8Array.from(e),Uint8Array.from(r),i))},e.publicKeyTweakMul=function(e,r,i){return t.from(n.publicKeyTweakMul(Uint8Array.from(e),Uint8Array.from(r),i))},e.publicKeyCombine=function(e,r){var i=[];return e.forEach((function(t){i.push(Uint8Array.from(t))})),t.from(n.publicKeyCombine(i,r))},e.signatureNormalize=function(e){return t.from(n.signatureNormalize(Uint8Array.from(e)))},e.signatureExport=function(e){return t.from(n.signatureExport(Uint8Array.from(e)))},e.signatureImport=function(e){return t.from(n.signatureImport(Uint8Array.from(e)))},e.signatureImportLax=function(t){if(0===t.length)throw new RangeError("signature length is invalid");var e=o.signatureImportLax(t);if(null===e)throw new Error("couldn't parse DER signature");return i.signatureImport(e)},e.sign=function(e,r,i){if(null===i)throw new TypeError("options should be an Object");var o=void 0;if(i){if(o={},null===i.data)throw new TypeError("options.data should be a Buffer");if(i.data){if(32!=i.data.length)throw new RangeError("options.data length is invalid");o.data=new Uint8Array(i.data)}if(null===i.noncefn)throw new TypeError("options.noncefn should be a Function");i.noncefn&&(o.noncefn=function(e,r,n,o,s){var a=null!=n?t.from(n):null,u=null!=o?t.from(o):null,c=t.from("");return i.noncefn&&(c=i.noncefn(t.from(e),t.from(r),a,u,s)),new Uint8Array(c)})}var s=n.ecdsaSign(Uint8Array.from(e),Uint8Array.from(r),o);return{signature:t.from(s.signature),recovery:s.recid}},e.verify=function(t,e,r){return n.ecdsaVerify(Uint8Array.from(e),Uint8Array.from(t),r)},e.recover=function(e,r,i,o){return t.from(n.ecdsaRecover(Uint8Array.from(r),i,Uint8Array.from(e),o))},e.ecdh=function(e,r){return t.from(n.ecdh(Uint8Array.from(e),Uint8Array.from(r),{}))},e.ecdhUnsafe=function(e,r,n){if(33!==e.length&&65!==e.length)throw new RangeError("public key length is invalid");if(32!==r.length)throw new RangeError("private key length is invalid");return t.from(i.ecdhUnsafe(Uint8Array.from(e),Uint8Array.from(r),n))}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.rlphash=e.ripemd160=e.sha256=e.keccak256=e.keccak=void 0;var n=r(110),i=n.keccak224,o=n.keccak384,s=n.keccak256,a=n.keccak512,u=r(126),c=r(32),f=r(46),h=r(40);e.keccak=function(e,r){switch(void 0===r&&(r=256),e="string"!=typeof e||c.isHexString(e)?h.toBuffer(e):t.from(e,"utf8"),r||(r=256),r){case 224:return i(e);case 256:return s(e);case 384:return o(e);case 512:return a(e);default:throw new Error("Invald algorithm: keccak"+r)}},e.keccak256=function(t){return e.keccak(t)},e.sha256=function(t){return t=h.toBuffer(t),u("sha256").update(t).digest()},e.ripemd160=function(t,e){t=h.toBuffer(t);var r=u("rmd160").update(t).digest();return!0===e?h.setLength(r,32):r},e.rlphash=function(t){return e.keccak(f.encode(t))}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";r.r(e);var n=r(157),i=r(10),o=r(158);function s(t){return Object(o.a)(t)}function a(){const t=s();return t&&t.os?t.os:void 0}function u(){const t=a();return!!t&&t.toLowerCase().includes("android")}function c(){const t=a();return!!t&&(t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}function f(){return!!a()&&(u()||c())}function h(){const t=s();return!(!t||!t.name)&&"node"===t.name.toLowerCase()}function l(){return!h()&&!!y()}const d=i.getFromWindow,p=i.getFromWindowOrThrow,m=i.getDocumentOrThrow,g=i.getDocument,b=i.getNavigatorOrThrow,y=i.getNavigator,v=i.getLocationOrThrow,_=i.getLocation,w=i.getCryptoOrThrow,M=i.getCrypto,S=i.getLocalStorageOrThrow,x=i.getLocalStorage;function E(){return n.getWindowMetadata()}const k=function(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type "+typeof t);try{return JSON.parse(t)}catch(e){return t}},A=function(t){return"string"==typeof t?t:JSON.stringify(t)};function R(t,e){const r=A(e),n=x();n&&n.setItem(t,r)}function T(t){let e=null,r=null;const n=x();return n&&(r=n.getItem(t)),e=r?k(r):r,e}function C(t){const e=x();e&&e.removeItem(t)}function O(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function P(t){const e=t.href.split("?")[0];R("WALLETCONNECT_DEEPLINK_CHOICE",Object.assign(Object.assign({},t),{href:e}))}function I(t,e){return t.filter(t=>t.name.toLowerCase().includes(e.toLowerCase()))[0]}function B(t,e){let r=t;return e&&(r=e.map(e=>I(t,e)).filter(Boolean)),r}const L="https://registry.walletconnect.org";function j(){return L+"/data/wallets.json"}function N(){return L+"/data/dapps.json"}function q(t){return L+"/logo/sm/"+t+".jpeg"}function U(t,e="mobile"){return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:t.id?q(t.id):"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function D(t,e="mobile"){return Object.values(t).filter(t=>!!t[e].universal||!!t[e].native).map(t=>U(t,e))}r.d(e,"detectEnv",(function(){return s})),r.d(e,"detectOS",(function(){return a})),r.d(e,"isAndroid",(function(){return u})),r.d(e,"isIOS",(function(){return c})),r.d(e,"isMobile",(function(){return f})),r.d(e,"isNode",(function(){return h})),r.d(e,"isBrowser",(function(){return l})),r.d(e,"getFromWindow",(function(){return d})),r.d(e,"getFromWindowOrThrow",(function(){return p})),r.d(e,"getDocumentOrThrow",(function(){return m})),r.d(e,"getDocument",(function(){return g})),r.d(e,"getNavigatorOrThrow",(function(){return b})),r.d(e,"getNavigator",(function(){return y})),r.d(e,"getLocationOrThrow",(function(){return v})),r.d(e,"getLocation",(function(){return _})),r.d(e,"getCryptoOrThrow",(function(){return w})),r.d(e,"getCrypto",(function(){return M})),r.d(e,"getLocalStorageOrThrow",(function(){return S})),r.d(e,"getLocalStorage",(function(){return x})),r.d(e,"getClientMeta",(function(){return E})),r.d(e,"safeJsonParse",(function(){return k})),r.d(e,"safeJsonStringify",(function(){return A})),r.d(e,"setLocal",(function(){return R})),r.d(e,"getLocal",(function(){return T})),r.d(e,"removeLocal",(function(){return C})),r.d(e,"mobileLinkChoiceKey",(function(){return"WALLETCONNECT_DEEPLINK_CHOICE"})),r.d(e,"formatIOSMobile",(function(){return O})),r.d(e,"saveMobileLinkInfo",(function(){return P})),r.d(e,"getMobileRegistryEntry",(function(){return I})),r.d(e,"getMobileLinkRegistry",(function(){return B})),r.d(e,"getWalletRegistryUrl",(function(){return j})),r.d(e,"getDappRegistryUrl",(function(){return N})),r.d(e,"getAppLogoUrl",(function(){return q})),r.d(e,"formatMobileRegistryEntry",(function(){return U})),r.d(e,"formatMobileRegistry",(function(){return D}))},function(t,e,r){"use strict";const n=r(174),i=r(175),o=r(176);function s(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(t,e){return e.encode?e.strict?n(t):encodeURIComponent(t):t}function u(t,e){return e.decode?i(t):t}function c(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function f(t){const e=(t=c(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function h(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function l(t,e){s((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const r=function(t){let e;switch(t.arrayFormat){case"index":return(t,r,n)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===n[t]&&(n[t]={}),n[t][e[1]]=r):n[t]=r};case"bracket":return(t,r,n)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==n[t]?n[t]=[].concat(n[t],r):n[t]=[r]:n[t]=r};case"comma":case"separator":return(e,r,n)=>{const i="string"==typeof r&&r.split("").indexOf(t.arrayFormatSeparator)>-1?r.split(t.arrayFormatSeparator).map(e=>u(e,t)):null===r?r:u(r,t);n[e]=i};default:return(t,e,r)=>{void 0!==r[t]?r[t]=[].concat(r[t],e):r[t]=e}}}(e),n=Object.create(null);if("string"!=typeof t)return n;if(!(t=t.trim().replace(/^[?#&]/,"")))return n;for(const i of t.split("&")){let[t,s]=o(e.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator"].includes(e.arrayFormat)?s:u(s,e),r(u(t,e),s,n)}for(const t of Object.keys(n)){const r=n[t];if("object"==typeof r&&null!==r)for(const t of Object.keys(r))r[t]=h(r[t],e);else n[t]=h(r,e)}return!1===e.sort?n:(!0===e.sort?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((t,e)=>{const r=n[e];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort((t,e)=>Number(t)-Number(e)).map(t=>e[t]):e}(r):t[e]=r,t},Object.create(null))}e.extract=f,e.parse=l,e.stringify=(t,e)=>{if(!t)return"";s((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const r=r=>e.skipNull&&null==t[r]||e.skipEmptyString&&""===t[r],n=function(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{const i=r.length;return void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[a(e,t),"[",i,"]"].join("")]:[...r,[a(e,t),"[",a(i,t),"]=",a(n,t)].join("")]};case"bracket":return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[a(e,t),"[]"].join("")]:[...r,[a(e,t),"[]=",a(n,t)].join("")];case"comma":case"separator":return e=>(r,n)=>null==n||0===n.length?r:0===r.length?[[a(e,t),"=",a(n,t)].join("")]:[[r,a(n,t)].join(t.arrayFormatSeparator)];default:return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,a(e,t)]:[...r,[a(e,t),"=",a(n,t)].join("")]}}(e),i={};for(const e of Object.keys(t))r(e)||(i[e]=t[e]);const o=Object.keys(i);return!1!==e.sort&&o.sort(e.sort),o.map(r=>{const i=t[r];return void 0===i?"":null===i?a(r,e):Array.isArray(i)?i.reduce(n(r),[]).join("&"):a(r,e)+"="+a(i,e)}).filter(t=>t.length>0).join("&")},e.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);const[r,n]=o(t,"#");return Object.assign({url:r.split("?")[0]||"",query:l(f(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:u(n,e)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=c(t.url).split("?")[0]||"",i=e.extract(t.url),o=e.parse(i,{sort:!1}),s=Object.assign(o,t.query);let u=e.stringify(s,r);u&&(u="?"+u);let f=function(t){let e="";const r=t.indexOf("#");return-1!==r&&(e=t.slice(r)),e}(t.url);return t.fragmentIdentifier&&(f="#"+a(t.fragmentIdentifier,r)),`${n}${u}${f}`}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){t.exports=i,i.strict=o,i.loose=s;var r=Object.prototype.toString,n={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function i(t){return o(t)||s(t)}function o(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function s(t){return n[r.call(t)]}},function(t,e,r){"use strict";var n=r(8);r.o(n,"payloadId")&&r.d(e,"payloadId",(function(){return n.payloadId}));n.isNode},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));r(24),r(7);function n(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}},function(t,e,r){"use strict"},function(t,e,r){"use strict";r(84)},function(t,e,r){"use strict";r(85),r(41),r(86),r(87)},function(t,e){},function(t,e,r){"use strict";var n=r(41);n.a;n.a},function(t,e){},function(t,e,r){"use strict"},function(t,e,r){"use strict"},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(8);function i(t){return n.getBrowerCrypto().getRandomValues(new Uint8Array(t))}},function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"a",(function(){return o}));var n=r(14);function i(t,e,r){return Object(n.b)(t,e,r)}function o(t,e,r){return Object(n.a)(t,e,r)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(14);r(42);async function i(t,e){return await Object(n.c)(t,e)}},function(t,e,r){"use strict";var n=r(8);r.o(n,"isConstantTime")&&r.d(e,"isConstantTime",(function(){return n.isConstantTime}))},function(t,e,r){"use strict"},function(t,e){},function(t,e,r){"use strict";function n(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n=1&&t<=40}},function(t,e){var r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(r=r.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";e.KANJI=new RegExp(r,"g"),e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),e.BYTE=new RegExp(n,"g"),e.NUMERIC=new RegExp("[0-9]+","g"),e.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var i=new RegExp("^"+r+"$"),o=new RegExp("^[0-9]+$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");e.testKanji=function(t){return i.test(t)},e.testNumeric=function(t){return o.test(t)},e.testAlphanumeric=function(t){return s.test(t)}},function(t,e){function r(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");var e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map((function(t){return[t,t]})))),6===e.length&&e.push("F","F");var r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+e.slice(0,6).join("")}}e.getOptions=function(t){t||(t={}),t.color||(t.color={});var e=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:n,scale:n?4:i,margin:e,color:{dark:r(t.color.dark||"#000000ff"),light:r(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},e.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},e.getImageWidth=function(t,r){var n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){for(var i=r.modules.size,o=r.modules.data,s=e.getScale(i,n),a=Math.floor((i+2*n.margin)*s),u=n.margin*s,c=[n.color.light,n.color.dark],f=0;f=u&&h>=u&&ft._pos){var o=r.substr(t._pos);if("x-user-defined"===t._charset){for(var s=new n(o.length),a=0;at._pos&&(t.push(new n(new Uint8Array(c.result.slice(t._pos)))),t._pos=c.result.byteLength)},c.onload=function(){t.push(null)},c.readAsArrayBuffer(r)}t._xhr.readyState===u.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,r(5),r(2).Buffer,r(6))},function(t,e,r){"use strict";(function(e,n){var i=r(43);t.exports=v;var o,s=r(78);v.ReadableState=y;r(12).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=r(106),c=r(52).Buffer,f=e.Uint8Array||function(){};var h=Object.create(r(35));h.inherits=r(3);var l=r(205),d=void 0;d=l&&l.debuglog?l.debuglog("stream"):function(){};var p,m=r(206),g=r(107);h.inherits(v,u);var b=["error","close","destroy","pause","resume"];function y(t,e){t=t||{};var n=e instanceof(o=o||r(19));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(20).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function v(t){if(o=o||r(19),!(this instanceof v))return new v(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function _(t,e,r,n,i){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;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,S(t)}(t,s)):(i||(o=function(t,e){var r;n=e,c.isBuffer(n)||n instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),n?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?w(t,s,e,!1):E(t,s)):w(t,s,e,!1))):n||(s.reading=!1));return 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 S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(x,t):x(t))}function x(t){d("emit readable"),t.emit("readable"),T(t)}function E(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(k,t,e))}function k(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 n;to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=c.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0===(t-=s)){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function O(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function I(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?O(this):S(this),null;if(0===(t=M(t,e))&&e.ended)return 0===e.length&&O(this),null;var n,i=e.needReadable;return d("need readable",i),(0===e.length||e.length-t0?C(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&O(this)),null!==n&&this.emit("data",n),n},v.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(t,e){var r=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,d("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?f:v;function c(e,n){d("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d("cleanup"),t.removeListener("close",b),t.removeListener("finish",y),t.removeListener("drain",h),t.removeListener("error",g),t.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",v),r.removeListener("data",m),l=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function f(){d("onend"),t.end()}o.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",c);var h=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,T(t))}}(r);t.on("drain",h);var l=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==I(o.pipes,t))&&!l&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(e){d("onerror",e),v(),t.removeListener("error",g),0===a(t,"error")&&t.emit("error",e)}function b(){t.removeListener("finish",y),v()}function y(){d("onfinish"),t.removeListener("close",b),v()}function v(){d("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",g),t.once("close",b),t.once("finish",y),t.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),t},v.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 n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(208),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(6))},function(t,e,r){"use strict";t.exports=s;var n=r(19),i=Object.create(r(35));function o(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),n)s.endEmitted?M(t,new w):A(t,s,e,!0);else if(s.ended)M(t,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?A(t,s,e,!1):O(t,s)):A(t,s,e,!1)}else n||(s.reading=!1,O(t,s));return!s.ended&&(s.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 T(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(C,t))}function C(t){var e=t._readableState;c("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,j(t)}function O(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(P,t,e))}function P(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function B(t){c("readable nexttick read 0"),t.read(0)}function L(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function N(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 q(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(U,e,t))}function U(t,e){if(c("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 D(t,e){for(var r=0,n=t.length;r=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?q(this):T(this),null;if(0===(t=R(t,e))&&e.ended)return 0===e.length&&q(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t0?N(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&&q(this)),null!==n&&this.emit("data",n),n},E.prototype._read=function(t){M(this,new _("_read()"))},E.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var s=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?u:g;function a(e,n){c("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){c("onend"),t.end()}i.endEmitted?n.nextTick(s):r.once("end",s),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var h=!1;function l(e){c("ondata");var n=t.write(e);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==D(i.pipes,t))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(e){c("onerror",e),g(),t.removeListener("error",d),0===o(t,"error")&&M(t,e)}function p(){t.removeListener("finish",m),g()}function m(){c("onfinish"),t.removeListener("close",p),g()}function g(){c("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),t},E.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 n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?T(this):i.reading||n.nextTick(B,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(t,e){var r=s.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(I,this),r},E.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(I,this),e},E.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(L,t,e))}(this,t)),t.paused=!1,this},E.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(t,e,r){r(new m("_write()"))},E.prototype._writev=null,E.prototype.end=function(t,e,r){var i=this._writableState;return"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,O(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),E.prototype.destroy=h.destroy,E.prototype._undestroy=h.undestroy,E.prototype._destroy=function(t,e){e(t)}}).call(this,r(6),r(5))},function(t,e,r){"use strict";t.exports=f;var n=r(27).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(28);function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,r){var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},function(t,e,r){"use strict";var n=r(15),i=r(37),o=r(123),s=r(22),a=n.sum32,u=n.sum32_4,c=n.sum32_5,f=o.ch32,h=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,b=[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];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}n.inherits(y,g),t.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.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},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,r){"use strict";(function(e,n){var i;t.exports=E,E.ReadableState=x;r(12).EventEmitter;var o=function(t,e){return t.listeners(e).length},s=r(129),a=r(2).Buffer,u=e.Uint8Array||function(){};var c,f=r(273);c=f&&f.debuglog?f.debuglog("stream"):function(){};var h,l,d,p=r(274),m=r(130),g=r(131).getHighWaterMark,b=r(29).codes,y=b.ERR_INVALID_ARG_TYPE,v=b.ERR_STREAM_PUSH_AFTER_EOF,_=b.ERR_METHOD_NOT_IMPLEMENTED,w=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(3)(E,s);var M=m.errorOrDestroy,S=["error","close","destroy","pause","resume"];function x(t,e,n){i=i||r(30),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",n),this.buffer=new p,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=r(20).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function E(t){if(i=i||r(30),!(this instanceof E))return new E(t);var e=this instanceof i;this._readableState=new x(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function k(t,e,r,n,i){c("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;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?T(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,C(t)))}(t,s);else if(i||(o=function(t,e){var r;n=e,a.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e));var n;return r}(s,e)),o)M(t,o);else if(s.objectMode||e&&e.length>0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),n)s.endEmitted?M(t,new w):A(t,s,e,!0);else if(s.ended)M(t,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?A(t,s,e,!1):O(t,s)):A(t,s,e,!1)}else n||(s.reading=!1,O(t,s));return!s.ended&&(s.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 T(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(C,t))}function C(t){var e=t._readableState;c("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,j(t)}function O(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(P,t,e))}function P(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function B(t){c("readable nexttick read 0"),t.read(0)}function L(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function N(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 q(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(U,e,t))}function U(t,e){if(c("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 D(t,e){for(var r=0,n=t.length;r=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?q(this):T(this),null;if(0===(t=R(t,e))&&e.ended)return 0===e.length&&q(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t0?N(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&&q(this)),null!==n&&this.emit("data",n),n},E.prototype._read=function(t){M(this,new _("_read()"))},E.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var s=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?u:g;function a(e,n){c("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){c("onend"),t.end()}i.endEmitted?n.nextTick(s):r.once("end",s),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,j(t))}}(r);t.on("drain",f);var h=!1;function l(e){c("ondata");var n=t.write(e);c("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==D(i.pipes,t))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(e){c("onerror",e),g(),t.removeListener("error",d),0===o(t,"error")&&M(t,e)}function p(){t.removeListener("finish",m),g()}function m(){c("onfinish"),t.removeListener("close",p),g()}function g(){c("unpipe"),r.unpipe(t)}return r.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),i.flowing||(c("pipe resume"),r.resume()),t},E.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 n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?T(this):i.reading||n.nextTick(B,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(t,e){var r=s.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(I,this),r},E.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(I,this),e},E.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(L,t,e))}(this,t)),t.paused=!1,this},E.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(t,e,r){r(new m("_write()"))},E.prototype._writev=null,E.prototype.end=function(t,e,r){var i=this._writableState;return"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,O(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),E.prototype.destroy=h.destroy,E.prototype._undestroy=h.undestroy,E.prototype._destroy=function(t,e){e(t)}}).call(this,r(6),r(5))},function(t,e,r){"use strict";t.exports=f;var n=r(29).codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(30);function c(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}n(u,i),u.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},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,b=0;b<16;++b)r[b]=t.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((e=r[b-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[b-7]+d(r[b-15])+r[b-16];for(var y=0;y<64;++y){var v=g+l(u)+c(u,p,m)+s[y]+r[y]|0,_=h(n)+f(n,i,o)|0;g=m,m=p,p=u,u=a+v|0,a=o,o=i,i=n,n=v+_|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var t=o.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},t.exports=u},function(t,e,r){var n=r(3),i=r(31),o=r(13).Buffer,s=[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],a=new Array(160);function u(){this.init(),this._w=a,i.call(this,128,112)}function c(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function b(t,e){return t>>>0>>0?1:0}n(u,i),u.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},u.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,u=0|this._fh,y=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,M=0|this._cl,S=0|this._dl,x=0|this._el,E=0|this._fl,k=0|this._gl,A=0|this._hl,R=0;R<32;R+=2)e[R]=t.readInt32BE(4*R),e[R+1]=t.readInt32BE(4*R+4);for(;R<160;R+=2){var T=e[R-30],C=e[R-30+1],O=d(T,C),P=p(C,T),I=m(T=e[R-4],C=e[R-4+1]),B=g(C,T),L=e[R-14],j=e[R-14+1],N=e[R-32],q=e[R-32+1],U=P+j|0,D=O+L+b(U,P)|0;D=(D=D+I+b(U=U+B|0,B)|0)+N+b(U=U+q|0,q)|0,e[R]=D,e[R+1]=U}for(var H=0;H<160;H+=2){D=e[H],U=e[H+1];var z=f(r,n,i),F=f(_,w,M),W=h(r,_),K=h(_,r),V=l(a,x),J=l(x,a),Z=s[H],G=s[H+1],Y=c(a,u,y),$=c(x,E,k),X=A+J|0,Q=v+V+b(X,A)|0;Q=(Q=(Q=Q+Y+b(X=X+$|0,$)|0)+Z+b(X=X+G|0,G)|0)+D+b(X=X+U|0,U)|0;var tt=K+F|0,et=W+z+b(tt,K)|0;v=y,A=k,y=u,k=E,u=a,E=x,a=o+Q+b(x=S+X|0,S)|0,o=i,S=M,i=n,M=w,n=r,w=_,r=Q+et+b(_=X+tt|0,X)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+M|0,this._dl=this._dl+S|0,this._el=this._el+x|0,this._fl=this._fl+E|0,this._gl=this._gl+k|0,this._hl=this._hl+A|0,this._ah=this._ah+r+b(this._al,_)|0,this._bh=this._bh+n+b(this._bl,w)|0,this._ch=this._ch+i+b(this._cl,M)|0,this._dh=this._dh+o+b(this._dl,S)|0,this._eh=this._eh+a+b(this._el,x)|0,this._fh=this._fh+u+b(this._fl,E)|0,this._gh=this._gh+y+b(this._gl,k)|0,this._hh=this._hh+v+b(this._hl,A)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+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},t.exports=u},function(t,e){t.exports=function(t){if("string"!=typeof t)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(t,e,r){"use strict";const n=(t,e)=>function(){const r=e.promiseModule,n=new Array(arguments.length);for(let t=0;t{e.errorFirst?n.push((function(t,n){if(e.multiArgs){const e=new Array(arguments.length-1);for(let t=1;t{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const r=t=>{const r=e=>"string"==typeof e?t===e:e.test(t);return e.include?e.include.some(r):!e.exclude.some(r)};let i;i="function"==typeof t?function(){return e.excludeMain?t.apply(this,arguments):n(t,e).apply(this,arguments)}:Object.create(Object.getPrototypeOf(t));for(const o in t){const s=t[o];i[o]="function"==typeof s&&r(o)?n(s,e):s}return i}},function(t,e,r){const n=r(44),i=r(296)();function o(t){this.currentProvider=t}function s(t){return function(){const e=this;var r=[].slice.call(arguments),n=r.pop();e.sendAsync({method:t,params:r},n)}}function a(t,e){return function(){const r=this;var n=[].slice.call(arguments),i=n.pop();n.length-1&&t%1==0&&t<=9007199254740991}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={},t.exports=e.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return function(e,r,u){if(u=(0,i.default)(u||n.default),t<=0||!e)return u(null);var c=(0,o.default)(e),f=!1,h=0,l=!1;function d(t,e){if(h-=1,t)f=!0,u(t);else{if(e===a.default||f&&h<=0)return f=!0,u(null);l||p()}}function p(){for(l=!0;h=t.params.length?t.params:"eth_getBlockByNumber"===t.method?t.params.slice(1):t.params.slice(0,e)}function s(t){switch(t.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":return 1;case"eth_getBlockByNumber":return 0;default:return}}function a(t){switch(t.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":return"fork";case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"eth_blockNumber":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":return"never"}}t.exports={cacheIdentifierForPayload:function(t,e={}){if(!i(t))return null;const{includeBlockRef:r}=e,s=r?t.params:o(t);return t.method+":"+n(s)},canCache:i,blockTagForPayload:function(t){var e=s(t);if(e>=t.params.length)return null;return t.params[e]},paramsWithoutBlockTag:o,blockTagParamIndex:s,cacheTypeForPayload:a}},function(t,e,r){var n="undefined"!=typeof JSON?JSON:r(330);t.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var r=e.space||"";"number"==typeof r&&(r=Array(r+1).join(" "));var s,a="boolean"==typeof e.cycles&&e.cycles,u=e.replacer||function(t,e){return e},c=e.cmp&&(s=e.cmp,function(t){return function(e,r){var n={key:e,value:t[e]},i={key:r,value:t[r]};return s(n,i)}}),f=[];return function t(e,s,h,l){var d=r?"\n"+new Array(l+1).join(r):"",p=r?": ":":";if(h&&h.toJSON&&"function"==typeof h.toJSON&&(h=h.toJSON()),void 0!==(h=u.call(e,s,h))){if("object"!=typeof h||null===h)return n.stringify(h);if(i(h)){for(var m=[],g=0;g{const r=await t(...e);return c(r.id)})}function l(t){return i(async(e,r)=>{const n=await t.apply(null,e.params);r.result=n})}function d(t,e){const r=[];for(let e in t)r.push(t[e]);return r}t.exports=function({blockTracker:t,provider:e}){let r=0,i={};const p=new n,m=function({mutex:t}){return e=>async(r,n,i,o)=>{(await t.acquire())(),e(r,n,i,o)}}({mutex:p}),g=o({eth_newFilter:m(h(y)),eth_newBlockFilter:m(h(v)),eth_newPendingTransactionFilter:m(h(_)),eth_uninstallFilter:m(l(S)),eth_getFilterChanges:m(l(w)),eth_getFilterLogs:m(l(M))}),b=async({oldBlock:t,newBlock:e})=>{if(0===i.length)return;const r=await p.acquire();try{await Promise.all(d(i).map(async r=>{try{await r.update({oldBlock:t,newBlock:e})}catch(t){console.error(t)}}))}catch(t){console.error(t)}r()};return g.newLogFilter=y,g.newBlockFilter=v,g.newPendingTransactionFilter=_,g.uninstallFilter=S,g.getFilterChanges=w,g.getFilterLogs=M,g.destroy=()=>{!async function(){const t=d(i).length;i={},E({prevFilterCount:t,newFilterCount:0})}()},g;async function y(t){const r=new s({provider:e,params:t});await x(r);return r}async function v(){const t=new a({provider:e});await x(t);return t}async function _(){const t=new u({provider:e});await x(t);return t}async function w(t){const e=f(t),r=i[e];if(!r)throw new Error(`No filter for index "${e}"`);return r.getChangesAndClear()}async function M(t){const e=f(t),r=i[e];if(!r)throw new Error(`No filter for index "${e}"`);return"log"===r.type?results=r.getAllResults():results=[],results}async function S(t){const e=f(t),r=i[e],n=Boolean(r);return n&&await async function(t){const e=d(i).length;delete i[t];const r=d(i).length;E({prevFilterCount:e,newFilterCount:r})}(e),n}async function x(e){const n=d(i).length,o=await t.getLatestBlock();await e.initialize({currentBlock:o}),r++,i[r]=e,e.id=r,e.idHex=c(r);return E({prevFilterCount:n,newFilterCount:d(i).length}),r}function E({prevFilterCount:e,newFilterCount:r}){0===e&&r>0?t.on("sync",b):e>0&&0===r&&t.removeListener("sync",b)}}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(340),e),i(r(341),e),i(r(342),e),i(r(153),e),i(r(154),e),i(r(346),e)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getUniqueId=void 0;let n=Math.floor(4294967295*Math.random());e.getUniqueId=function(){return n=(n+1)%4294967295,n}},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.JsonRpcEngine=void 0;const i=n(r(69)),o=r(343);class s extends i.default{constructor(){super(),this._middleware=[]}push(t){this._middleware.push(t)}handle(t,e){if(e&&"function"!=typeof e)throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?e?this._handleBatch(t,e):this._handleBatch(t):e?this._handle(t,e):this._promiseHandle(t)}asMiddleware(){return async(t,e,r,n)=>{try{const[i,o,a]=await s._runAllMiddleware(t,e,this._middleware);return o?(await s._runReturnHandlers(a),n(i)):r(async t=>{try{await s._runReturnHandlers(a)}catch(e){return t(e)}return t()})}catch(t){return n(t)}}}async _handleBatch(t,e){try{const r=await Promise.all(t.map(this._promiseHandle.bind(this)));return e?e(null,r):r}catch(t){if(e)return e(t);throw t}}_promiseHandle(t){return new Promise(e=>{this._handle(t,(t,r)=>{e(r)})})}async _handle(t,e){if(!t||Array.isArray(t)||"object"!=typeof t){const r=new o.EthereumRpcError(o.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof t,{request:t});return e(r,{id:void 0,jsonrpc:"2.0",error:r})}if("string"!=typeof t.method){const r=new o.EthereumRpcError(o.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof t.method,{request:t});return e(r,{id:t.id,jsonrpc:"2.0",error:r})}const r=Object.assign({},t),n={id:r.id,jsonrpc:r.jsonrpc};let i=null;try{await this._processRequest(r,n)}catch(t){i=t}return i&&(delete n.result,n.error||(n.error=o.serializeError(i))),e(i,n)}async _processRequest(t,e){const[r,n,i]=await s._runAllMiddleware(t,e,this._middleware);if(s._checkForCompletion(t,e,n),await s._runReturnHandlers(i),r)throw r}static async _runAllMiddleware(t,e,r){const n=[];let i=null,o=!1;for(const a of r)if([i,o]=await s._runMiddleware(t,e,a,n),o)break;return[i,o,n.reverse()]}static _runMiddleware(t,e,r,n){return new Promise(i=>{const s=t=>{const r=t||e.error;r&&(e.error=o.serializeError(r)),i([r,!0])},u=r=>{e.error?s(e.error):(r&&("function"!=typeof r&&s(new o.EthereumRpcError(o.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof r}" for request:\n${a(t)}`,{request:t})),n.push(r)),i([null,!1]))};try{r(t,e,u,s)}catch(t){s(t)}})}static async _runReturnHandlers(t){for(const e of t)await new Promise((t,r)=>{e(e=>e?r(e):t())})}static _checkForCompletion(t,e,r){if(!("result"in e)&&!("error"in e))throw new o.EthereumRpcError(o.errorCodes.rpc.internal,"JsonRpcEngine: Response has no error or result for request:\n"+a(t),{request:t});if(!r)throw new o.EthereumRpcError(o.errorCodes.rpc.internal,"JsonRpcEngine: Nothing ended request:\n"+a(t),{request:t})}}function a(t){return JSON.stringify(t,null,2)}e.JsonRpcEngine=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const n=r(71),i=r(70),o=n.errorCodes.rpc.internal,s={code:o,message:a(o)};function a(t,r="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(t)){const r=t.toString();if(h(n.errorValues,r))return n.errorValues[r].message;if(c(t))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function u(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!n.errorValues[e]||!!c(t)}function c(t){return t>=-32099&&t<=-32e3}function f(t){return t&&"object"==typeof t&&!Array.isArray(t)?Object.assign({},t):t}function h(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=a,e.isValidCode=u,e.serializeError=function(t,{fallbackError:e=s,shouldIncludeStack:r=!1}={}){var n,o;if(!e||!Number.isInteger(e.code)||"string"!=typeof e.message)throw new Error("Must provide fallback error with integer number code and string message.");if(t instanceof i.EthereumRpcError)return t.serialize();const c={};if(t&&"object"==typeof t&&!Array.isArray(t)&&h(t,"code")&&u(t.code)){const e=t;c.code=e.code,e.message&&"string"==typeof e.message?(c.message=e.message,h(e,"data")&&(c.data=e.data)):(c.message=a(c.code),c.data={originalError:f(t)})}else{c.code=e.code;const r=null===(n=t)||void 0===n?void 0:n.message;c.message=r&&"string"==typeof r?r:e.message,c.data={originalError:f(t)}}const l=null===(o=t)||void 0===o?void 0:o.stack;return r&&t&&l&&"string"==typeof l&&(c.stack=l),c}},function(t,e,r){t.exports=r(347)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getWindowMetadata=void 0;const n=r(10);e.getWindowMetadata=function(){let t,e;try{t=n.getDocumentOrThrow(),e=n.getLocationOrThrow()}catch(t){return null}function r(...e){const r=t.getElementsByTagName("meta");for(let t=0;tn.getAttribute(t)).filter(t=>!!t&&e.includes(t));if(i.length&&i){const t=n.getAttribute("content");if(t)return t}}return""}const i=function(){let e=r("name","og:site_name","og:title","twitter:title");return e||(e=t.title),e}();return{description:r("description","og:description","twitter:description","keywords"),url:e.origin,icons:function(){const r=t.getElementsByTagName("link"),n=[];for(let t=0;t-1){const t=i.getAttribute("href");if(t)if(-1===t.toLowerCase().indexOf("https:")&&-1===t.toLowerCase().indexOf("http:")&&0!==t.indexOf("//")){let r=e.protocol+"//"+e.host;if(0===t.indexOf("/"))r+=t;else{const n=e.pathname.split("/");n.pop();r+=n.join("/")+"/"+t}n.push(r)}else if(0===t.indexOf("//")){const r=e.protocol+t;n.push(r)}else n.push(t)}}return n}(),name:i}}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return l}));var n=function(){for(var t=0,e=0,r=arguments.length;e>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function N(t,e,r){j.call(this,t,e,r)}j.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(s);if(null===t)throw new Error(s);if(l&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||l&&ArrayBuffer.isView(t)))throw new Error(s);e=!0}for(var n,i,o=this.blocks,a=this.byteCount,u=t.length,c=this.blockCount,f=0,h=this.s;f>2]|=t[f]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(o[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)<=a){for(this.start=n-a,this.block=o[c],n=0;n>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},j.prototype.encodeString=function(t){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(s);if(null===t)throw new Error(s);if(l&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||l&&ArrayBuffer.isView(t)))throw new Error(s);e=!0}var n=0,i=t.length;if(e)n=i;else for(var o=0;o=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(t),n},j.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+d[15&t]+d[t>>12&15]+d[t>>8&15]+d[t>>20&15]+d[t>>16&15]+d[t>>28&15]+d[t>>24&15];s%e==0&&(q(r),o=0)}return i&&(t=r[o],a+=d[t>>4&15]+d[15&t],i>1&&(a+=d[t>>12&15]+d[t>>8&15]),i>2&&(a+=d[t>>20&15]+d[t>>16&15])),a},j.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&q(n)}return o&&(t=a<<2,e=n[s],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},N.prototype=new j,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),j.prototype.finalize.call(this)};var q=function(t){var e,r,n,i,o,s,a,u,c,f,h,l,d,p,m,b,y,v,_,w,M,S,x,E,k,A,R,T,C,O,P,I,B,L,j,N,q,U,D,H,z,F,W,K,V,J,Z,G,Y,$,X,Q,tt,et,rt,nt,it,ot,st,at,ut,ct,ft;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],e=(l=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(f<<1|h>>>31),r=a^(h<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(l<<1|d>>>31),r=c^(d<<1|l>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(i<<1|o>>>31),r=h^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,p=t[0],m=t[1],J=t[11]<<4|t[10]>>>28,Z=t[10]<<4|t[11]>>>28,T=t[20]<<3|t[21]>>>29,C=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,F=t[40]<<18|t[41]>>>14,W=t[41]<<18|t[40]>>>14,L=t[2]<<1|t[3]>>>31,j=t[3]<<1|t[2]>>>31,b=t[13]<<12|t[12]>>>20,y=t[12]<<12|t[13]>>>20,G=t[22]<<10|t[23]>>>22,Y=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,P=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ft=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,N=t[14]<<6|t[15]>>>26,q=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,_=t[24]<<11|t[25]>>>21,$=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,I=t[45]<<29|t[44]>>>3,B=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,k=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,w=t[36]<<21|t[37]>>>11,M=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,K=t[8]<<27|t[9]>>>5,V=t[9]<<27|t[8]>>>5,A=t[18]<<20|t[19]>>>12,R=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,H=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,S=t[48]<<14|t[49]>>>18,x=t[49]<<14|t[48]>>>18,t[0]=p^~b&v,t[1]=m^~y&_,t[10]=E^~A&T,t[11]=k^~R&C,t[20]=L^~N&U,t[21]=j^~q&D,t[30]=K^~J&G,t[31]=V^~Z&Y,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=b^~v&w,t[3]=y^~_&M,t[12]=A^~T&O,t[13]=R^~C&P,t[22]=N^~U&H,t[23]=q^~D&z,t[32]=J^~G&$,t[33]=Z^~Y&X,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=v^~w&S,t[5]=_^~M&x,t[14]=T^~O&I,t[15]=C^~P&B,t[24]=U^~H&F,t[25]=D^~z&W,t[34]=G^~$&Q,t[35]=Y^~X&tt,t[44]=ot^~at&ct,t[45]=st^~ut&ft,t[6]=w^~S&p,t[7]=M^~x&m,t[16]=O^~I&E,t[17]=P^~B&k,t[26]=H^~F&L,t[27]=z^~W&j,t[36]=$^~Q&K,t[37]=X^~tt&V,t[46]=at^~ct&et,t[47]=ut^~ft&rt,t[8]=S^~p&b,t[9]=x^~m&y,t[18]=I^~E&A,t[19]=B^~k&R,t[28]=F^~L&N,t[29]=W^~j&q,t[38]=Q^~K&J,t[39]=tt^~V&Z,t[48]=ct^~et&nt,t[49]=ft^~rt&it,t[0]^=g[n],t[1]^=g[n+1]};if(f)t.exports=R;else{for(C=0;Cthis._socketCreate())}set readyState(t){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(t){}get connecting(){return 0===this.readyState}set connected(t){}get connected(){return 1===this.readyState}set closing(t){}get closing(){return 2===this.readyState}set closed(t){}get closed(){return 3===this.readyState}open(){this._socketCreate()}close(){this._socketClose()}send(t,e,r){if(!e||"string"!=typeof e)throw new Error("Missing or invalid topic field");this._socketSend({topic:e,type:"pub",payload:t,silent:!!r})}subscribe(t){this._socketSend({topic:t,type:"sub",payload:"",silent:!0})}on(t,e){this._events.push({event:t,callback:e})}_socketCreate(){if(this._nextSocket)return;const t=function(t,e,r){var i,o;const s=(t.startsWith("https")?t.replace("https","wss"):t.startsWith("http")?t.replace("http","ws"):t).split("?"),a=Object(n.isBrowser)()?{protocol:e,version:r,env:"browser",host:(null===(i=Object(n.getLocation)())||void 0===i?void 0:i.host)||""}:{protocol:e,version:r,env:(null===(o=Object(n.detectEnv)())||void 0===o?void 0:o.name)||""},u=Object(n.appendToQueryString)(Object(n.getQueryString)(s[1]||""),a);return s[0]+"?"+u}(this._url,this._protocol,this._version);if(this._nextSocket=new o(t),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=t=>this._socketReceive(t),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=t=>this._socketError(t),this._nextSocket.onclose=()=>{setTimeout(()=>{this._nextSocket=null,this._socketCreate()},1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(t){const e=JSON.stringify(t);this._socket&&1===this._socket.readyState?this._socket.send(e):(this._setToQueue(t),this._socketCreate())}async _socketReceive(t){let e;try{e=JSON.parse(t.data)}catch(t){return}if(this._socketSend({topic:e.topic,type:"ack",payload:"",silent:!0}),this._socket&&1===this._socket.readyState){const t=this._events.filter(t=>"message"===t.event);t&&t.length&&t.forEach(t=>t.callback(e))}}_socketError(t){const e=this._events.filter(t=>"error"===t.event);e&&e.length&&e.forEach(e=>e.callback(t))}_queueSubscriptions(){this._subscriptions.forEach(t=>this._queue.push({topic:t,type:"sub",payload:"",silent:!0})),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(t){this._queue.push(t)}_pushQueue(){this._queue.forEach(t=>this._socketSend(t)),this._queue=[]}}}).call(this,r(6))},function(t,e,r){"use strict";e.a=class{constructor(){this._eventEmitters=[],"undefined"!=typeof window&&void 0!==window.addEventListener&&(window.addEventListener("online",()=>this.trigger("online")),window.addEventListener("offline",()=>this.trigger("offline")))}on(t,e){this._eventEmitters.push({event:t,callback:e})}trigger(t){let e=[];t&&(e=this._eventEmitters.filter(e=>e.event===t)),e.forEach(t=>{t.callback()})}}},function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty,i="~";function o(){}function s(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function a(t,e,r,n,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new s(r,n||t,o),u=i?i+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],a]:t._events[u].push(a):(t._events[u]=a,t._eventsCount++),t}function u(t,e){0==--t._eventsCount?t._events=new o:delete t._events[e]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),c.prototype.eventNames=function(){var t,e,r=[];if(0===this._eventsCount)return r;for(e in t=this._events)n.call(t,e)&&r.push(i?e.slice(1):e);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},c.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,s=new Array(o);n(0,n.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.getWalletConnector();if(t)return this.start(),this.subscribeWalletConnector(),t.accounts;throw new Error("Failed to connect to WalleConnect")})),this.request=t=>(0,n.__awaiter)(this,void 0,void 0,(function*(){return this.send(t)})),this.send=(t,e)=>(0,n.__awaiter)(this,void 0,void 0,(function*(){if("string"==typeof t){const r=t;let n=e;return"personal_sign"===r&&(n=(0,a.parsePersonalSign)(n)),this.sendAsyncPromise(r,n)}if("personal_sign"===(t=Object.assign({id:(0,a.payloadId)(),jsonrpc:"2.0"},t)).method&&(t.params=(0,a.parsePersonalSign)(t.params)),!e)return this.sendAsyncPromise(t.method,t.params);this.sendAsync(t,e)})),this.onConnect=t=>{this.connectCallbacks.push(t)},this.triggerConnect=t=>{this.connectCallbacks&&this.connectCallbacks.length&&this.connectCallbacks.forEach(e=>e(t))},this.bridge=t.connector?t.connector.bridge:t.bridge||"https://bridge.walletconnect.org",this.qrcode=void 0===t.qrcode||!1!==t.qrcode,this.qrcodeModal=t.qrcodeModal||this.qrcodeModal,this.qrcodeModalOptions=t.qrcodeModalOptions,this.wc=t.connector||new i.default({bridge:this.bridge,qrcodeModal:this.qrcode?this.qrcodeModal:void 0,qrcodeModalOptions:this.qrcodeModalOptions,storageId:null==t?void 0:t.storageId,signingMethods:null==t?void 0:t.signingMethods,clientMeta:null==t?void 0:t.clientMeta}),this.rpc=t.rpc||null,!(this.rpc||t.infuraId&&"string"==typeof t.infuraId&&t.infuraId.trim()))throw new Error("Missing one of the required parameters: rpc or infuraId");this.infuraId=t.infuraId||"",this.chainId=(null==t?void 0:t.chainId)||this.chainId,this.initialize()}get isWalletConnect(){return!0}get connector(){return this.wc}get walletMeta(){return this.wc.peerMeta}disconnect(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.close()}))}close(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.getWalletConnector({disableSessionCreation:!0});yield t.killSession(),yield this.onDisconnect()}))}handleRequest(t){return(0,n.__awaiter)(this,void 0,void 0,(function*(){try{let e,r=null;const n=yield this.getWalletConnector();switch(t.method){case"wc_killSession":yield this.close(),r=null;break;case"eth_accounts":r=n.accounts;break;case"eth_coinbase":r=n.accounts[0];break;case"eth_chainId":case"net_version":r=n.chainId;break;case"eth_uninstallFilter":this.sendAsync(t,t=>t),r=!0;break;default:e=yield this.handleOtherRequests(t)}return e||this.formatResponse(t,r)}catch(t){throw this.emit("error",t),t}}))}handleOtherRequests(t){return(0,n.__awaiter)(this,void 0,void 0,(function*(){if(!a.signingMethods.includes(t.method)&&t.method.startsWith("eth_"))return this.handleReadRequests(t);const e=yield this.getWalletConnector(),r=yield e.sendCustomRequest(t);return this.formatResponse(t,r)}))}handleReadRequests(t){return(0,n.__awaiter)(this,void 0,void 0,(function*(){if(!this.http){const t=new Error("HTTP Connection not available");throw this.emit("error",t),t}return this.http.send(t)}))}formatResponse(t,e){return{id:t.id,jsonrpc:t.jsonrpc,result:e}}getWalletConnector(t={}){const{disableSessionCreation:e=!1}=t;return new Promise((t,r)=>{const n=this.wc;this.isConnecting?this.onConnect(e=>t(e)):n.connected||e?(this.connected||(this.connected=!0,this.updateState(n.session)),t(n)):(this.isConnecting=!0,n.on("modal_closed",()=>{r(new Error("User closed modal"))}),n.createSession({chainId:this.chainId}).then(()=>{n.on("connect",(e,i)=>{if(e)return this.isConnecting=!1,r(e);this.isConnecting=!1,this.connected=!0,i&&this.updateState(i.params[0]),this.emit("connect"),this.triggerConnect(n),t(n)})}).catch(t=>{this.isConnecting=!1,r(t)}))})}subscribeWalletConnector(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.getWalletConnector();t.on("disconnect",t=>{t?this.emit("error",t):this.onDisconnect()}),t.on("session_update",(t,e)=>{t?this.emit("error",t):this.updateState(e.params[0])})}))}onDisconnect(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){yield this.stop(),this.emit("close",1e3,"Connection closed"),this.emit("disconnect",1e3,"Connection disconnected"),this.connected=!1}))}updateState(t){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const{accounts:e,chainId:r,networkId:n,rpcUrl:i}=t;(!this.accounts||e&&this.accounts!==e)&&(this.accounts=e,this.emit("accountsChanged",e)),(!this.chainId||r&&this.chainId!==r)&&(this.chainId=r,this.emit("chainChanged",r)),(!this.networkId||n&&this.networkId!==n)&&(this.networkId=n,this.emit("networkChanged",n)),this.updateRpcUrl(this.chainId,i||"")}))}updateRpcUrl(t,e=""){const r={infuraId:this.infuraId,custom:this.rpc||void 0};(e=e||(0,a.getRpcUrl)(t,r))?(this.rpcUrl=e,this.updateHttpConnection()):this.emit("error",new Error("No RPC Url available for chainId: "+t))}updateHttpConnection(){this.rpcUrl&&(this.http=new s.default(this.rpcUrl),this.http.on("payload",t=>this.emit("payload",t)),this.http.on("error",t=>this.emit("error",t)))}sendAsyncPromise(t,e){return new Promise((r,n)=>{this.sendAsync({id:(0,a.payloadId)(),jsonrpc:"2.0",method:t,params:e||[]},(t,e)=>{t?n(t):r(e.result)})})}initialize(){this.updateRpcUrl(this.chainId),this.addProvider(new f({eth_hashrate:"0x00",eth_mining:!1,eth_syncing:!0,net_listening:!0,web3_clientVersion:"WalletConnect/v1.x.x/javascript"})),this.addProvider(new c),this.addProvider(new p),this.addProvider(new h),this.addProvider(new d),this.addProvider(new l(this.configWallet())),this.addProvider({handleRequest:(t,e,r)=>(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const{error:e,result:n}=yield this.handleRequest(t);r(e,n)}catch(t){r(t)}})),setEngine:t=>t})}configWallet(){return{getAccounts:t=>(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const e=(yield this.getWalletConnector()).accounts;e&&e.length?t(null,e):t(new Error("Failed to get accounts"))}catch(e){t(e)}})),processMessage:(t,e)=>(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signMessage([t.from,t.data]);e(null,n)}catch(t){e(t)}})),processPersonalMessage:(t,e)=>(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signPersonalMessage([t.data,t.from]);e(null,n)}catch(t){e(t)}})),processSignTransaction:(t,e)=>(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signTransaction(t);e(null,n)}catch(t){e(t)}})),processTransaction:(t,e)=>(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.sendTransaction(t);e(null,n)}catch(t){e(t)}})),processTypedMessage:(t,e)=>(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signTypedData([t.from,t.data]);e(null,n)}catch(t){e(t)}}))}}}},function(t,e,r){"use strict";r.r(e),r.d(e,"__extends",(function(){return i})),r.d(e,"__assign",(function(){return o})),r.d(e,"__rest",(function(){return s})),r.d(e,"__decorate",(function(){return a})),r.d(e,"__param",(function(){return u})),r.d(e,"__metadata",(function(){return c})),r.d(e,"__awaiter",(function(){return f})),r.d(e,"__generator",(function(){return h})),r.d(e,"__exportStar",(function(){return l})),r.d(e,"__values",(function(){return d})),r.d(e,"__read",(function(){return p})),r.d(e,"__spread",(function(){return m})),r.d(e,"__await",(function(){return g})),r.d(e,"__asyncGenerator",(function(){return b})),r.d(e,"__asyncDelegator",(function(){return y})),r.d(e,"__asyncValues",(function(){return v})),r.d(e,"__makeTemplateObject",(function(){return _})),r.d(e,"__importStar",(function(){return w})),r.d(e,"__importDefault",(function(){return M})); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function i(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var o=function(){return(o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function u(t,e){return function(r,n){e(r,n,t)}}function c(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function f(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new r((function(e){e(t.value)})).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function h(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function p(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function m(){for(var t=[],e=0;e1||a(t,e)}))})}function a(t,e){try{(r=i[t](e)).value instanceof g?Promise.resolve(r.value.v).then(u,c):f(o[0][2],r)}catch(t){f(o[0][3],t)}var r}function u(t){a("next",t)}function c(t){a("throw",t)}function f(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}}function y(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,i){e[n]=t[n]?function(e){return(r=!r)?{value:g(t[n](e)),done:"return"===n}:i?i(e):e}:i}}function v(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=d(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,i){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,i,(e=t[r](e)).done,e.value)}))}}}function _(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function w(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function M(t){return t&&t.__esModule?t:{default:t}}},function(t,e){},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),s=n[0],a=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),f=0,h=a>0?s-4:s;for(r=0;r>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[f++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)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 f(t,e,r){for(var i,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,f=-7,h=r?i-1:0,l=r?-1:1,d=t[e+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;t[r+d]=255&s,d+=p,s/=256,c-=8);t[r+d-p]|=128*m}},function(t,e,r){(function(e){var n=r(79).strict;t.exports=function(t){if(n(t)){var r=e.from(t.buffer);return t.byteLength!==t.buffer.byteLength&&(r=r.slice(t.byteOffset,t.byteOffset+t.byteLength)),r}return e.from(t)}}).call(this,r(2).Buffer)},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,r){"use strict";(function(t){function r(){return(null==t?void 0:t.crypto)||(null==t?void 0:t.msCrypto)||{}}function n(){const t=r();return t.subtle||t.webkitSubtle}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowserCryptoAvailable=e.getSubtleCrypto=e.getBrowerCrypto=void 0,e.getBrowerCrypto=r,e.getSubtleCrypto=n,e.isBrowserCryptoAvailable=function(){return!!r()&&!!n()}}).call(this,r(6))},function(t,e,r){"use strict";(function(t){function r(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function n(){return void 0!==t&&void 0!==t.versions&&void 0!==t.versions.node}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=e.isNode=e.isReactNative=void 0,e.isReactNative=r,e.isNode=n,e.isBrowser=function(){return!r()&&!n()}}).call(this,r(5))},function(t,e,r){"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())},function(t,e,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),i=new RegExp("(%[a-f0-9]{2})+","gi");function o(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],o(r),o(n))}function s(t){try{return decodeURIComponent(t)}catch(i){for(var e=t.match(n),r=1;r{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const r=t.indexOf(e);return-1===r?[t]:[t.slice(0,r),t.slice(r+e.length)]}},function(t,e,r){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(t,e,r){(function(e){function n(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var i=r(76),o=n(r(179)),s=n(r(200)),a=r(376);"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function u(t){return a.createElement("div",{className:"walletconnect-modal__header"},a.createElement("img",{src:"data:image/svg+xml,%3C?xml version='1.0' encoding='UTF-8'?%3E %3Csvg width='300px' height='185px' viewBox='0 0 300 185' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3C!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch --%3E %3Ctitle%3EWalletConnect%3C/title%3E %3Cdesc%3ECreated with Sketch.%3C/desc%3E %3Cdefs%3E%3C/defs%3E %3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E %3Cg id='walletconnect-logo-alt' fill='%233B99FC' fill-rule='nonzero'%3E %3Cpath d='M61.4385429,36.2562612 C110.349767,-11.6319051 189.65053,-11.6319051 238.561752,36.2562612 L244.448297,42.0196786 C246.893858,44.4140867 246.893858,48.2961898 244.448297,50.690599 L224.311602,70.406102 C223.088821,71.6033071 221.106302,71.6033071 219.883521,70.406102 L211.782937,62.4749541 C177.661245,29.0669724 122.339051,29.0669724 88.2173582,62.4749541 L79.542302,70.9685592 C78.3195204,72.1657633 76.337001,72.1657633 75.1142214,70.9685592 L54.9775265,51.2530561 C52.5319653,48.8586469 52.5319653,44.9765439 54.9775265,42.5821357 L61.4385429,36.2562612 Z M280.206339,77.0300061 L298.128036,94.5769031 C300.573585,96.9713 300.573599,100.85338 298.128067,103.247793 L217.317896,182.368927 C214.872352,184.763353 210.907314,184.76338 208.461736,182.368989 C208.461726,182.368979 208.461714,182.368967 208.461704,182.368957 L151.107561,126.214385 C150.496171,125.615783 149.504911,125.615783 148.893521,126.214385 C148.893517,126.214389 148.893514,126.214393 148.89351,126.214396 L91.5405888,182.368927 C89.095052,184.763359 85.1300133,184.763399 82.6844276,182.369014 C82.6844133,182.369 82.684398,182.368986 82.6843827,182.36897 L1.87196327,103.246785 C-0.573596939,100.852377 -0.573596939,96.9702735 1.87196327,94.5758653 L19.7936929,77.028998 C22.2392531,74.6345898 26.2042918,74.6345898 28.6498531,77.028998 L86.0048306,133.184355 C86.6162214,133.782957 87.6074796,133.782957 88.2188704,133.184355 C88.2188796,133.184346 88.2188878,133.184338 88.2188969,133.184331 L145.571,77.028998 C148.016505,74.6345347 151.981544,74.6344449 154.427161,77.028798 C154.427195,77.0288316 154.427229,77.0288653 154.427262,77.028899 L211.782164,133.184331 C212.393554,133.782932 213.384814,133.782932 213.996204,133.184331 L271.350179,77.0300061 C273.79574,74.6355969 277.760778,74.6355969 280.206339,77.0300061 Z' id='WalletConnect'%3E%3C/path%3E %3C/g%3E %3C/g%3E %3C/svg%3E",className:"walletconnect-modal__headerLogo"}),a.createElement("p",null,"WalletConnect"),a.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:t.onClose},a.createElement("div",{id:"walletconnect-qrcode-close",className:"walletconnect-modal__close__icon"},a.createElement("div",{className:"walletconnect-modal__close__line1"}),a.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function c(t){return a.createElement("a",{className:"walletconnect-connect__button",href:t.href,id:"walletconnect-connect-button-"+t.name,onClick:t.onClick,rel:"noopener noreferrer",style:{backgroundColor:t.color},target:"_blank"},t.name)}function f(t){var e=t.color,r=t.href,n=t.name,i=t.logo,o=t.onClick;return a.createElement("a",{className:"walletconnect-modal__base__row",href:r,onClick:o,rel:"noopener noreferrer",target:"_blank"},a.createElement("h3",{className:"walletconnect-modal__base__row__h3"},n),a.createElement("div",{className:"walletconnect-modal__base__row__right"},a.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+i+"') "+e,backgroundSize:"100%"}}),a.createElement("img",{src:"data:image/svg+xml,%3Csvg width='8' height='18' viewBox='0 0 8 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0.586301 0.213898C0.150354 0.552968 0.0718197 1.18124 0.41089 1.61719L5.2892 7.88931C5.57007 8.25042 5.57007 8.75608 5.2892 9.11719L0.410889 15.3893C0.071819 15.8253 0.150353 16.4535 0.586301 16.7926C1.02225 17.1317 1.65052 17.0531 1.98959 16.6172L6.86791 10.3451C7.7105 9.26174 7.7105 7.74476 6.86791 6.66143L1.98959 0.38931C1.65052 -0.0466374 1.02225 -0.125172 0.586301 0.213898Z' fill='%233C4252'/%3E %3C/svg%3E",className:"walletconnect-modal__base__row__right__caret"})))}function h(t){var e=t.color,r=t.href,n=t.name,i=t.logo,o=t.onClick,s=window.innerWidth<768?(n.length>8?2.5:2.7)+"vw":"inherit";return a.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:r,onClick:o,rel:"noopener noreferrer",target:"_blank"},a.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+i+"') "+e,backgroundSize:"100%"}}),a.createElement("div",{style:{fontSize:s},className:"walletconnect-connect__button__text"},n))}function l(t){var e=i.isAndroid(),r=a.useState(""),n=r[0],o=r[1],s=a.useState(""),u=s[0],l=s[1],d=a.useState(1),p=d[0],m=d[1],g=u?t.links.filter((function(t){return t.name.toLowerCase().includes(u.toLowerCase())})):t.links,b=t.errorMessage,y=u||g.length>5,v=Math.ceil(g.length/12),_=[12*(p-1)+1,12*p],w=g.length?g.filter((function(t,e){return e+1>=_[0]&&e+1<=_[1]})):[],M=!(e||!(v>1)),S=void 0;return a.createElement("div",null,a.createElement("p",{id:"walletconnect-qrcode-text",className:"walletconnect-qrcode__text"},e?t.text.connect_mobile_wallet:t.text.choose_preferred_wallet),!e&&a.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:n,onChange:function(t){o(t.target.value),clearTimeout(S),t.target.value?S=setTimeout((function(){l(t.target.value),m(1)}),1e3):(o(""),l(""),m(1))}}),a.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(e?"__android":y&&g.length?"__wrap":"")},e?a.createElement(c,{name:t.text.connect,color:"rgb(64, 153, 255)",href:t.uri,onClick:a.useCallback((function(){i.saveMobileLinkInfo({name:"Unknown",href:t.uri})}),[])}):w.length?w.map((function(e){var r=e.color,n=e.name,o=e.shortName,s=e.logo,u=i.formatIOSMobile(t.uri,e),c=a.useCallback((function(){i.saveMobileLinkInfo({name:n,href:u})}),[w]);return y?a.createElement(h,{color:r,href:u,name:o,logo:s,onClick:c}):a.createElement(f,{color:r,href:u,name:n,logo:s,onClick:c})})):a.createElement(a.Fragment,null,a.createElement("p",null,b.length?t.errorMessage:t.links.length&&!g.length?t.text.no_wallets_found:t.text.loading))),M&&a.createElement("div",{className:"walletconnect-modal__footer"},Array(v).fill(0).map((function(t,e){var r=e+1,n=p===r;return a.createElement("a",{style:{margin:"auto 10px",fontWeight:n?"bold":"normal"},onClick:function(){return m(r)}},r)}))))}function d(t){var e=!!t.message.trim();return a.createElement("div",{className:"walletconnect-qrcode__notification"+(e?" notification__show":"")},t.message)}function p(t){var e=a.useState(""),r=e[0],n=e[1],i=a.useState(""),u=i[0],c=i[1];a.useEffect((function(){try{return Promise.resolve(function(t){try{var e="";return Promise.resolve(o.toString(t,{margin:0,type:"svg"})).then((function(t){return"string"==typeof t&&(e=t.replace("0||a.useEffect((function(){!function(){try{if(e)return Promise.resolve();c(!0);var o=function(t,e){try{var r=t()}catch(t){return e(t)}return r&&r.then?r.then(void 0,e):r}((function(){var e=t.qrcodeModalOptions&&t.qrcodeModalOptions.registryUrl?t.qrcodeModalOptions.registryUrl:i.getWalletRegistryUrl();return Promise.resolve(fetch(e).then((function(t){return t.json()}))).then((function(e){var o=r?"mobile":"desktop",s=i.getMobileLinkRegistry(i.formatMobileRegistry(e,o),n);c(!1),d(!0),C(s.length?"":t.text.no_supported_wallets),A(s);var a=1===s.length;a&&(w(i.formatIOSMobile(t.uri,s[0])),b(!0)),x(a)}))}),(function(e){c(!1),d(!0),C(t.text.something_went_wrong),console.error(e)}));Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(t){return Promise.reject(t)}}()}))};O();var P=r?g:!g;return a.createElement("div",{id:"walletconnect-qrcode-modal",className:"walletconnect-qrcode__base animated fadeIn"},a.createElement("div",{className:"walletconnect-modal__base"},a.createElement(u,{onClose:t.onClose}),S&&g?a.createElement("div",{className:"walletconnect-modal__single_wallet"},a.createElement("a",{onClick:function(){return i.saveMobileLinkInfo({name:k[0].name,href:_})},href:_,rel:"noopener noreferrer",target:"_blank"},t.text.connect_with+" "+(S?k[0].name:"")+" ›")):e||s||!s&&k.length?a.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(P?" right__selected":"")},a.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),r?a.createElement(a.Fragment,null,a.createElement("a",{onClick:function(){return b(!1),O()}},t.text.mobile),a.createElement("a",{onClick:function(){return b(!0)}},t.text.qrcode)):a.createElement(a.Fragment,null,a.createElement("a",{onClick:function(){return b(!0)}},t.text.qrcode),a.createElement("a",{onClick:function(){return b(!1),O()}},t.text.desktop))):null,a.createElement("div",null,g||!e&&!s&&!k.length?a.createElement(p,Object.assign({},y)):a.createElement(l,Object.assign({},y,{links:k,errorMessage:T})))))}var g={de:{choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},en:{choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},es:{choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},fr:{choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},ko:{choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},pt:{choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},zh:{choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},fa:{choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"}};function b(){var t=i.getDocumentOrThrow(),e=t.getElementById("walletconnect-qrcode-modal");e&&(e.className=e.className.replace("fadeIn","fadeOut"),setTimeout((function(){var e=t.getElementById("walletconnect-wrapper");e&&t.body.removeChild(e)}),300))}function y(t){return function(){b(),t&&t()}}function v(t,e,r){!function(){var t=i.getDocumentOrThrow(),e=t.getElementById("walletconnect-style-sheet");e&&t.head.removeChild(e);var r=t.createElement("style");r.setAttribute("id","walletconnect-style-sheet"),r.innerText=':root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,\n "Open Sans", "Helvetica Neue", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url("images/wc-logo.svg") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n',t.head.appendChild(r)}();var n,o=function(){var t=i.getDocumentOrThrow(),e=t.createElement("div");return e.setAttribute("id","walletconnect-wrapper"),t.body.appendChild(e),e}();a.render(a.createElement(m,{text:(n=i.getNavigatorOrThrow().language.split("-")[0]||"en",g[n]||g.en),uri:t,onClose:y(e),qrcodeModalOptions:r}),o)}var _=function(){return void 0!==e&&void 0!==e.versions&&void 0!==e.versions.node};var w={open:function(t,e,r){console.log(t),_()?function(t){o.toString(t,{type:"terminal"}).then(console.log)}(t):v(t,e,r)},close:function(){_()||b()}};t.exports=w}).call(this,r(5))},function(t,e,r){var n=r(180),i=r(181),o=r(198),s=r(199);function a(t,e,r,o,s){var a=[].slice.call(arguments,1),u=a.length,c="function"==typeof a[u-1];if(!c&&!n())throw new Error("Callback required as last argument");if(!c){if(u<1)throw new Error("Too few arguments provided");return 1===u?(r=e,e=o=void 0):2!==u||e.getContext||(o=r,r=e,e=void 0),new Promise((function(n,s){try{var a=i.create(r,o);n(t(a,e,o))}catch(t){s(t)}}))}if(u<2)throw new Error("Too few arguments provided");2===u?(s=r,r=e,e=o=void 0):3===u&&(e.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=r,r=e,e=void 0));try{var f=i.create(r,o);s(null,t(f,e,o))}catch(t){s(t)}}e.create=i.create,e.toCanvas=a.bind(null,o.render),e.toDataURL=a.bind(null,o.renderToDataURL),e.toString=a.bind(null,(function(t,e,r){return s.render(t,r)}))},function(t,e){t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},function(t,e,r){var n=r(26),i=r(17),o=r(51),s=r(182),a=r(183),u=r(184),c=r(185),f=r(186),h=r(98),l=r(187),d=r(190),p=r(191),m=r(18),g=r(192),b=r(50);function y(t,e,r){var n,i,o=t.size,s=p.getEncodedBits(e,r);for(n=0;n<15;n++)i=1==(s>>n&1),n<6?t.set(n,8,i,!0):n<8?t.set(n+1,8,i,!0):t.set(o-15+n,8,i,!0),n<8?t.set(8,o-n-1,i,!0):n<9?t.set(8,15-n-1+1,i,!0):t.set(8,15-n-1,i,!0);t.set(o-8,8,1,!0)}function v(t,e,r){var o=new s;r.forEach((function(e){o.put(e.mode.bit,4),o.put(e.getLength(),m.getCharCountIndicator(e.mode,t)),e.write(o)}));var a=8*(i.getSymbolTotalCodewords(t)-h.getTotalCodewordsCount(t,e));for(o.getLengthInBits()+4<=a&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(0);for(var u=(a-o.getLengthInBits())/8,c=0;c=0&&a<=6&&(0===u||6===u)||u>=0&&u<=6&&(0===a||6===a)||a>=2&&a<=4&&u>=2&&u<=4?t.set(o+a,s+u,!0,!0):t.set(o+a,s+u,!1,!0))}(_,e),function(t){for(var e=t.size,r=8;r=7&&function(t,e){for(var r,n,i,o=t.size,s=d.getEncodedBits(e),a=0;a<18;a++)r=Math.floor(a/3),n=a%3+o-8-3,i=1==(s>>a&1),t.set(r,n,i,!0),t.set(n,r,i,!0)}(_,e),function(t,e){for(var r=t.size,n=-1,i=r-1,o=7,s=0,a=r-1;a>0;a-=2)for(6===a&&a--;;){for(var u=0;u<2;u++)if(!t.isReserved(i,a-u)){var c=!1;s>>o&1)),t.set(i,a-u,c),-1===--o&&(s++,o=7)}if((i+=n)<0||r<=i){i-=n,n=-n;break}}}(_,p),isNaN(n)&&(n=f.getBestMask(_,y.bind(null,_,r))),f.applyMask(n,_),y(_,r,n),{modules:_,version:e,errorCorrectionLevel:r,maskPattern:n,segments:o}}e.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");var r,n,s=o.M;return void 0!==e&&(s=o.from(e.errorCorrectionLevel,o.M),r=d.from(e.version),n=f.from(e.maskPattern),e.toSJISFunc&&i.setToSJISFunction(e.toSJISFunc)),_(t,r,s,n)}},function(t,e){function r(){this.buffer=[],this.length=0}r.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},t.exports=r},function(t,e,r){var n=r(26);function i(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=n.alloc(t*t),this.reservedBit=n.alloc(t*t)}i.prototype.set=function(t,e,r,n){var i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)},i.prototype.get=function(t,e){return this.data[t*this.size+e]},i.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},i.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]},t.exports=i},function(t,e,r){var n=r(17).getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];for(var e=Math.floor(t/7)+2,r=n(t),i=145===r?26:2*Math.ceil((r-13)/(2*e-2)),o=[r-7],s=1;s=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){for(var e=t.size,n=0,i=0,o=0,s=null,a=null,u=0;u=5&&(n+=r+(i-5)),s=f,i=1),(f=t.get(c,u))===a?o++:(o>=5&&(n+=r+(o-5)),a=f,o=1)}i>=5&&(n+=r+(i-5)),o>=5&&(n+=r+(o-5))}return n},e.getPenaltyN2=function(t){for(var e=t.size,r=0,i=0;i=10&&(1488===n||93===n)&&r++,o=o<<1&2047|t.get(a,s),a>=10&&(1488===o||93===o)&&r++}return r*i},e.getPenaltyN4=function(t){for(var e=0,r=t.data.length,n=0;n0){var u=n.alloc(this.degree);return s.copy(u,a),u}return s},t.exports=s},function(t,e,r){var n=r(26),i=r(189);e.mul=function(t,e){for(var r=n.alloc(t.length+e.length-1),o=0;o=0;){for(var o=r[0],s=0;s1)return function(t,r){for(var n=1;n<=40;n++){if(h(t,n)<=e.getCapacity(n,r,s.MIXED))return n}}(t,i);if(0===t.length)return 1;n=t[0]}else n=t;return function(t,r,n){for(var i=1;i<=40;i++)if(r<=e.getCapacity(i,n,t))return i}(n.mode,n.getLength(),i)},e.getEncodedBits=function(t){if(!a.isValid(t)||t<7)throw new Error("Invalid QR Code version");for(var e=t<<12;n.getBCHDigit(e)-c>=0;)e^=7973<=0;)o^=1335<=0?t[t.length-1]:null;return r&&r.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}(s))},e.rawSplit=function(t){return e.fromArray(d(t,c.isKanjiModeEnabled()))}},function(t,e,r){var n=r(18);function i(t){this.mode=n.NUMERIC,this.data=t.toString()}i.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(t){var e,r,n;for(e=0;e+3<=this.data.length;e+=3)r=this.data.substr(e,3),n=parseInt(r,10),t.put(n,10);var i=this.data.length-e;i>0&&(r=this.data.substr(e),n=parseInt(r,10),t.put(n,3*i+1))},t.exports=i},function(t,e,r){var n=r(18),i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function o(t){this.mode=n.ALPHANUMERIC,this.data=t}o.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){var e;for(e=0;e+2<=this.data.length;e+=2){var r=45*i.indexOf(this.data[e]);r+=i.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(i.indexOf(this.data[e]),6)},t.exports=o},function(t,e,r){var n=r(26),i=r(18);function o(t){this.mode=i.BYTE,this.data=n.from(t)}o.getBitsLength=function(t){return 8*t},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){for(var e=0,r=this.data.length;e=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),t.put(r,13)}},t.exports=o},function(t,e,r){"use strict";var n={single_source_shortest_paths:function(t,e,r){var i={},o={};o[e]=0;var s,a,u,c,f,h,l,d=n.PriorityQueue.make();for(d.push(e,0);!d.empty();)for(u in a=(s=d.pop()).value,c=s.cost,f=t[a]||{})f.hasOwnProperty(u)&&(h=c+f[u],l=o[u],(void 0===o[u]||l>h)&&(o[u]=h,d.push(u,h),i[u]=a));if(void 0!==r&&void 0===o[r]){var p=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e;n;)r.push(n),t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var i=n.single_source_shortest_paths(t,e,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var e,r=n.PriorityQueue,i={};for(e in t=t||{},r)r.hasOwnProperty(e)&&(i[e]=r[e]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=n},function(t,e,r){var n=r(101);e.render=function(t,e,r){var i=r,o=e;void 0!==i||e&&e.getContext||(i=e,e=void 0),e||(o=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),i=n.getOptions(i);var s=n.getImageWidth(t.modules.size,i),a=o.getContext("2d"),u=a.createImageData(s,s);return n.qrToImageData(u.data,t,i),function(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}(a,o,s),a.putImageData(u,0,0),o},e.renderToDataURL=function(t,r,n){var i=n;void 0!==i||r&&r.getContext||(i=r,r=void 0),i||(i={});var o=e.render(t,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}},function(t,e,r){var n=r(101);function i(t,e){var r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function o(t,e,r){var n=t+e;return void 0!==r&&(n+=" "+r),n}e.render=function(t,e,r){var s=n.getOptions(e),a=t.modules.size,u=t.modules.data,c=a+2*s.margin,f=s.color.light.a?"':"",h="0&&c>0&&t[u-1]||(n+=s?o("M",c+r,.5+f+r):o("m",i,0),i=0,s=!1),c+1',l='viewBox="0 0 '+c+" "+c+'"',d=''+f+h+"\n";return"function"==typeof r&&r(null,d),d}},function(t,e,r){"use strict";var n=r(201),i={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(t,e){var r,o,s,a,u,c,f=!1;e||(e={}),r=e.debug||!1;try{if(s=n(),a=document.createRange(),u=document.getSelection(),(c=document.createElement("span")).textContent=t,c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(n){if(n.stopPropagation(),e.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=i[e.format]||i.default;window.clipboardData.setData(o,t)}else n.clipboardData.clearData(),n.clipboardData.setData(e.format,t);e.onCopy&&(n.preventDefault(),e.onCopy(n.clipboardData))})),document.body.appendChild(c),a.selectNodeContents(c),u.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");f=!0}catch(n){r&&console.error("unable to copy using execCommand: ",n),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),f=!0}catch(n){r&&console.error("unable to copy using clipboardData: ",n),r&&console.error("falling back to prompt"),o=function(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}("message"in e?e.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,t)}}finally{u&&("function"==typeof u.removeRange?u.removeRange(a):u.removeAllRanges()),c&&document.body.removeChild(c),s()}return f}},function(t,e){t.exports=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],n=0;n{if("eth_subscribe"===t.method){const e=this.formatError(t,"Subscriptions are not supported by this HTTP endpoint");return this.emit("error",e),r(e)}const n=new a;let i=!1;const o=(o,s)=>{if(!i)if(n.abort(),i=!0,e)e(o,s);else{const{id:e,jsonrpc:n}=t,i=o?{id:e,jsonrpc:n,error:{message:o.message,code:o.code}}:{id:e,jsonrpc:n,result:s};this.emit("payload",i),r(i)}};n.open("POST",this.url,!0),n.setRequestHeader("Content-Type","application/json"),n.timeout=6e4,n.onerror=o,n.ontimeout=o,n.onreadystatechange=()=>{if(4===n.readyState)try{const t=JSON.parse(n.responseText);o(t.error,t.result)}catch(t){o(t)}},n.send(JSON.stringify(t))})}}e.default=u},function(t,e,r){"use strict";(function(t,n){var i,o=this&&this.__extends||(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r=0)return this._url=this._parseUrl(e.headers.location),this._method="GET",this._loweredHeaders["content-type"]&&(delete this._headers[this._loweredHeaders["content-type"]],delete this._loweredHeaders["content-type"]),null!=this._headers["Content-Type"]&&delete this._headers["Content-Type"],delete this._headers["Content-Length"],this.upload._reset(),this._finalizeHeaders(),void this._sendHxxpRequest();this._response=e,this._response.on("data",(function(t){return n._onHttpResponseData(e,t)})),this._response.on("end",(function(){return n._onHttpResponseEnd(e)})),this._response.on("close",(function(){return n._onHttpResponseClose(e)})),this.responseUrl=this._url.href.split("#")[0],this.status=e.statusCode,this.statusText=a.STATUS_CODES[this.status],this._parseResponseHeaders(e);var i=this._responseHeaders["content-length"]||"";this._totalBytes=+i,this._lengthComputable=!!i,this._setReadyState(r.HEADERS_RECEIVED)}},r.prototype._onHttpResponseData=function(t,e){this._response===t&&(this._responseParts.push(new n(e)),this._loadedBytes+=e.length,this.readyState!==r.LOADING&&this._setReadyState(r.LOADING),this._dispatchProgress("progress"))},r.prototype._onHttpResponseEnd=function(t){this._response===t&&(this._parseResponse(),this._request=null,this._response=null,this._setReadyState(r.DONE),this._dispatchProgress("load"),this._dispatchProgress("loadend"))},r.prototype._onHttpResponseClose=function(t){if(this._response===t){var e=this._request;this._setError(),e.abort(),this._setReadyState(r.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend")}},r.prototype._onHttpTimeout=function(t){this._request===t&&(this._setError(),t.abort(),this._setReadyState(r.DONE),this._dispatchProgress("timeout"),this._dispatchProgress("loadend"))},r.prototype._onHttpRequestError=function(t,e){this._request===t&&(this._setError(),t.abort(),this._setReadyState(r.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend"))},r.prototype._dispatchProgress=function(t){var e=new r.ProgressEvent(t);e.lengthComputable=this._lengthComputable,e.loaded=this._loadedBytes,e.total=this._totalBytes,this.dispatchEvent(e)},r.prototype._setError=function(){this._request=null,this._response=null,this._responseHeaders=null,this._responseParts=null},r.prototype._parseUrl=function(t,e,r){var n=null==this.nodejsBaseUrl?t:f.resolve(this.nodejsBaseUrl,t),i=f.parse(n,!1,!0);i.hash=null;var o=(i.auth||"").split(":"),s=o[0],a=o[1];return(s||a||e||r)&&(i.auth=(e||s||"")+":"+(r||a||"")),i},r.prototype._parseResponseHeaders=function(t){for(var e in this._responseHeaders={},t.headers){var r=e.toLowerCase();this._privateHeaders[r]||(this._responseHeaders[r]=t.headers[e])}null!=this._mimeOverride&&(this._responseHeaders["content-type"]=this._mimeOverride)},r.prototype._parseResponse=function(){var t=n.concat(this._responseParts);switch(this._responseParts=null,this.responseType){case"json":this.responseText=null;try{this.response=JSON.parse(t.toString("utf-8"))}catch(t){this.response=null}return;case"buffer":return this.responseText=null,void(this.response=t);case"arraybuffer":this.responseText=null;for(var e=new ArrayBuffer(t.length),r=new Uint8Array(e),i=0;i0?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 n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=o,i=a,e.copy(r,i),a+=s.data.length,s=s.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,i,o,s,a,u=1,c={},f=!1,h=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,n=function(t){var e=h.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):n=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,p=String.fromCharCode;function m(t){throw new RangeError(l[t])}function g(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function b(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+g((t=t.replace(h,".")).split("."),e).join(".")}function y(t){for(var e,r,n=[],i=0,o=t.length;i=55296&&e<=56319&&i65535&&(e+=p((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=p(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var n=0;for(t=r?d(t/700):t>>1,t+=d(t/e);t>455;n+=36)t=d(t/35);return d(n+36*t/(t+38))}function M(t){var e,r,n,i,o,s,a,c,f,h,l,p=[],g=t.length,b=0,y=128,_=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&m("not-basic"),p.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=g&&m("invalid-input"),((c=(l=t.charCodeAt(i++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36)>=36||c>d((u-b)/s))&&m("overflow"),b+=c*s,!(c<(f=a<=_?1:a>=_+26?26:a-_));a+=36)s>d(u/(h=36-f))&&m("overflow"),s*=h;_=w(b-o,e=p.length+1,0==o),d(b/e)>u-y&&m("overflow"),y+=d(b/e),b%=e,p.splice(b++,0,y)}return v(p)}function S(t){var e,r,n,i,o,s,a,c,f,h,l,g,b,v,M,S=[];for(g=(t=y(t)).length,e=128,r=0,o=72,s=0;s=e&&ld((u-r)/(b=n+1))&&m("overflow"),r+=(a-e)*b,e=a,s=0;su&&m("overflow"),l==e){for(c=r,f=36;!(c<(h=f<=o?1:f>=o+26?26:f-o));f+=36)M=c-h,v=36-h,S.push(p(_(h+M%v,0))),c=d(M/v);S.push(p(_(c,0))),o=w(r,b,n==i),r=0,++n}++r,++e}return S.join("")}a={version:"1.4.1",ucs2:{decode:y,encode:v},decode:M,encode:S,toASCII:function(t){return b(t,(function(t){return f.test(t)?"xn--"+S(t):t}))},toUnicode:function(t){return b(t,(function(t){return c.test(t)?M(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return a}.call(e,r,e,t))||(t.exports=i)}()}).call(this,r(25)(t),r(6))},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(216),e.encode=e.stringify=r(217)},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,o){e=e||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var f=0;f=0?(h=m.substr(0,g),l=m.substr(g+1)):(h=m,l=""),d=decodeURIComponent(h),p=decodeURIComponent(l),n(s,d)?i(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,a){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?o(s(t),(function(s){var a=encodeURIComponent(n(s))+r;return i(t[s])?o(t[s],(function(t){return a+encodeURIComponent(n(t))})).join(e):a+encodeURIComponent(n(t[s]))})).join(e):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n{e._getBlockByNumberWithRetry(t,(t,r)=>{if(t)return void this.emit("error",t);if(!r)return console.log(r),void this.emit("error",new Error("Could not find block"));const n=(i=r,{number:o.toBuffer(i.number),hash:o.toBuffer(i.hash),parentHash:o.toBuffer(i.parentHash),nonce:o.toBuffer(i.nonce),mixHash:o.toBuffer(i.mixHash),sha3Uncles:o.toBuffer(i.sha3Uncles),logsBloom:o.toBuffer(i.logsBloom),transactionsRoot:o.toBuffer(i.transactionsRoot),stateRoot:o.toBuffer(i.stateRoot),receiptsRoot:o.toBuffer(i.receiptRoot||i.receiptsRoot),miner:o.toBuffer(i.miner),difficulty:o.toBuffer(i.difficulty),totalDifficulty:o.toBuffer(i.totalDifficulty),size:o.toBuffer(i.size),extraData:o.toBuffer(i.extraData),gasLimit:o.toBuffer(i.gasLimit),gasUsed:o.toBuffer(i.gasUsed),timestamp:o.toBuffer(i.timestamp),transactions:i.transactions});var i;e._setCurrentBlock(n),e.emit("rawBlock",r),e.emit("latest",r)})}),e._blockTracker.on("sync",e.emit.bind(e,"sync")),e._blockTracker.on("error",e.emit.bind(e,"error")),e._running=!0,e.emit("start")},l.prototype.stop=function(){this._blockTracker.removeAllListeners(),this._running=!1,this.emit("stop")},l.prototype.isRunning=function(){return this._running},l.prototype.addProvider=function(t,e){const r=this;"number"==typeof e?r._providers.splice(e,0,t):r._providers.push(t),t.setEngine(this)},l.prototype.removeProvider=function(t){const e=this._providers.indexOf(t);if(e<0)throw new Error("Provider not found.");this._providers.splice(e,1)},l.prototype.send=function(t){throw new Error("Web3ProviderEngine does not support synchronous requests.")},l.prototype.sendAsync=function(t,e){const r=this;r._ready.await((function(){Array.isArray(t)?a(t,r._handleAsync.bind(r),e):r._handleAsync(t,e)}))},l.prototype._getBlockByNumberWithRetry=function(t,e){const r=this;let n=5;return void i();function i(){r._getBlockByNumber(t,o)}function o(t,r){return t?e(t):r?void e(null,r):n>0?(n--,void setTimeout((function(){i()}),1e3)):void e(null,null)}},l.prototype._getBlockByNumber=function(t,e){const r=f({method:"eth_getBlockByNumber",params:[t,!1],skipCache:!0});this._handleAsync(r,(t,r)=>t?e(t):e(null,r.result))},l.prototype._handleAsync=function(t,e){var r=this,n=-1,i=null,o=null,s=[];function a(r,n){o=r,i=n,u(s,(function(t,e){t?t(o,i,e):e()}),(function(){var r={id:t.id,jsonrpc:t.jsonrpc,result:i};null!=o?(r.error={message:o.stack||o.message||o,code:-32e3},e(o,r)):e(null,r)}))}!function e(i){if(n+=1,s.unshift(i),n>=r._providers.length)a(new Error('Request for method "'+t.method+'" not handled by any subprovider. Please check your subprovider configuration to ensure this method is handled.'));else try{r._providers[n].handleRequest(t,e,a)}catch(t){a(t)}}()},l.prototype._setCurrentBlock=function(t){this.currentBlock=t,this.emit("block",t)}},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.createHashFunction=function(e){return function(r){var n=e();return n.update(r),t.from(n.digest())}}}).call(this,r(2).Buffer)},function(t,e,r){t.exports=r(229)(r(239))},function(t,e,r){const n=r(230),i=r(238);t.exports=function(t){const e=n(t),r=i(t);return function(t,n){switch("string"==typeof t?t.toLowerCase():t){case"keccak224":return new e(1152,448,null,224,n);case"keccak256":return new e(1088,512,null,256,n);case"keccak384":return new e(832,768,null,384,n);case"keccak512":return new e(576,1024,null,512,n);case"sha3-224":return new e(1152,448,6,224,n);case"sha3-256":return new e(1088,512,6,256,n);case"sha3-384":return new e(832,768,6,384,n);case"sha3-512":return new e(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+t)}}}},function(t,e,r){(function(e){const{Transform:n}=r(111);t.exports=t=>class r extends n{constructor(e,r,n,i,o){super(o),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(t){let e=null;try{this.push(this.digest())}catch(t){e=t}t(e)}update(t,r){if(!e.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return e.isBuffer(t)||(t=e.from(t,r)),this._state.absorb(t),this}digest(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return void 0!==t&&(e=e.toString(t)),this._resetState(),e}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new r(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}}}).call(this,r(2).Buffer)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r0?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 s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return ti.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e0,(function(t){n||(n=t),t&&s.forEach(c),o||(s.forEach(c),i(n))}))}));return e.reduce(f)}},function(t,e,r){(function(e){const{Transform:n}=r(111);t.exports=t=>class r extends n{constructor(e,r,n,i){super(i),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let n=null;try{this.update(t,e)}catch(t){n=t}r(n)}_flush(){}_read(t){this.push(this.squeeze(t))}update(t,r){if(!e.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return e.isBuffer(t)||(t=e.from(t,r)),this._state.absorb(t),this}squeeze(t,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(t);return void 0!==e&&(r=r.toString(e)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new r(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}}}).call(this,r(2).Buffer)},function(t,e,r){(function(e){const n=r(240);function i(){this.state=[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],this.blockSize=null,this.count=0,this.squeezing=!1}i.prototype.initialize=function(t,e){for(let t=0;t<50;++t)this.state[t]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1},i.prototype.absorb=function(t){for(let e=0;e>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0);return r},i.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing},t.exports=i}).call(this,r(2).Buffer)},function(t,e){const r=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];e.p1600=function(t){for(let e=0;e<24;++e){const n=t[0]^t[10]^t[20]^t[30]^t[40],i=t[1]^t[11]^t[21]^t[31]^t[41],o=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],h=t[8]^t[18]^t[28]^t[38]^t[48],l=t[9]^t[19]^t[29]^t[39]^t[49];let d=h^(o<<1|s>>>31),p=l^(s<<1|o>>>31);const m=t[0]^d,g=t[1]^p,b=t[10]^d,y=t[11]^p,v=t[20]^d,_=t[21]^p,w=t[30]^d,M=t[31]^p,S=t[40]^d,x=t[41]^p;d=n^(a<<1|u>>>31),p=i^(u<<1|a>>>31);const E=t[2]^d,k=t[3]^p,A=t[12]^d,R=t[13]^p,T=t[22]^d,C=t[23]^p,O=t[32]^d,P=t[33]^p,I=t[42]^d,B=t[43]^p;d=o^(c<<1|f>>>31),p=s^(f<<1|c>>>31);const L=t[4]^d,j=t[5]^p,N=t[14]^d,q=t[15]^p,U=t[24]^d,D=t[25]^p,H=t[34]^d,z=t[35]^p,F=t[44]^d,W=t[45]^p;d=a^(h<<1|l>>>31),p=u^(l<<1|h>>>31);const K=t[6]^d,V=t[7]^p,J=t[16]^d,Z=t[17]^p,G=t[26]^d,Y=t[27]^p,$=t[36]^d,X=t[37]^p,Q=t[46]^d,tt=t[47]^p;d=c^(n<<1|i>>>31),p=f^(i<<1|n>>>31);const et=t[8]^d,rt=t[9]^p,nt=t[18]^d,it=t[19]^p,ot=t[28]^d,st=t[29]^p,at=t[38]^d,ut=t[39]^p,ct=t[48]^d,ft=t[49]^p,ht=m,lt=g,dt=y<<4|b>>>28,pt=b<<4|y>>>28,mt=v<<3|_>>>29,gt=_<<3|v>>>29,bt=M<<9|w>>>23,yt=w<<9|M>>>23,vt=S<<18|x>>>14,_t=x<<18|S>>>14,wt=E<<1|k>>>31,Mt=k<<1|E>>>31,St=R<<12|A>>>20,xt=A<<12|R>>>20,Et=T<<10|C>>>22,kt=C<<10|T>>>22,At=P<<13|O>>>19,Rt=O<<13|P>>>19,Tt=I<<2|B>>>30,Ct=B<<2|I>>>30,Ot=j<<30|L>>>2,Pt=L<<30|j>>>2,It=N<<6|q>>>26,Bt=q<<6|N>>>26,Lt=D<<11|U>>>21,jt=U<<11|D>>>21,Nt=H<<15|z>>>17,qt=z<<15|H>>>17,Ut=W<<29|F>>>3,Dt=F<<29|W>>>3,Ht=K<<28|V>>>4,zt=V<<28|K>>>4,Ft=Z<<23|J>>>9,Wt=J<<23|Z>>>9,Kt=G<<25|Y>>>7,Vt=Y<<25|G>>>7,Jt=$<<21|X>>>11,Zt=X<<21|$>>>11,Gt=tt<<24|Q>>>8,Yt=Q<<24|tt>>>8,$t=et<<27|rt>>>5,Xt=rt<<27|et>>>5,Qt=nt<<20|it>>>12,te=it<<20|nt>>>12,ee=st<<7|ot>>>25,re=ot<<7|st>>>25,ne=at<<8|ut>>>24,ie=ut<<8|at>>>24,oe=ct<<14|ft>>>18,se=ft<<14|ct>>>18;t[0]=ht^~St&Lt,t[1]=lt^~xt&jt,t[10]=Ht^~Qt&mt,t[11]=zt^~te>,t[20]=wt^~It&Kt,t[21]=Mt^~Bt&Vt,t[30]=$t^~dt&Et,t[31]=Xt^~pt&kt,t[40]=Ot^~Ft&ee,t[41]=Pt^~Wt&re,t[2]=St^~Lt&Jt,t[3]=xt^~jt&Zt,t[12]=Qt^~mt&At,t[13]=te^~gt&Rt,t[22]=It^~Kt&ne,t[23]=Bt^~Vt&ie,t[32]=dt^~Et&Nt,t[33]=pt^~kt&qt,t[42]=Ft^~ee&bt,t[43]=Wt^~re&yt,t[4]=Lt^~Jt&oe,t[5]=jt^~Zt&se,t[14]=mt^~At&Ut,t[15]=gt^~Rt&Dt,t[24]=Kt^~ne&vt,t[25]=Vt^~ie&_t,t[34]=Et^~Nt&Gt,t[35]=kt^~qt&Yt,t[44]=ee^~bt&Tt,t[45]=re^~yt&Ct,t[6]=Jt^~oe&ht,t[7]=Zt^~se<,t[16]=At^~Ut&Ht,t[17]=Rt^~Dt&zt,t[26]=ne^~vt&wt,t[27]=ie^~_t&Mt,t[36]=Nt^~Gt&$t,t[37]=qt^~Yt&Xt,t[46]=bt^~Tt&Ot,t[47]=yt^~Ct&Pt,t[8]=oe^~ht&St,t[9]=se^~lt&xt,t[18]=Ut^~Ht&Qt,t[19]=Dt^~zt&te,t[28]=vt^~wt&It,t[29]=_t^~Mt&Bt,t[38]=Gt^~$t&dt,t[39]=Yt^~Xt&pt,t[48]=Tt^~Ot&Ft,t[49]=Ct^~Pt&Wt,t[0]^=r[2*e],t[1]^=r[2*e+1]}}},function(t,e,r){"use strict";(function(e){var n=r(118),i=r(266),o=r(267),s=function(t){return 32===t.length&&n.privateKeyVerify(Uint8Array.from(t))};t.exports={privateKeyVerify:s,privateKeyExport:function(t,e){if(32!==t.length)throw new RangeError("private key length is invalid");var r=i.privateKeyExport(t,e);return o.privateKeyExport(t,r,e)},privateKeyImport:function(t){if(null!==(t=o.privateKeyImport(t))&&32===t.length&&s(t))return t;throw new Error("couldn't import from DER format")},privateKeyNegate:function(t){return e.from(n.privateKeyNegate(Uint8Array.from(t)))},privateKeyModInverse:function(t){if(32!==t.length)throw new Error("private key length is invalid");return e.from(i.privateKeyModInverse(Uint8Array.from(t)))},privateKeyTweakAdd:function(t,r){return e.from(n.privateKeyTweakAdd(Uint8Array.from(t),r))},privateKeyTweakMul:function(t,r){return e.from(n.privateKeyTweakMul(Uint8Array.from(t),Uint8Array.from(r)))},publicKeyCreate:function(t,r){return e.from(n.publicKeyCreate(Uint8Array.from(t),r))},publicKeyConvert:function(t,r){return e.from(n.publicKeyConvert(Uint8Array.from(t),r))},publicKeyVerify:function(t){return(33===t.length||65===t.length)&&n.publicKeyVerify(Uint8Array.from(t))},publicKeyTweakAdd:function(t,r,i){return e.from(n.publicKeyTweakAdd(Uint8Array.from(t),Uint8Array.from(r),i))},publicKeyTweakMul:function(t,r,i){return e.from(n.publicKeyTweakMul(Uint8Array.from(t),Uint8Array.from(r),i))},publicKeyCombine:function(t,r){var i=[];return t.forEach((function(t){i.push(Uint8Array.from(t))})),e.from(n.publicKeyCombine(i,r))},signatureNormalize:function(t){return e.from(n.signatureNormalize(Uint8Array.from(t)))},signatureExport:function(t){return e.from(n.signatureExport(Uint8Array.from(t)))},signatureImport:function(t){return e.from(n.signatureImport(Uint8Array.from(t)))},signatureImportLax:function(t){if(0===t.length)throw new RangeError("signature length is invalid");var e=o.signatureImportLax(t);if(null===e)throw new Error("couldn't parse DER signature");return i.signatureImport(e)},sign:function(t,r,i){if(null===i)throw new TypeError("options should be an Object");var o=void 0;if(i){if(o={},null===i.data)throw new TypeError("options.data should be a Buffer");if(i.data){if(32!==i.data.length)throw new RangeError("options.data length is invalid");o.data=new Uint8Array(i.data)}if(null===i.noncefn)throw new TypeError("options.noncefn should be a Function");i.noncefn&&(o.noncefn=function(t,r,n,o,s){var a=null!=n?e.from(n):null,u=null!=o?e.from(o):null,c=e.from("");return i.noncefn&&(c=i.noncefn(e.from(t),e.from(r),a,u,s)),Uint8Array.from(c)})}var s=n.ecdsaSign(Uint8Array.from(t),Uint8Array.from(r),o);return{signature:e.from(s.signature),recovery:s.recid}},verify:function(t,e,r){return n.ecdsaVerify(Uint8Array.from(e),Uint8Array.from(t),r)},recover:function(t,r,i,o){return e.from(n.ecdsaRecover(Uint8Array.from(r),i,Uint8Array.from(t),o))},ecdh:function(t,r){return e.from(n.ecdh(Uint8Array.from(t),Uint8Array.from(r),{}))},ecdhUnsafe:function(t,r,n){if(33!==t.length&&65!==t.length)throw new RangeError("public key length is invalid");if(32!==r.length)throw new RangeError("private key length is invalid");return e.from(i.ecdhUnsafe(Uint8Array.from(t),Uint8Array.from(r),n))}}}).call(this,r(2).Buffer)},function(t,e){const r="Impossible case. Please create issue.",n="The tweak was out of range or the resulted private key is invalid",i="The tweak was out of range or equal to zero",o="Unknow error on context randomization",s="Private Key is invalid",a="Public Key could not be parsed",u="Public Key serialization error",c="The sum of the public keys is not valid",f="Signature could not be parsed",h="The nonce generation function failed, or the private key was invalid",l="Public key could not be recover",d="Scalar was invalid (zero or overflow)";function p(t,e){if(!t)throw new Error(e)}function m(t,e,r){if(p(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${t} to be an Uint8Array with length [${r.join(", ")}]`;p(r.includes(e.length),n)}else{const n=`Expected ${t} to be an Uint8Array with length ${r}`;p(e.length===r,n)}}function g(t){p("Boolean"===y(t),"Expected compressed to be a Boolean")}function b(t=(t=>new Uint8Array(t)),e){return"function"==typeof t&&(t=t(e)),m("output",t,e),t}function y(t){return Object.prototype.toString.call(t).slice(8,-1)}t.exports=t=>({contextRandomize(e){switch(p(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&m("seed",e,32),t.contextRandomize(e)){case 1:throw new Error(o)}},privateKeyVerify:e=>(m("private key",e,32),0===t.privateKeyVerify(e)),privateKeyNegate(e){switch(m("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(r)}},privateKeyTweakAdd(e,r){switch(m("private key",e,32),m("tweak",r,32),t.privateKeyTweakAdd(e,r)){case 0:return e;case 1:throw new Error(n)}},privateKeyTweakMul(e,r){switch(m("private key",e,32),m("tweak",r,32),t.privateKeyTweakMul(e,r)){case 0:return e;case 1:throw new Error(i)}},publicKeyVerify:e=>(m("public key",e,[33,65]),0===t.publicKeyVerify(e)),publicKeyCreate(e,r=!0,n){switch(m("private key",e,32),g(r),n=b(n,r?33:65),t.publicKeyCreate(n,e)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(u)}},publicKeyConvert(e,r=!0,n){switch(m("public key",e,[33,65]),g(r),n=b(n,r?33:65),t.publicKeyConvert(n,e)){case 0:return n;case 1:throw new Error(a);case 2:throw new Error(u)}},publicKeyNegate(e,n=!0,i){switch(m("public key",e,[33,65]),g(n),i=b(i,n?33:65),t.publicKeyNegate(i,e)){case 0:return i;case 1:throw new Error(a);case 2:throw new Error(r);case 3:throw new Error(u)}},publicKeyCombine(e,r=!0,n){p(Array.isArray(e),"Expected public keys to be an Array"),p(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)m("public key",t,[33,65]);switch(g(r),n=b(n,r?33:65),t.publicKeyCombine(n,e)){case 0:return n;case 1:throw new Error(a);case 2:throw new Error(c);case 3:throw new Error(u)}},publicKeyTweakAdd(e,r,i=!0,o){switch(m("public key",e,[33,65]),m("tweak",r,32),g(i),o=b(o,i?33:65),t.publicKeyTweakAdd(o,e,r)){case 0:return o;case 1:throw new Error(a);case 2:throw new Error(n)}},publicKeyTweakMul(e,r,n=!0,o){switch(m("public key",e,[33,65]),m("tweak",r,32),g(n),o=b(o,n?33:65),t.publicKeyTweakMul(o,e,r)){case 0:return o;case 1:throw new Error(a);case 2:throw new Error(i)}},signatureNormalize(e){switch(m("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(f)}},signatureExport(e,n){m("signature",e,64);const i={output:n=b(n,72),outputlen:72};switch(t.signatureExport(i,e)){case 0:return n.slice(0,i.outputlen);case 1:throw new Error(f);case 2:throw new Error(r)}},signatureImport(e,n){switch(m("signature",e),n=b(n,64),t.signatureImport(n,e)){case 0:return n;case 1:throw new Error(f);case 2:throw new Error(r)}},ecdsaSign(e,n,i={},o){m("message",e,32),m("private key",n,32),p("Object"===y(i),"Expected options to be an Object"),void 0!==i.data&&m("options.data",i.data),void 0!==i.noncefn&&p("Function"===y(i.noncefn),"Expected options.noncefn to be a Function");const s={signature:o=b(o,64),recid:null};switch(t.ecdsaSign(s,e,n,i.data,i.noncefn)){case 0:return s;case 1:throw new Error(h);case 2:throw new Error(r)}},ecdsaVerify(e,r,n){switch(m("signature",e,64),m("message",r,32),m("public key",n,[33,65]),t.ecdsaVerify(e,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(f);case 2:throw new Error(a)}},ecdsaRecover(e,n,i,o=!0,s){switch(m("signature",e,64),p("Number"===y(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),m("message",i,32),g(o),s=b(s,o?33:65),t.ecdsaRecover(s,e,n,i)){case 0:return s;case 1:throw new Error(f);case 2:throw new Error(l);case 3:throw new Error(r)}},ecdh(e,r,n={},i){switch(m("public key",e,[33,65]),m("private key",r,32),p("Object"===y(n),"Expected options to be an Object"),void 0!==n.data&&m("options.data",n.data),void 0!==n.hashfn?(p("Function"===y(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&m("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&m("options.ybuf",n.ybuf,32),m("output",i)):i=b(i,32),t.ecdh(i,e,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(a);case 2:throw new Error(d)}}})},function(t,e,r){const n=new(0,r(58).ec)("secp256k1"),i=n.curve,o=i.n.constructor;function s(t){const e=t[0];switch(e){case 2:case 3:return 33!==t.length?null:function(t,e){let r=new o(e);if(r.cmp(i.p)>=0)return null;r=r.toRed(i.red);let s=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===t!==s.isOdd()&&(s=s.redNeg()),n.keyPair({pub:{x:r,y:s}})}(e,t.subarray(1,33));case 4:case 6:case 7:return 65!==t.length?null:function(t,e,r){let s=new o(e),a=new o(r);if(s.cmp(i.p)>=0||a.cmp(i.p)>=0)return null;if(s=s.toRed(i.red),a=a.toRed(i.red),(6===t||7===t)&&a.isOdd()!==(7===t))return null;const u=s.redSqr().redIMul(s);return a.redSqr().redISub(u.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:s,y:a}}):null}(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function a(t,e){const r=e.encode(null,33===t.length);for(let e=0;e0,privateKeyVerify(t){const e=new o(t);return e.cmp(i.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){const e=new o(t),r=i.n.sub(e).umod(i.n).toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakAdd(t,e){const r=new o(e);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(t)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},privateKeyTweakMul(t,e){let r=new o(e);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(t)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return t.set(n),0},publicKeyVerify:t=>null===s(t)?1:0,publicKeyCreate(t,e){const r=new o(e);if(r.cmp(i.n)>=0||r.isZero())return 1;return a(t,n.keyFromPrivate(e).getPublic()),0},publicKeyConvert(t,e){const r=s(e);if(null===r)return 1;return a(t,r.getPublic()),0},publicKeyNegate(t,e){const r=s(e);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),a(t,n),0},publicKeyCombine(t,e){const r=new Array(e.length);for(let t=0;t=0)return 2;const u=n.getPublic().add(i.g.mul(r));return u.isInfinity()?2:(a(t,u),0)},publicKeyTweakMul(t,e,r){const n=s(e);if(null===n)return 1;if((r=new o(r)).cmp(i.n)>=0||r.isZero())return 2;return a(t,n.getPublic().mul(r)),0},signatureNormalize(t){const e=new o(t.subarray(0,32)),r=new o(t.subarray(32,64));return e.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&t.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){const r=e.subarray(0,32),n=e.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:s}=t;let a=s.subarray(4,37);a[0]=0,a.set(r,1);let u=33,c=0;for(;u>1&&0===a[c]&&!(128&a[c+1]);--u,++c);if(a=a.subarray(c),128&a[0])return 1;if(u>1&&0===a[0]&&!(128&a[1]))return 1;let f=s.subarray(39,72);f[0]=0,f.set(n,1);let h=33,l=0;for(;h>1&&0===f[l]&&!(128&f[l+1]);--h,++l);return f=f.subarray(l),128&f[0]||h>1&&0===f[0]&&!(128&f[1])?1:(t.outputlen=6+u+h,s[0]=48,s[1]=t.outputlen-2,s[2]=2,s[3]=a.length,s.set(a,4),s[4+u]=2,s[5+u]=f.length,s.set(f,6+u),0)},signatureImport(t,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;const r=e[3];if(0===r)return 1;if(5+r>=e.length)return 1;if(2!==e[4+r])return 1;const n=e[5+r];if(0===n)return 1;if(6+r+n!==e.length)return 1;if(128&e[4])return 1;if(r>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[r+6])return 1;if(n>1&&0===e[r+6]&&!(128&e[r+7]))return 1;let s=e.subarray(4,4+r);if(33===s.length&&0===s[0]&&(s=s.subarray(1)),s.length>32)return 1;let a=e.subarray(6+r);if(33===a.length&&0===a[0]&&(a=a.slice(1)),a.length>32)throw new Error("S length is too long");let u=new o(s);u.cmp(i.n)>=0&&(u=new o(0));let c=new o(e.subarray(6+r));return c.cmp(i.n)>=0&&(c=new o(0)),t.set(u.toArrayLike(Uint8Array,"be",32),0),t.set(c.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,r,s,a){if(a){const t=a;a=n=>{const i=t(e,r,null,s,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)}}const u=new o(r);if(u.cmp(i.n)>=0||u.isZero())return 1;let c;try{c=n.sign(e,r,{canonical:!0,k:a,pers:s})}catch(t){return 1}return t.signature.set(c.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(c.s.toArrayLike(Uint8Array,"be",32),32),t.recid=c.recoveryParam,0},ecdsaVerify(t,e,r){const a={r:t.subarray(0,32),s:t.subarray(32,64)},u=new o(a.r),c=new o(a.s);if(u.cmp(i.n)>=0||c.cmp(i.n)>=0)return 1;if(1===c.cmp(n.nh)||u.isZero()||c.isZero())return 3;const f=s(r);if(null===f)return 2;const h=f.getPublic();return n.verify(e,a,h)?0:3},ecdsaRecover(t,e,r,s){const u={r:e.slice(0,32),s:e.slice(32,64)},c=new o(u.r),f=new o(u.s);if(c.cmp(i.n)>=0||f.cmp(i.n)>=0)return 1;if(c.isZero()||f.isZero())return 2;let h;try{h=n.recoverPubKey(s,u,r)}catch(t){return 2}return a(t,h),0},ecdh(t,e,r,a,u,c,f){const h=s(e);if(null===h)return 1;const l=new o(r);if(l.cmp(i.n)>=0||l.isZero())return 2;const d=h.getPublic().mul(l);if(void 0===u){const e=d.encode(null,!0),r=n.hash().update(e).digest();for(let e=0;e<32;++e)t[e]=r[e]}else{c||(c=new Uint8Array(32));const e=d.getX().toArray("be",32);for(let t=0;t<32;++t)c[t]=e[t];f||(f=new Uint8Array(32));const r=d.getY().toArray("be",32);for(let t=0;t<32;++t)f[t]=r[t];const n=u(c,f,a);if(!(n instanceof Uint8Array&&n.length===t.length))return 2;t.set(n)}return 0}}},function(t){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')},function(t,e){},function(t,e){},function(t,e,r){"use strict";var n=r(11),i=r(16),o=r(3),s=r(45),a=n.assert;function u(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,r,n){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(t,e,r,n){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,s,a,u,c,f,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),m=new i(0),g=new i(0),b=new i(1),y=0;0!==l.cmpn(0);){var v=d.div(l);c=d.sub(v.mul(l)),f=g.sub(v.mul(p));var _=b.sub(v.mul(m));if(!n&&c.cmp(h)<0)e=u.neg(),r=p,n=c.neg(),o=f;else if(n&&2==++y)break;u=c,d=l,l=c,g=p,p=f,b=m,m=_}s=c.neg(),a=f;var w=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(w)>=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(c).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},c.prototype.isInfinity=function(){return this.inf},c.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),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.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(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(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)},c.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.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))},c.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,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.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),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),h=n.redMul(c),l=u.redSqr().redIAdd(f).redISub(h).redISub(h),d=u.redMul(h.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),f=r.redMul(u),h=a.redSqr().redIAdd(c).redISub(f).redISub(f),l=a.redMul(f.redISub(h)).redISub(i.redMul(c)),d=this.z.redMul(s);return this.curve.jpoint(h,l,d)},f.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(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var n=r(16),i=r(3),o=r(45),s=r(11);function a(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){"use strict";var n=r(11),i=r(16),o=r(3),s=r(45),a=n.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,r,n,o){s.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,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()))))}o(u,s),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(c,s.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new c(this,t,e,r,n)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),s=o.redSub(r),a=n.redSub(e),u=i.redMul(s),c=o.redMul(a),f=i.redMul(a),h=s.redMul(o);return this.curve.point(u,c,h,f)},c.prototype._projDbl=function(){var t,e,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=s.redSub(a).redISub(u).redMul(o),e=c.redMul(n.redSub(u)),r=c.redMul(o))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.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)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),c=o.redMul(s),f=a.redMul(u),h=o.redMul(u),l=s.redMul(a);return this.curve.point(c,f,l,h)},c.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),c=i.redAdd(a),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),h=n.redMul(u).redMul(f);return this.curve.twisted?(e=n.redMul(c).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(c)):(e=n.redMul(c).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,r)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},c.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},c.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},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.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(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},function(t,e,r){"use strict";e.sha1=r(251),e.sha224=r(252),e.sha256=r(124),e.sha384=r(253),e.sha512=r(125)},function(t,e,r){"use strict";var n=r(15),i=r(37),o=r(123),s=n.rotl32,a=n.sum32,u=n.sum32_5,c=o.ft_1,f=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(l,f),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e0))return s.iaddn(1),this.keyFromPrivate(s)}},h.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},h.prototype.sign=function(t,e,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),c=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new n(1)),l=0;;l++){var d=o.k?o.k(l):new n(c.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(h)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var b=d.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new f({r:g,s:b,recoveryParam:y})}}}}}},h.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new f(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),c=u.mul(t).umod(this.n),h=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),h)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(c,r.getPublic(),h)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},h.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new f(e,i);var o=this.n,s=new n(t),a=e.r,c=e.s,h=1&r,l=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");a=l?this.curve.pointFromX(a.add(this.curve.n),h):this.curve.pointFromX(a,h);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),m=c.mul(d).umod(o);return this.g.mulAdd(p,a,m)},h.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new f(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var n=r(60),i=r(120),o=r(22);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=s,s.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length"}},function(t,e,r){"use strict";var n=r(16),i=r(11),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function c(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)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;var c=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var f=u(t,r);if(!1===f)return!1;if(t.length!==f+r.place)return!1;var h=t.slice(r.place,f+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}return this.r=new n(c),this.s=new n(h),this.recoveryParam=null,!0},s.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=c(e),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,e.length),(n=n.concat(e)).push(2),f(n,r.length);var o=n.concat(r),s=[48];return f(s,o.length),s=s.concat(o),i.encode(s,t)}},function(t,e,r){"use strict";var n=r(60),i=r(59),o=r(11),s=o.assert,a=o.parseBytes,u=r(262),c=r(263);function f(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=i[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=n.sha512}t.exports=f,f.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},f.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(t);if(t>0)if(t>65536)for(var s=0;s=0)throw new Error("couldn't export to DER format");var a=i.g.mul(r);return s(a.getX(),a.getY(),e)},e.privateKeyModInverse=function(e){var r=new n(e);if(r.ucmp(o.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(o.n).toArrayLike(t,"be",32)},e.signatureImport=function(e){var r=new n(e.r);r.ucmp(o.n)>=0&&(r=new n(0));var i=new n(e.s);return i.ucmp(o.n)>=0&&(i=new n(0)),t.concat([r.toArrayLike(t,"be",32),i.toArrayLike(t,"be",32)])},e.ecdhUnsafe=function(t,e,r){var a=i.keyFromPublic(t),u=new n(e);if(u.ucmp(o.n)>=0||u.isZero())throw new Error("scalar was invalid (zero or overflow)");var c=a.pub.mul(u);return s(c.getX(),c.getY(),r)};var s=function(e,r,n){var i=void 0;return n?((i=t.alloc(33))[0]=r.isOdd()?3:2,e.toArrayLike(t,"be",32).copy(i,1)):((i=t.alloc(65))[0]=4,e.toArrayLike(t,"be",32).copy(i,1),r.toArrayLike(t,"be",32).copy(i,33)),i}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(t){var r=t.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=t.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]);e.privateKeyExport=function(e,i,o){var s=t.from(o?r:n);return e.copy(s,o?8:9),i.copy(s,o?181:214),s},e.privateKeyImport=function(t){var e=t.length,r=0;if(e2)return null;if(e<(r+=1)+n)return null;var i=t[r+n-1]|(n>1?t[r+n-2]<<8:0);return e<(r+=n)+i||e32||ei)return null;if(2!==e[o++])return null;var a=e[o++];if(128&a){if(o+(s=a-128)>i)return null;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(a>i-o)return null;var u=o;if(o+=a,2!==e[o++])return null;var c=e[o++];if(128&c){if(o+(s=c-128)>i)return null;for(;s>0&&0===e[o];o+=1,s-=1);for(c=0;s>0;o+=1,s-=1)c=(c<<8)+e[o]}if(c>i-o)return null;var f=o;for(o+=c;a>0&&0===e[u];a-=1,u+=1);if(a>32)return null;var h=e.slice(u,u+a);for(h.copy(r,32-h.length);c>0&&0===e[f];c-=1,f+=1);if(c>32)return null;var l=e.slice(f,f+c);return l.copy(n,32-l.length),{r:r,s:n}}}).call(this,r(2).Buffer)},function(t,e,r){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT */var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=s(t),c=1;c=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function c(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.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),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(t){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?""}var l=["","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"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.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=d[t],f=p[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(f).toString(t);r=(h=h.idivn(f)).isZero()?m+r:l[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.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>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(s=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&s}r.words[c]=0|h,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.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},o.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},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.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)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);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()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);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,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.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,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],b=8191&g,y=g>>>13,v=0|s[3],_=8191&v,w=v>>>13,M=0|s[4],S=8191&M,x=M>>>13,E=0|s[5],k=8191&E,A=E>>>13,R=0|s[6],T=8191&R,C=R>>>13,O=0|s[7],P=8191&O,I=O>>>13,B=0|s[8],L=8191&B,j=B>>>13,N=0|s[9],q=8191&N,U=N>>>13,D=0|a[0],H=8191&D,z=D>>>13,F=0|a[1],W=8191&F,K=F>>>13,V=0|a[2],J=8191&V,Z=V>>>13,G=0|a[3],Y=8191&G,$=G>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ct=at>>>13,ft=0|a[8],ht=8191&ft,lt=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(h,H))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(l,H)|0))<<13)|0;c=((o=Math.imul(l,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(m,H)|0,o=Math.imul(m,z);var bt=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(l,W)|0))<<13)|0;c=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(y,H)|0,o=Math.imul(y,z),n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,K)|0;var yt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(_,H),i=(i=Math.imul(_,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,W)|0,o=o+Math.imul(y,K)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var vt=(c+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(l,Y)|0))<<13)|0;c=((o=o+Math.imul(l,$)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(x,H)|0,o=Math.imul(x,z),n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,K)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,$)|0;var _t=(c+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(k,H),i=(i=Math.imul(k,z))+Math.imul(A,H)|0,o=Math.imul(A,z),n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Z)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var wt=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(l,rt)|0))<<13)|0;c=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(T,H),i=(i=Math.imul(T,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,$)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,$)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(c+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,st)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(I,H)|0,o=Math.imul(I,z),n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,$)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(c+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(L,H),i=(i=Math.imul(L,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,K)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(A,Y)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(_,rt)|0,i=(i=i+Math.imul(_,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var xt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(q,H),i=(i=Math.imul(q,z))+Math.imul(U,H)|0,o=Math.imul(U,z),n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,K)|0)+Math.imul(j,W)|0,o=o+Math.imul(j,K)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,$)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,ct)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Et=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(q,W),i=(i=Math.imul(q,K))+Math.imul(U,W)|0,o=Math.imul(U,K),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,Z)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Z)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,$)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ct)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,lt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,lt)|0;var kt=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(q,J),i=(i=Math.imul(q,Z))+Math.imul(U,J)|0,o=Math.imul(U,Z),n=n+Math.imul(L,Y)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,$)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,st)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ct)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ct)|0,n=n+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,lt)|0;var At=(c+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((o=o+Math.imul(y,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(q,Y),i=(i=Math.imul(q,$))+Math.imul(U,Y)|0,o=Math.imul(U,$),n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(S,ht)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,lt)|0;var Rt=(c+(n=n+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(w,pt)|0))<<13)|0;c=((o=o+Math.imul(w,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(q,Q),i=(i=Math.imul(q,tt))+Math.imul(U,Q)|0,o=Math.imul(U,tt),n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,n=n+Math.imul(k,ht)|0,i=(i=i+Math.imul(k,lt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,lt)|0;var Tt=(c+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(x,pt)|0))<<13)|0;c=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(q,rt),i=(i=Math.imul(q,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul(L,ot)|0,i=(i=i+Math.imul(L,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,n=n+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,lt)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,lt)|0;var Ct=(c+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(A,pt)|0))<<13)|0;c=((o=o+Math.imul(A,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(q,ot),i=(i=Math.imul(q,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul(L,ut)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,ct)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var Ot=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(q,ut),i=(i=Math.imul(q,ct))+Math.imul(U,ut)|0,o=Math.imul(U,ct),n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,lt)|0)+Math.imul(j,ht)|0,o=o+Math.imul(j,lt)|0;var Pt=(c+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(q,ht),i=(i=Math.imul(q,lt))+Math.imul(U,ht)|0,o=Math.imul(U,lt);var It=(c+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(j,pt)|0))<<13)|0;c=((o=o+Math.imul(j,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Bt=(c+(n=Math.imul(q,pt))|0)+((8191&(i=(i=Math.imul(q,mt))+Math.imul(U,pt)|0))<<13)|0;return c=((o=Math.imul(U,mt))+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,u[0]=gt,u[1]=bt,u[2]=yt,u[3]=vt,u[4]=_t,u[5]=wt,u[6]=Mt,u[7]=St,u[8]=xt,u[9]=Et,u[10]=kt,u[11]=At,u[12]=Rt,u[13]=Tt,u[14]=Ct,u[15]=Ot,u[16]=Pt,u[17]=It,u[18]=Bt,0!==c&&(u[19]=c,r.length++),r};function b(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return b(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(g=m),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?b(this,t,e):y(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,c=0;c=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),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)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):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&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.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,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(h)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.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 n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.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 n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(M,w),M.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},M.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]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new S;else if("p192"===t)e=new x;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return _[t]=e,e},k.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.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)},k.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},k.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)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();n(g=0;n--){for(var c=e.words[n],f=u-1;f>=0;f--){var h=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4===++a||0===n&&0===f)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,k),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),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(25)(t))},function(t,e){},function(t,e,r){"use strict";var n=r(3),i=r(127),o=r(13).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function c(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function h(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=c(r,n,i,o,t[0],3614090360,7),o=c(o,r,n,i,t[1],3905402710,12),i=c(i,o,r,n,t[2],606105819,17),n=c(n,i,o,r,t[3],3250441966,22),r=c(r,n,i,o,t[4],4118548399,7),o=c(o,r,n,i,t[5],1200080426,12),i=c(i,o,r,n,t[6],2821735955,17),n=c(n,i,o,r,t[7],4249261313,22),r=c(r,n,i,o,t[8],1770035416,7),o=c(o,r,n,i,t[9],2336552879,12),i=c(i,o,r,n,t[10],4294925233,17),n=c(n,i,o,r,t[11],2304563134,22),r=c(r,n,i,o,t[12],1804603682,7),o=c(o,r,n,i,t[13],4254626195,12),i=c(i,o,r,n,t[14],2792965006,17),r=f(r,n=c(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=f(o,r,n,i,t[6],3225465664,9),i=f(i,o,r,n,t[11],643717713,14),n=f(n,i,o,r,t[0],3921069994,20),r=f(r,n,i,o,t[5],3593408605,5),o=f(o,r,n,i,t[10],38016083,9),i=f(i,o,r,n,t[15],3634488961,14),n=f(n,i,o,r,t[4],3889429448,20),r=f(r,n,i,o,t[9],568446438,5),o=f(o,r,n,i,t[14],3275163606,9),i=f(i,o,r,n,t[3],4107603335,14),n=f(n,i,o,r,t[8],1163531501,20),r=f(r,n,i,o,t[13],2850285829,5),o=f(o,r,n,i,t[2],4243563512,9),i=f(i,o,r,n,t[7],1735328473,14),r=h(r,n=f(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=h(o,r,n,i,t[8],2272392833,11),i=h(i,o,r,n,t[11],1839030562,16),n=h(n,i,o,r,t[14],4259657740,23),r=h(r,n,i,o,t[1],2763975236,4),o=h(o,r,n,i,t[4],1272893353,11),i=h(i,o,r,n,t[7],4139469664,16),n=h(n,i,o,r,t[10],3200236656,23),r=h(r,n,i,o,t[13],681279174,4),o=h(o,r,n,i,t[0],3936430074,11),i=h(i,o,r,n,t[3],3572445317,16),n=h(n,i,o,r,t[6],76029189,23),r=h(r,n,i,o,t[9],3654602809,4),o=h(o,r,n,i,t[12],3873151461,11),i=h(i,o,r,n,t[15],530742520,16),r=l(r,n=h(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.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=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},function(t,e,r){(e=t.exports=r(128)).Stream=e,e.Readable=e,e.Writable=r(132),e.Duplex=r(30),e.Transform=r(133),e.PassThrough=r(278),e.finished=r(62),e.pipeline=r(279)},function(t,e){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r0?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 s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return ti.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e0,(function(t){n||(n=t),t&&s.forEach(c),o||(s.forEach(c),i(n))}))}));return e.reduce(f)}},function(t,e,r){"use strict";var n=r(2).Buffer,i=r(3),o=r(127),s=new Array(16),a=[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=[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],c=[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=[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],h=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<>>32-e}function m(t,e,r,n,i,o,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function b(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function y(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function v(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,_=0|this._a,w=0|this._b,M=0|this._c,S=0|this._d,x=0|this._e,E=0;E<80;E+=1){var k,A;E<16?(k=m(r,n,i,o,d,t[a[E]],h[0],c[E]),A=v(_,w,M,S,x,t[u[E]],l[0],f[E])):E<32?(k=g(r,n,i,o,d,t[a[E]],h[1],c[E]),A=y(_,w,M,S,x,t[u[E]],l[1],f[E])):E<48?(k=b(r,n,i,o,d,t[a[E]],h[2],c[E]),A=b(_,w,M,S,x,t[u[E]],l[2],f[E])):E<64?(k=y(r,n,i,o,d,t[a[E]],h[3],c[E]),A=g(_,w,M,S,x,t[u[E]],l[3],f[E])):(k=v(r,n,i,o,d,t[a[E]],h[4],c[E]),A=m(_,w,M,S,x,t[u[E]],l[4],f[E])),r=d,d=o,o=p(i,10),i=n,n=k,_=x,x=S,S=p(M,10),M=w,w=A}var R=this._b+i+S|0;this._b=this._c+o+x|0,this._c=this._d+d+_|0,this._d=this._e+r+w|0,this._e=this._a+n+M|0,this._a=R},d.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=n.alloc?n.alloc(20):new n(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},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(282),e.sha1=r(283),e.sha224=r(284),e.sha256=r(134),e.sha384=r(285),e.sha512=r(135)},function(t,e,r){var n=r(3),i=r(31),o=r(13).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function f(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=n)<<5|e>>>27)+f(d,i,o,a)+u+r[l]+s[d];u=a,a=o,o=c(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.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},t.exports=u},function(t,e,r){var n=r(3),i=r(31),o=r(13).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function u(){this.init(),this._w=a,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function h(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=(e=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=c(n)+h(p,i,o,a)+u+r[d]+s[p]|0;u=a,a=o,o=f(i),i=n,n=m}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.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},t.exports=u},function(t,e,r){var n=r(3),i=r(134),o=r(31),s=r(13).Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}n(u,i),u.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},u.prototype._hash=function(){var t=s.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},t.exports=u},function(t,e,r){var n=r(3),i=r(135),o=r(31),s=r(13).Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}n(u,i),u.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},u.prototype._hash=function(){var t=s.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+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},t.exports=u},function(t,e,r){var n=r(13).Buffer,i=r(287).Transform,o=r(20).StringDecoder;function s(t){i.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}r(3)(s,i),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=s},function(t,e,r){t.exports=i;var n=r(12).EventEmitter;function i(){n.call(this)}r(3)(i,n),i.Readable=r(34),i.Writable=r(288),i.Duplex=r(289),i.Transform=r(290),i.PassThrough=r(291),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var s=!1;function a(){s||(s=!0,t.end())}function u(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(f(),0===n.listenerCount(this,"error"))throw t}function f(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",c),t.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("error",c),t.on("error",c),r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t}},function(t,e,r){t.exports=r(53)},function(t,e,r){t.exports=r(19)},function(t,e,r){t.exports=r(34).Transform},function(t,e,r){t.exports=r(34).PassThrough},function(t,e,r){var n=r(2),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){var n=r(136);t.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},function(t,e,r){const n=r(137),i=r(295);function o(t,e){return new Promise(r=>{const n=setTimeout(r,t);n.unref&&e&&n.unref()})}t.exports=class extends i{constructor(t={}){if(!t.provider)throw new Error("PollingBlockTracker - no provider specified.");const e=t.pollingInterval||2e4,r=t.retryTimeout||e/10,n=void 0===t.keepEventLoopActive||t.keepEventLoopActive,i=t.setSkipCacheFlag||!1;super(Object.assign({blockResetDuration:e},t)),this._provider=t.provider,this._pollingInterval=e,this._retryTimeout=r,this._keepEventLoopActive=n,this._setSkipCacheFlag=i}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}_start(){this._performSync().catch(t=>this.emit("error",t))}async _performSync(){for(;this._isRunning;)try{await this._updateLatestBlock(),await o(this._pollingInterval,!this._keepEventLoopActive)}catch(t){const e=new Error("PollingBlockTracker - encountered an error while attempting to update latest block:\n"+t.stack);try{this.emit("error",e)}catch(t){console.error(e)}await o(this._retryTimeout,!this._keepEventLoopActive)}}async _updateLatestBlock(){const t=await this._fetchLatestBlock();this._newPotentialLatest(t)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:1,method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0);const e=await n(e=>this._provider.sendAsync(t,e))();if(e.error)throw new Error("PollingBlockTracker - encountered error fetching block:\n"+e.error);return e.result}}},function(t,e,r){r(138),r(137);const n=r(297),i=(t,e)=>t+e,o=["sync","latest"];function s(t){return Number.parseInt(t,16)}t.exports=class extends n{constructor(t={}){super(),this._blockResetDuration=t.blockResetDuration||2e4,this._blockResetTimeout,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){if(this._currentBlock)return this._currentBlock;return await new Promise(t=>this.once("latest",t))}removeAllListeners(t){t?super.removeAllListeners(t):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener()}_start(){}_end(){}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(t,e){o.includes(t)&&this._maybeStart()}_onRemoveListener(t,e){this._getBlockTrackerEventCount()>0||this._maybeEnd()}_maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),this._start())}_maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),this._end())}_getBlockTrackerEventCount(){return o.map(t=>this.listenerCount(t)).reduce(i)}_newPotentialLatest(t){const e=this._currentBlock;e&&s(t)<=s(e)||this._setCurrentBlock(t)}_setCurrentBlock(t){const e=this._currentBlock;this._currentBlock=t,this.emit("latest",t),this.emit("sync",{oldBlock:e,newBlock:t})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}},function(t,e){t.exports=function(t){var e=(t=t||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==t.start?t.start:Math.floor(Math.random()*e);return function(){return r%=e,r++}}},function(t,e,r){const n=r(21),i=r(12);var o="object"==typeof Reflect?Reflect:null,s=o&&"function"==typeof o.apply?o.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};function a(){i.call(this)}function u(t,e,r){try{s(t,e,r)}catch(t){setTimeout(()=>{throw t})}}function c(t,e){for(var r=new Array(e),n=0;n0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[t];if(void 0===a)return!1;if("function"==typeof a)u(a,this,e);else{var f=a.length,h=c(a,f);for(r=0;r-1&&t%1==0&&t="0"&&n<="9";)e+=n,u();if("."===n)for(e+=".";u()&&n>="0"&&n<="9";)e+=n;if("e"===n||"E"===n)for(e+=n,u(),"-"!==n&&"+"!==n||(e+=n,u());n>="0"&&n<="9";)e+=n,u();if(t=+e,isFinite(t))return t;a("Bad number")},f=function(){var t,e,r,i="";if('"'===n)for(;u();){if('"'===n)return u(),i;if("\\"===n)if(u(),"u"===n){for(r=0,e=0;e<4&&(t=parseInt(u(),16),isFinite(t));e+=1)r=16*r+t;i+=String.fromCharCode(r)}else{if("string"!=typeof s[n])break;i+=s[n]}else i+=n}a("Bad string")},h=function(){for(;n&&n<=" ";)u()};o=function(){switch(h(),n){case"{":return function(){var t,e={};if("{"===n){if(u("{"),h(),"}"===n)return u("}"),e;for(;n;){if(t=f(),h(),u(":"),Object.hasOwnProperty.call(e,t)&&a('Duplicate key "'+t+'"'),e[t]=o(),h(),"}"===n)return u("}"),e;u(","),h()}}a("Bad object")}();case"[":return function(){var t=[];if("["===n){if(u("["),h(),"]"===n)return u("]"),t;for(;n;){if(t.push(o()),h(),"]"===n)return u("]"),t;u(","),h()}}a("Bad array")}();case'"':return f();case"-":return c();default:return n>="0"&&n<="9"?c():function(){switch(n){case"t":return u("t"),u("r"),u("u"),u("e"),!0;case"f":return u("f"),u("a"),u("l"),u("s"),u("e"),!1;case"n":return u("n"),u("u"),u("l"),u("l"),null}a("Unexpected '"+n+"'")}()}},t.exports=function(t,e){var s;return i=t,r=0,n=" ",s=o(),h(),n&&a("Syntax error"),"function"==typeof e?function t(r,n){var i,o,s=r[n];if(s&&"object"==typeof s)for(i in s)Object.prototype.hasOwnProperty.call(s,i)&&(void 0!==(o=t(s,i))?s[i]=o:delete s[i]);return e.call(r,n,s)}({"":s},""):s}},function(t,e){var r,n,i,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function a(t){return o.lastIndex=0,o.test(t)?'"'+t.replace(o,(function(t){var e=s[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+t+'"'}t.exports=function(t,e,o){var s;if(r="",n="","number"==typeof o)for(s=0;si(Object.assign({blockTracker:e},t)))}}},function(t,e,r){const n=r(336),i=r(337),o=[void 0,null,""];t.exports=function(t={}){const{blockTracker:e}=t;if(!e)throw new Error("createBlockCacheMiddleware - No BlockTracker specified");const r=new s,o={perma:r,block:r,fork:r};return i(async(t,i,s)=>{if(t.skipCache)return s();const a=n.cacheTypeForPayload(t),u=o[a];if(!u)return s();if(!u.canCacheRequest(t))return s();let c,f=n.blockTagForPayload(t);if(f||(f="latest"),"earliest"===f)c="0x00";else if("latest"===f){const t=await e.getLatestBlock();r.clearBefore(t),c=t}else c=f;const h=await u.get(t,c);void 0===h?(await s(),await u.set(t,c,i.result)):i.result=h})};class s{constructor(){this.cache={}}getBlockCacheForPayload(t,e){const r=Number.parseInt(e,16);let n=this.cache[r];if(!n){const t={};this.cache[r]=t,n=t}return n}async get(t,e){const r=this.getBlockCacheForPayload(t,e);if(!r)return;return r[n.cacheIdentifierForPayload(t,!0)]}async set(t,e,r){if(!this.canCacheResult(t,r))return;this.getBlockCacheForPayload(t,e)[n.cacheIdentifierForPayload(t,!0)]=r}canCacheRequest(t){if(!n.canCache(t))return!1;return"pending"!==n.blockTagForPayload(t)}canCacheResult(t,e){if(!o.includes(e))return!!(!["eth_getTransactionByHash","eth_getTransactionReceipt"].includes(t.method)||e&&e.blockHash&&"0x0000000000000000000000000000000000000000000000000000000000000000"!==e.blockHash)}clearBefore(t){const e=this,r=Number.parseInt(t,16);Object.keys(e.cache).map(Number).filter(t=>tdelete e.cache[t])}}},function(t,e,r){const n=r(150);function i(t){return"never"!==a(t)}function o(t){const e=s(t);return e>=t.params.length?t.params:"eth_getBlockByNumber"===t.method?t.params.slice(1):t.params.slice(0,e)}function s(t){switch(t.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":return 1;case"eth_getBlockByNumber":return 0;default:return}}function a(t){switch(t.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":case"test_permaCache":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":case"test_forkCache":return"fork";case"eth_gasPrice":case"eth_blockNumber":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"test_blockCache":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":case"test_neverCache":return"never"}}t.exports={cacheIdentifierForPayload:function(t,e){const r=e?o(t):t.params;return i(t)?t.method+":"+n(r):null},canCache:i,blockTagForPayload:function(t){let e=s(t);if(e>=t.params.length)return null;return t.params[e]},paramsWithoutBlockTag:o,blockTagParamIndex:s,cacheTypeForPayload:a}},function(t,e){t.exports=function(t){return(e,r,n,i)=>{let o;const s=new Promise(t=>{o=t});let a,u;t(e,r,async()=>{u=!0,n(t=>{a=t,o()}),await s}).then(async()=>{u?(await s,a(null)):i(null)}).catch(t=>{a?a(t):i(t)})}}},function(t,e,r){const n=r(21).inherits,i=r(49);function o(t){t=t||{},this.staticResponses=t}t.exports=o,n(o,i),o.prototype.handleRequest=function(t,e,r){var n=this.staticResponses[t.method];"function"==typeof n?n(t,e,r):void 0!==n?setTimeout(()=>r(null,n)):e()}},function(t,e,r){const n=r(68),i=r(151);t.exports=class extends n{constructor(){super(({blockTracker:t,provider:e,engine:r})=>i({blockTracker:t,provider:e}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createIdRemapMiddleware=void 0;const n=r(153);e.createIdRemapMiddleware=function(){return(t,e,r,i)=>{const o=t.id,s=n.getUniqueId();t.id=s,e.id=s,r(r=>{t.id=o,e.id=o,r()})}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createAsyncMiddleware=void 0,e.createAsyncMiddleware=function(t){return async(e,r,n,i)=>{let o;const s=new Promise(t=>{o=t});let a=null,u=!1;const c=async()=>{u=!0,n(t=>{a=t,o()}),await s};try{await t(e,r,c),u?(await s,a(null)):i(null)}catch(t){a?a(t):i(t)}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createScaffoldMiddleware=void 0,e.createScaffoldMiddleware=function(t){return(e,r,n,i)=>{const o=t[e.method];return void 0===o?n():"function"==typeof o?o(e,r,n,i):(r.result=o,i())}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const n=r(70);Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return n.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return n.EthereumProviderError}});const i=r(155);Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return i.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}});const o=r(345);Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return o.ethErrors}});const s=r(71);Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})},function(t,e){t.exports=o,o.default=o,o.stable=u,o.stableStringify=u;var r=[],n=[];function i(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function o(t,e,o,a){var u;void 0===a&&(a=i()),function t(e,r,n,i,o,a,u){var c;if(a+=1,"object"==typeof e&&null!==e){for(c=0;cu.depthLimit)return void s("[...]",e,r,o);if(void 0!==u.edgesLimit&&n+1>u.edgesLimit)return void s("[...]",e,r,o);if(i.push(e),Array.isArray(e))for(c=0;ce?1:0}function u(t,e,o,u){void 0===u&&(u=i());var f,h=function t(e,n,i,o,u,c,f){var h;if(c+=1,"object"==typeof e&&null!==e){for(h=0;hf.depthLimit)return void s("[...]",e,n,u);if(void 0!==f.edgesLimit&&i+1>f.edgesLimit)return void s("[...]",e,n,u);if(o.push(e),Array.isArray(e))for(h=0;h0)for(var i=0;is(o.errorCodes.rpc.parse,t),invalidRequest:t=>s(o.errorCodes.rpc.invalidRequest,t),invalidParams:t=>s(o.errorCodes.rpc.invalidParams,t),methodNotFound:t=>s(o.errorCodes.rpc.methodNotFound,t),internal:t=>s(o.errorCodes.rpc.internal,t),server:t=>{if(!t||"object"!=typeof t||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return s(e,t)},invalidInput:t=>s(o.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>s(o.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>s(o.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>s(o.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>s(o.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>s(o.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>a(o.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>a(o.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>a(o.errorCodes.provider.unsupportedMethod,t),disconnected:t=>a(o.errorCodes.provider.disconnected,t),chainDisconnected:t=>a(o.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||"object"!=typeof t||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:i}=t;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new n.EthereumProviderError(e,r,i)}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mergeMiddleware=void 0;const n=r(154);e.mergeMiddleware=function(t){const e=new n.JsonRpcEngine;return t.forEach(t=>e.push(t)),e.asMiddleware()}},function(t,e){t.exports=function(t){return(e,r,n,i)=>{const o=t[e.method];return void 0===o?n():"function"==typeof o?o(e,r,n,i):(r.result=o,i())}}},function(t,e,r){const n=r(138),i=r(349),o=r(350),{bnToHex:s,hexToInt:a,incrementHexInt:u,minBlockRef:c,blockRefIsNumber:f}=r(39);t.exports=class extends o{constructor({provider:t,params:e}){super(),this.type="log",this.ethQuery=new n(t),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},e),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(t=>t.toLowerCase()))}async initialize({currentBlock:t}){let e=this.params.fromBlock;["latest","pending"].includes(e)&&(e=t),"earliest"===e&&(e="0x0"),this.params.fromBlock=e;const r=c(this.params.toBlock,t),n=Object.assign({},this.params,{toBlock:r}),i=await this._fetchLogs(n);this.addInitialResults(i)}async update({oldBlock:t,newBlock:e}){const r=e;let n;n=t?u(t):e;const i=Object.assign({},this.params,{fromBlock:n,toBlock:r}),o=(await this._fetchLogs(i)).filter(t=>this.matchLog(t));this.addResults(o)}async _fetchLogs(t){return await i(e=>this.ethQuery.getLogs(t,e))()}matchLog(t){if(a(this.params.fromBlock)>=a(t.blockNumber))return!1;if(f(this.params.toBlock)&&a(this.params.toBlock)<=a(t.blockNumber))return!1;const e=t.address&&t.address.toLowerCase();if(this.params.address&&e&&!this.params.address.includes(e))return!1;return this.params.topics.every((e,r)=>{let n=t.topics[r];if(!n)return!1;n=n.toLowerCase();let i=Array.isArray(e)?e:[e];if(i.includes(null))return!0;i=i.map(t=>t.toLowerCase());return i.includes(n)})}}},function(t,e,r){"use strict";const n=(t,e,r,n)=>function(...i){return new(0,e.promiseModule)((o,s)=>{e.multiArgs?i.push((...t)=>{e.errorFirst?t[0]?s(t):(t.shift(),o(t)):o(t)}):e.errorFirst?i.push((t,e)=>{t?s(t):o(e)}):i.push(o);const a=this===r?n:this;Reflect.apply(t,a,i)})},i=new WeakMap;t.exports=(t,e)=>{e={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...e};const r=typeof t;if(null===t||"object"!==r&&"function"!==r)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===t?"null":r}\``);const o=new WeakMap,s=new Proxy(t,{apply(t,r,i){const a=o.get(t);if(a)return Reflect.apply(a,r,i);const u=e.excludeMain?t:n(t,e,s,t);return o.set(t,u),Reflect.apply(u,r,i)},get(t,r){const a=t[r];if(!((t,r)=>{let n=i.get(t);if(n||(n={},i.set(t,n)),r in n)return n[r];const o=t=>"string"==typeof t||"symbol"==typeof r?r===t:t.test(r),s=Reflect.getOwnPropertyDescriptor(t,r),a=void 0===s||s.writable||s.configurable,u=(e.include?e.include.some(o):!e.exclude.some(o))&&a;return n[r]=u,u})(t,r)||a===Function.prototype[r])return a;const u=o.get(a);if(u)return u;if("function"==typeof a){const r=n(a,e,s,t);return o.set(a,r),r}return a}});return s}},function(t,e,r){const n=r(72);t.exports=class extends n{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(t){this.allResults=this.allResults.concat(t),super.addResults(t)}addInitialResults(t){this.allResults=this.allResults.concat(t),super.addInitialResults(t)}getAllResults(){return this.allResults}}},function(t,e,r){const n=r(72),i=r(73),{incrementHexInt:o}=r(39);t.exports=class extends n{constructor({provider:t,params:e}){super(),this.type="block",this.provider=t}async update({oldBlock:t,newBlock:e}){const r=e,n=o(t),s=(await i({provider:this.provider,fromBlock:n,toBlock:r})).map(t=>t.hash);this.addResults(s)}}},function(t,e,r){const n=r(72),i=r(73),{incrementHexInt:o}=r(39);t.exports=class extends n{constructor({provider:t}){super(),this.type="tx",this.provider=t}async update({oldBlock:t}){const e=t,r=o(t),n=await i({provider:this.provider,fromBlock:r,toBlock:e}),s=[];for(const t of n)s.push(...t.transactions);this.addResults(s)}}},function(t,e,r){const n=r(354),i=r(355),o=r(21).inherits,s=r(36),a=r(357),u=r(44),c=r(367),f=r(49),h=r(368),l=/^[0-9A-Fa-f]+$/g;function d(t){this.nonceLock=c(1),t.getAccounts&&(this.getAccounts=t.getAccounts),t.processTransaction&&(this.processTransaction=t.processTransaction),t.processMessage&&(this.processMessage=t.processMessage),t.processPersonalMessage&&(this.processPersonalMessage=t.processPersonalMessage),t.processTypedMessage&&(this.processTypedMessage=t.processTypedMessage),this.approveTransaction=t.approveTransaction||this.autoApprove,this.approveMessage=t.approveMessage||this.autoApprove,this.approvePersonalMessage=t.approvePersonalMessage||this.autoApprove,this.approveDecryptMessage=t.approveDecryptMessage||this.autoApprove,this.approveEncryptionPublicKey=t.approveEncryptionPublicKey||this.autoApprove,this.approveTypedMessage=t.approveTypedMessage||this.autoApprove,t.signTransaction&&(this.signTransaction=t.signTransaction||y("signTransaction")),t.signMessage&&(this.signMessage=t.signMessage||y("signMessage")),t.signPersonalMessage&&(this.signPersonalMessage=t.signPersonalMessage||y("signPersonalMessage")),t.decryptMessage&&(this.decryptMessage=t.decryptMessage||y("decryptMessage")),t.encryptionPublicKey&&(this.encryptionPublicKey=t.encryptionPublicKey||y("encryptionPublicKey")),t.signTypedMessage&&(this.signTypedMessage=t.signTypedMessage||y("signTypedMessage")),t.recoverPersonalSignature&&(this.recoverPersonalSignature=t.recoverPersonalSignature),t.publishTransaction&&(this.publishTransaction=t.publishTransaction),this.estimateGas=t.estimateGas||this.estimateGas,this.getGasPrice=t.getGasPrice||this.getGasPrice}function p(t){return t.toLowerCase()}function m(t){const e=s.addHexPrefix(t);return s.isValidAddress(e)}function g(t){const e=s.addHexPrefix(t);return!s.isValidAddress(e)&&b(t)}function b(t){if(!("string"==typeof t))return!1;if(!("0x"===t.slice(0,2)))return!1;return t.slice(2).match(l)}function y(t){return function(e,r){r(new Error('ProviderEngine - HookedWalletSubprovider - Must provide "'+t+'" fn in constructor options'))}}t.exports=d,o(d,f),d.prototype.handleRequest=function(t,e,r){const i=this;let o,s,a,c,f;switch(i._parityRequests={},i._parityRequestCount=0,t.method){case"eth_coinbase":return void i.getAccounts((function(t,e){if(t)return r(t);let n=e[0]||null;r(null,n)}));case"eth_accounts":return void i.getAccounts((function(t,e){if(t)return r(t);r(null,e)}));case"eth_sendTransaction":return o=t.params[0],void n([t=>i.validateTransaction(o,t),t=>i.processTransaction(o,t)],r);case"eth_signTransaction":return o=t.params[0],void n([t=>i.validateTransaction(o,t),t=>i.processSignTransaction(o,t)],r);case"eth_sign":return f=t.params[0],c=t.params[1],a=t.params[2]||{},s=u(a,{from:f,data:c}),void n([t=>i.validateMessage(s,t),t=>i.processMessage(s,t)],r);case"personal_sign":return function(){const e=t.params[0];if(g(t.params[1])&&m(e)){let e="The eth_personalSign method requires params ordered ";e+="[message, address]. This was previously handled incorrectly, ",e+="and has been corrected automatically. ",e+="Please switch this param order for smooth behavior in the future.",console.warn(e),f=t.params[0],c=t.params[1]}else c=t.params[0],f=t.params[1];a=t.params[2]||{},s=u(a,{from:f,data:c}),n([t=>i.validatePersonalMessage(s,t),t=>i.processPersonalMessage(s,t)],r)}();case"eth_decryptMessage":return function(){const e=t.params[0];if(g(t.params[1])&&m(e)){let e="The eth_decryptMessage method requires params ordered ";e+="[message, address]. This was previously handled incorrectly, ",e+="and has been corrected automatically. ",e+="Please switch this param order for smooth behavior in the future.",console.warn(e),f=t.params[0],c=t.params[1]}else c=t.params[0],f=t.params[1];a=t.params[2]||{},s=u(a,{from:f,data:c}),n([t=>i.validateDecryptMessage(s,t),t=>i.processDecryptMessage(s,t)],r)}();case"encryption_public_key":return function(){const e=t.params[0];n([t=>i.validateEncryptionPublicKey(e,t),t=>i.processEncryptionPublicKey(e,t)],r)}();case"personal_ecRecover":return function(){c=t.params[0];let e=t.params[1];a=t.params[2]||{},s=u(a,{sig:e,data:c}),i.recoverPersonalSignature(s,r)}();case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":return function(){const e=t.params[0],o=t.params[1];m(e)?(f=e,c=o):(c=e,f=o),a=t.params[2]||{},s=u(a,{from:f,data:c}),n([t=>i.validateTypedMessage(s,t),t=>i.processTypedMessage(s,t)],r)}();case"parity_postTransaction":return o=t.params[0],void i.parityPostTransaction(o,r);case"parity_postSign":return f=t.params[0],c=t.params[1],void i.parityPostSign(f,c,r);case"parity_checkRequest":return function(){const e=t.params[0];i.parityCheckRequest(e,r)}();case"parity_defaultAccount":return void i.getAccounts((function(t,e){if(t)return r(t);const n=e[0]||null;r(null,n)}));default:return void e()}},d.prototype.getAccounts=function(t){t(null,[])},d.prototype.processTransaction=function(t,e){const r=this;n([e=>r.approveTransaction(t,e),(t,e)=>r.checkApproval("transaction",t,e),e=>r.finalizeAndSubmitTx(t,e)],e)},d.prototype.processSignTransaction=function(t,e){const r=this;n([e=>r.approveTransaction(t,e),(t,e)=>r.checkApproval("transaction",t,e),e=>r.finalizeTx(t,e)],e)},d.prototype.processMessage=function(t,e){const r=this;n([e=>r.approveMessage(t,e),(t,e)=>r.checkApproval("message",t,e),e=>r.signMessage(t,e)],e)},d.prototype.processPersonalMessage=function(t,e){const r=this;n([e=>r.approvePersonalMessage(t,e),(t,e)=>r.checkApproval("message",t,e),e=>r.signPersonalMessage(t,e)],e)},d.prototype.processDecryptMessage=function(t,e){const r=this;n([e=>r.approveDecryptMessage(t,e),(t,e)=>r.checkApproval("decryptMessage",t,e),e=>r.decryptMessage(t,e)],e)},d.prototype.processEncryptionPublicKey=function(t,e){const r=this;n([e=>r.approveEncryptionPublicKey(t,e),(t,e)=>r.checkApproval("encryptionPublicKey",t,e),e=>r.encryptionPublicKey(t,e)],e)},d.prototype.processTypedMessage=function(t,e){const r=this;n([e=>r.approveTypedMessage(t,e),(t,e)=>r.checkApproval("message",t,e),e=>r.signTypedMessage(t,e)],e)},d.prototype.autoApprove=function(t,e){e(null,!0)},d.prototype.checkApproval=function(t,e,r){r(e?null:new Error("User denied "+t+" signature."))},d.prototype.parityPostTransaction=function(t,e){const r=this,n="0x"+r._parityRequestCount.toString(16);r._parityRequestCount++,r.emitPayload({method:"eth_sendTransaction",params:[t]},(function(t,e){if(t)return void(r._parityRequests[n]={error:t});const i=e.result;r._parityRequests[n]=i})),e(null,n)},d.prototype.parityPostSign=function(t,e,r){const n=this,i="0x"+n._parityRequestCount.toString(16);n._parityRequestCount++,n.emitPayload({method:"eth_sign",params:[t,e]},(function(t,e){if(t)return void(n._parityRequests[i]={error:t});const r=e.result;n._parityRequests[i]=r})),r(null,i)},d.prototype.parityCheckRequest=function(t,e){const r=this._parityRequests[t]||null;return r?r.error?e(r.error):void e(null,r):e(null,null)},d.prototype.recoverPersonalSignature=function(t,e){let r;try{r=a.recoverPersonalSignature(t)}catch(t){return e(t)}e(null,r)},d.prototype.validateTransaction=function(t,e){if(void 0===t.from)return e(new Error("Undefined address - from address required to sign transaction."));this.validateSender(t.from,(function(r,n){return r?e(r):n?void e():e(new Error(`Unknown address - unable to sign transaction for this address: "${t.from}"`))}))},d.prototype.validateMessage=function(t,e){if(void 0===t.from)return e(new Error("Undefined address - from address required to sign message."));this.validateSender(t.from,(function(r,n){return r?e(r):n?void e():e(new Error(`Unknown address - unable to sign message for this address: "${t.from}"`))}))},d.prototype.validatePersonalMessage=function(t,e){return void 0===t.from?e(new Error("Undefined address - from address required to sign personal message.")):void 0===t.data?e(new Error("Undefined message - message required to sign personal message.")):b(t.data)?void this.validateSender(t.from,(function(r,n){return r?e(r):n?void e():e(new Error(`Unknown address - unable to sign message for this address: "${t.from}"`))})):e(new Error("HookedWalletSubprovider - validateMessage - message was not encoded as hex."))},d.prototype.validateDecryptMessage=function(t,e){return void 0===t.from?e(new Error("Undefined address - from address required to decrypt message.")):void 0===t.data?e(new Error("Undefined message - message required to decrypt message.")):b(t.data)?void this.validateSender(t.from,(function(r,n){return r?e(r):n?void e():e(new Error(`Unknown address - unable to decrypt message for this address: "${t.from}"`))})):e(new Error("HookedWalletSubprovider - validateDecryptMessage - message was not encoded as hex."))},d.prototype.validateEncryptionPublicKey=function(t,e){this.validateSender(t,(function(r,n){return r?e(r):n?void e():e(new Error(`Unknown address - unable to obtain encryption public key for this address: "${t}"`))}))},d.prototype.validateTypedMessage=function(t,e){return void 0===t.from?e(new Error("Undefined address - from address required to sign typed data.")):void 0===t.data?e(new Error("Undefined data - message required to sign typed data.")):void this.validateSender(t.from,(function(r,n){return r?e(r):n?void e():e(new Error(`Unknown address - unable to sign message for this address: "${t.from}"`))}))},d.prototype.validateSender=function(t,e){if(!t)return e(null,!1);this.getAccounts((function(r,n){if(r)return e(r);const i=-1!==n.map(p).indexOf(t.toLowerCase());e(null,i)}))},d.prototype.finalizeAndSubmitTx=function(t,e){const r=this;r.nonceLock.take((function(){n([r.fillInTxExtras.bind(r,t),r.signTransaction.bind(r),r.publishTransaction.bind(r)],(function(t,n){if(r.nonceLock.leave(),t)return e(t);e(null,n)}))}))},d.prototype.finalizeTx=function(t,e){const r=this;r.nonceLock.take((function(){n([r.fillInTxExtras.bind(r,t),r.signTransaction.bind(r)],(function(n,i){if(r.nonceLock.leave(),n)return e(n);e(null,{raw:i,tx:t})}))}))},d.prototype.publishTransaction=function(t,e){this.emitPayload({method:"eth_sendRawTransaction",params:[t]},(function(t,r){if(t)return e(t);e(null,r.result)}))},d.prototype.estimateGas=function(t,e){h(this.engine,t,e)},d.prototype.getGasPrice=function(t){this.emitPayload({method:"eth_gasPrice",params:[]},(function(e,r){if(e)return t(e);t(null,r.result)}))},d.prototype.fillInTxExtras=function(t,e){const r=this,n=t.from,o={};void 0===t.gasPrice&&(o.gasPrice=r.getGasPrice.bind(r)),void 0===t.nonce&&(o.nonce=r.emitPayload.bind(r,{method:"eth_getTransactionCount",params:[n,"pending"]})),void 0===t.gas&&(o.gas=r.estimateGas.bind(r,function(t){return{from:t.from,to:t.to,value:t.value,data:t.data,gas:t.gas,gasPrice:t.gasPrice,nonce:t.nonce}}(t))),i(o,(function(r,n){if(r)return e(r);const i={};n.gasPrice&&(i.gasPrice=n.gasPrice),n.nonce&&(i.nonce=n.nonce.result),n.gas&&(i.gas=n.gas),e(null,u(t,i))}))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(e=(0,o.default)(e||i.default),!(0,n.default)(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function c(e){var n=(0,u.default)(t[r++]);e.push((0,a.default)(f)),n.apply(null,e)}function f(n){if(n||r===t.length)return e.apply(null,arguments);c((0,s.default)(arguments,1))}c([])};var n=c(r(147)),i=c(r(38)),o=c(r(64)),s=c(r(48)),a=c(r(66)),u=c(r(23));function c(t){return t&&t.__esModule?t:{default:t}}t.exports=e.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){(0,i.default)(n.default,t,e)};var n=o(r(139)),i=o(r(356));function o(t){return t&&t.__esModule?t:{default:t}}t.exports=e.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r){r=r||n.default;var a=(0,i.default)(e)?[]:{};t(e,(function(t,e,r){(0,s.default)(t)((function(t,n){arguments.length>2&&(n=(0,o.default)(arguments,1)),a[e]=n,r(t)}))}),(function(t){r(t,a)}))};var n=a(r(38)),i=a(r(47)),o=a(r(48)),s=a(r(23));function a(t){return t&&t.__esModule?t:{default:t}}t.exports=e.default},function(t,e,r){const n=r(36),i=r(358);function o(t){const e=new Error("Expect argument to be non-empty array");if("object"!=typeof t||!t.length)throw e;const r=t.map((function(t){return"bytes"===t.type?n.toBuffer(t.value):t.value})),o=t.map((function(t){return t.type})),s=t.map((function(t){if(!t.name)throw e;return t.type+" "+t.name}));return i.soliditySHA3(["bytes32","bytes32"],[i.soliditySHA3(new Array(t.length).fill("string"),s),i.soliditySHA3(o,r)])}function s(t,e){const r=n.toBuffer(e),i=n.fromRpcSig(r);return n.ecrecover(t,i.v,i.r,i.s)}function a(t){const e=n.toBuffer(t.data);return s(n.hashPersonalMessage(e),t.sig)}function u(t,e){for(var r=""+t;r.lengtho)throw new Error("Elements exceed array size: "+o);for(d in h=[],t=t.slice(0,t.lastIndexOf("[")),"string"==typeof r&&(r=JSON.parse(r)),r)h.push(l(t,r[d]));if("dynamic"===o){var p=l("uint256",r.length);h.unshift(p)}return e.concat(h)}if("bytes"===t)return r=e.from(r),h=e.concat([l("uint256",r.length),r]),r.length%32!=0&&(h=e.concat([h,n.zeros(32-r.length%32)])),h;if(t.startsWith("bytes")){if((o=a(t))<1||o>32)throw new Error("Invalid bytes width: "+o);return n.setLengthRight(r,32)}if(t.startsWith("uint")){if((o=a(t))%8||o<8||o>256)throw new Error("Invalid uint width: "+o);if((s=f(r)).bitLength()>o)throw new Error("Supplied uint exceeds width: "+o+" vs "+s.bitLength());if(s<0)throw new Error("Supplied uint is negative");return s.toArrayLike(e,"be",32)}if(t.startsWith("int")){if((o=a(t))%8||o<8||o>256)throw new Error("Invalid int width: "+o);if((s=f(r)).bitLength()>o)throw new Error("Supplied int exceeds width: "+o+" vs "+s.bitLength());return s.toTwos(256).toArrayLike(e,"be",32)}if(t.startsWith("ufixed")){if(o=u(t),(s=f(r))<0)throw new Error("Supplied ufixed is negative");return l("uint256",s.mul(new i(2).pow(new i(o[1]))))}if(t.startsWith("fixed"))return o=u(t),l("int256",f(r).mul(new i(2).pow(new i(o[1]))));throw new Error("Unsupported or invalid type: "+t)}function d(t,r,n){var o,s,a,u;if("string"==typeof t&&(t=p(t)),"address"===t.name)return d(t.rawType,r,n).toArrayLike(e,"be",20).toString("hex");if("bool"===t.name)return d(t.rawType,r,n).toString()===new i(1).toString();if("string"===t.name){var c=d(t.rawType,r,n);return e.from(c,"utf8").toString()}if(t.isArray){for(a=[],o=t.size,"dynamic"===t.size&&(n=d("uint256",r,n).toNumber(),o=d("uint256",r,n).toNumber(),n+=32),u=0;ut.size)throw new Error("Decoded int exceeds width: "+t.size+" vs "+s.bitLength());return s}if(t.name.startsWith("int")){if((s=new i(r.slice(n,n+32),16,"be").fromTwos(256)).bitLength()>t.size)throw new Error("Decoded uint exceeds width: "+t.size+" vs "+s.bitLength());return s}if(t.name.startsWith("ufixed")){if(o=new i(2).pow(new i(t.size[1])),!(s=d("uint256",r,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return s.div(o)}if(t.name.startsWith("fixed")){if(o=new i(2).pow(new i(t.size[1])),!(s=d("int256",r,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return s.div(o)}throw new Error("Unsupported or invalid type: "+t.name)}function p(t){var e,r,n;if(g(t)){e=c(t);var i=t.slice(0,t.lastIndexOf("["));return i=p(i),r={isArray:!0,name:t,size:e,memoryUsage:"dynamic"===e?32:i.memoryUsage*e,subArray:i}}switch(t){case"address":n="uint160";break;case"bool":n="uint8";break;case"string":n="bytes"}if(r={rawType:n,name:t,memoryUsage:32},t.startsWith("bytes")&&"bytes"!==t||t.startsWith("uint")||t.startsWith("int")?r.size=a(t):(t.startsWith("ufixed")||t.startsWith("fixed"))&&(r.size=u(t)),t.startsWith("bytes")&&"bytes"!==t&&(r.size<1||r.size>32))throw new Error("Invalid bytes width: "+r.size);if((t.startsWith("uint")||t.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint width: "+r.size);return r}function m(t){return"string"===t||"bytes"===t||"dynamic"===c(t)}function g(t){return t.lastIndexOf("]")===t.length-1}function b(t,e){return t.startsWith("address")||t.startsWith("bytes")?"0x"+e.toString("hex"):e.toString()}o.eventID=function(t,r){var i=t+"("+r.map(s).join(",")+")";return n.keccak256(e.from(i))},o.methodID=function(t,e){return o.eventID(t,e).slice(0,4)},o.rawEncode=function(t,r){var n=[],i=[],o=0;t.forEach((function(t){if(g(t)){var e=c(t);o+="dynamic"!==e?32*e:32}else o+=32}));for(var a=0;al)throw new Error("Elements exceed array size: "+l)}var d=r.map((function(t){return o.solidityHexValue(h,t,256)}));return e.concat(d)}if("bytes"===t)return r;if("string"===t)return e.from(r,"utf8");if("bool"===t){i=i||8;var p=Array(i/4).join("0");return e.from(r?p+"1":p+"0","hex")}if("address"===t){var m=20;return i&&(m=i/8),n.setLengthLeft(r,m)}if(t.startsWith("bytes")){if((s=a(t))<1||s>32)throw new Error("Invalid bytes width: "+s);return n.setLengthRight(r,s)}if(t.startsWith("uint")){if((s=a(t))%8||s<8||s>256)throw new Error("Invalid uint width: "+s);if((u=f(r)).bitLength()>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+u.bitLength());return i=i||s,u.toArrayLike(e,"be",i/8)}if(t.startsWith("int")){if((s=a(t))%8||s<8||s>256)throw new Error("Invalid int width: "+s);if((u=f(r)).bitLength()>s)throw new Error("Supplied int exceeds width: "+s+" vs "+u.bitLength());return i=i||s,u.toTwos(s).toArrayLike(e,"be",i/8)}throw new Error("Unsupported or invalid type: "+t)},o.solidityPack=function(t,r){if(t.length!==r.length)throw new Error("Number of types are not matching the values");for(var n=[],i=0;i="0"&&e<="9");)o+=t[s]-"0",s++;n=s-1,r.push(o)}else if("i"===i)r.push("int256");else{if("a"!==i)throw new Error("Unsupported or invalid type: "+i);r.push("int256[]")}}return r},o.toSerpent=function(t){for(var e=[],r=0;r=0)throw new Error("couldn't export to DER format");var a=i.g.mul(r);return s(a.getX(),a.getY(),e)},e.privateKeyModInverse=function(e){var r=new n(e);if(r.ucmp(o.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(o.n).toArrayLike(t,"be",32)},e.signatureImport=function(e){var r=new n(e.r);r.ucmp(o.n)>=0&&(r=new n(0));var i=new n(e.s);return i.ucmp(o.n)>=0&&(i=new n(0)),t.concat([r.toArrayLike(t,"be",32),i.toArrayLike(t,"be",32)])},e.ecdhUnsafe=function(t,e,r){void 0===r&&(r=!0);var a=i.keyFromPublic(t),u=new n(e);if(u.ucmp(o.n)>=0||u.isZero())throw new Error("scalar was invalid (zero or overflow)");var c=a.pub.mul(u);return s(c.getX(),c.getY(),r)};var s=function(e,r,n){var i;return n?((i=t.alloc(33))[0]=r.isOdd()?3:2,e.toArrayLike(t,"be",32).copy(i,1)):((i=t.alloc(65))[0]=4,e.toArrayLike(t,"be",32).copy(i,1),r.toArrayLike(t,"be",32).copy(i,33)),i}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var r=t.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=t.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]);e.privateKeyExport=function(e,i,o){void 0===o&&(o=!0);var s=t.from(o?r:n);return e.copy(s,o?8:9),i.copy(s,o?181:214),s},e.privateKeyImport=function(t){var e=t.length,r=0;if(e2)return null;if(e<(r+=1)+n)return null;var i=t[r+n-1]|(n>1?t[r+n-2]<<8:0);return e<(r+=n)+i||e32||ei)return null;if(2!==e[o++])return null;var a=e[o++];if(128&a){if(o+(s=a-128)>i)return null;for(;s>0&&0===e[o];o+=1,s-=1);for(a=0;s>0;o+=1,s-=1)a=(a<<8)+e[o]}if(a>i-o)return null;var u=o;if(o+=a,2!==e[o++])return null;var c=e[o++];if(128&c){if(o+(s=c-128)>i)return null;for(;s>0&&0===e[o];o+=1,s-=1);for(c=0;s>0;o+=1,s-=1)c=(c<<8)+e[o]}if(c>i-o)return null;var f=o;for(o+=c;a>0&&0===e[u];a-=1,u+=1);if(a>32)return null;var h=e.slice(u,u+a);for(h.copy(r,32-h.length);c>0&&0===e[f];c-=1,f+=1);if(c>32)return null;var l=e.slice(f,f+c);return l.copy(n,32-l.length),{r:r,s:n}}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.MAX_INTEGER=void 0;var n=r(9);e.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),e.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.from(e.KECCAK256_RLP_S,"hex")}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.importPublic=e.privateToPublic=e.privateToAddress=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.isPrecompiled=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isZeroAddress=e.isValidAddress=e.zeroAddress=void 0;var n=r(61),i=r(32),o=r(74),s=r(9),a=r(40),u=r(75);e.zeroAddress=function(){var t=a.zeros(20);return a.bufferToHex(t)},e.isValidAddress=function(t){return/^0x[0-9a-fA-F]{40}$/.test(t)},e.isZeroAddress=function(t){return e.zeroAddress()===a.addHexPrefix(t)},e.toChecksumAddress=function(t,e){t=i.stripHexPrefix(t).toLowerCase();for(var r=void 0!==e?e.toString()+"0x":"",n=u.keccak(r+t).toString("hex"),o="0x",s=0;s=8?o+=t[s].toUpperCase():o+=t[s];return o},e.isValidChecksumAddress=function(t,r){return e.isValidAddress(t)&&e.toChecksumAddress(t,r)===t},e.generateAddress=function(e,r){e=a.toBuffer(e);var n=new s(r);return n.isZero()?u.rlphash([e,null]).slice(-20):u.rlphash([e,t.from(n.toArray())]).slice(-20)},e.generateAddress2=function(e,r,i){var o=a.toBuffer(e),s=a.toBuffer(r),c=a.toBuffer(i);return n(20===o.length),n(32===s.length),u.keccak256(t.concat([t.from("ff","hex"),o,s,u.keccak256(c)])).slice(-20)},e.isPrecompiled=function(t){var e=a.unpad(t);return 1===e.length&&e[0]>=1&&e[0]<=8},e.isValidPrivate=function(t){return o.privateKeyVerify(t)},e.isValidPublic=function(e,r){return void 0===r&&(r=!1),64===e.length?o.publicKeyVerify(t.concat([t.from([4]),e])):!!r&&o.publicKeyVerify(e)},e.pubToAddress=function(t,e){return void 0===e&&(e=!1),t=a.toBuffer(t),e&&64!==t.length&&(t=o.publicKeyConvert(t,!1).slice(1)),n(64===t.length),u.keccak(t).slice(-20)},e.publicToAddress=e.pubToAddress,e.privateToAddress=function(t){return e.publicToAddress(e.privateToPublic(t))},e.privateToPublic=function(t){return t=a.toBuffer(t),o.publicKeyCreate(t,!1).slice(1)},e.importPublic=function(t){return 64!==(t=a.toBuffer(t)).length&&(t=o.publicKeyConvert(t,!1).slice(1)),t}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.hashPersonalMessage=e.isValidSignature=e.fromRpcSig=e.toRpcSig=e.ecrecover=e.ecsign=void 0;var n=r(74),i=r(9),o=r(40),s=r(75);function a(t,e){return e?t-(2*e+35):t-27}function u(t){return 0===t||1===t}e.ecsign=function(t,e,r){var i=n.sign(t,e),o=i.recovery;return{r:i.signature.slice(0,32),s:i.signature.slice(32,64),v:r?o+(2*r+35):o+27}},e.ecrecover=function(e,r,i,s,c){var f=t.concat([o.setLength(i,32),o.setLength(s,32)],64),h=a(r,c);if(!u(h))throw new Error("Invalid signature v value");var l=n.recover(e,f,h);return n.publicKeyConvert(l,!1).slice(1)},e.toRpcSig=function(e,r,n,i){if(!u(a(e,i)))throw new Error("Invalid signature v value");return o.bufferToHex(t.concat([o.setLengthLeft(r,32),o.setLengthLeft(n,32),o.toBuffer(e)]))},e.fromRpcSig=function(t){var e=o.toBuffer(t);if(65!==e.length)throw new Error("Invalid signature length");var r=e[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},e.isValidSignature=function(t,e,r,n,o){void 0===n&&(n=!0);var s=new i("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==e.length||32!==r.length)return!1;if(!u(a(t,o)))return!1;var f=new i(e),h=new i(r);return!(f.isZero()||f.gt(c)||h.isZero()||h.gt(c))&&(!n||1!==h.cmp(s))},e.hashPersonalMessage=function(e){var r=t.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return s.keccak(t.concat([r,e]))}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.defineProperties=void 0;var n=r(61),i=r(32),o=r(46),s=r(40);e.defineProperties=function(e,r,a){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return s.baToJSON(e.raw)},e.serialize=function(){return o.encode(e.raw)},r.forEach((function(r,i){function o(){return e.raw[i]}function a(o){"00"!==(o=s.toBuffer(o)).toString("hex")||r.allowZero||(o=t.allocUnsafe(0)),r.allowLess&&r.length?(o=s.stripZeros(o),n(r.length>=o.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===o.length||!r.length||n(r.length===o.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[i]=o}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:o,set:a}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:a,get:o})})),a)if("string"==typeof a&&(a=t.from(i.stripHexPrefix(a),"hex")),t.isBuffer(a)&&(a=o.decode(a)),Array.isArray(a)){if(a.length>e._fields.length)throw new Error("wrong number of fields in data");a.forEach((function(t,r){e[e._fields[r]]=s.toBuffer(t)}))}else{if("object"!=typeof a)throw new Error("invalid data");var u=Object.keys(a);r.forEach((function(t){-1!==u.indexOf(t.name)&&(e[t.name]=a[t.name]),-1!==u.indexOf(t.alias)&&(e[t.alias]=a[t.alias])}))}}}).call(this,r(2).Buffer)},function(t,e,r){(function(e){!function(r){"use strict";var n=function(t){setTimeout(t,0)};void 0!==e&&e&&"function"==typeof e.nextTick&&(n=e.nextTick),t.exports=function(t){var e={capacity:t||1,current:0,queue:[],firstHere:!1,take:function(){if(!1===e.firstHere){e.current++,e.firstHere=!0;var t=1}else t=0;var r={n:1};"function"==typeof arguments[0]?r.task=arguments[0]:r.n=arguments[0],arguments.length>=2&&("function"==typeof arguments[1]?r.task=arguments[1]:r.n=arguments[1]);var n=r.task;if(r.task=function(){n(e.leave)},e.current+r.n-t>e.capacity)return 1===t&&(e.current--,e.firstHere=!1),e.queue.push(r);e.current+=r.n-t,r.task(e.leave),1===t&&(e.firstHere=!1)},leave:function(t){if(t=t||1,e.current-=t,e.queue.length){var r=e.queue[0];r.n+e.current>e.capacity||(e.queue.shift(),e.current+=r.n,n(r.task))}else if(e.current<0)throw new Error("leave called too many times.")},available:function(t){return t=t||1,e.current+t<=e.capacity}};return e}}()}).call(this,r(5))},function(t,e,r){const n=r(67);t.exports=function(t,e,r){t.sendAsync(n({method:"eth_estimateGas",params:[e]}),(function(t,e){if(t)return"no contract code at given address"===t.message?r(null,"0xcf08"):r(t);r(null,e.result)}))}},function(t,e,r){(function(e){const n=r(21).inherits,i=r(370),o=r(36),s=r(49),a=r(149).blockTagForPayload;function u(t){this.nonceCache={}}t.exports=u,n(u,s),u.prototype.handleRequest=function(t,r,n){const s=this;switch(t.method){case"eth_getTransactionCount":var u=a(t),c=t.params[0].toLowerCase(),f=s.nonceCache[c];return void("pending"===u?f?n(null,f):r((function(t,e,r){if(t)return r();void 0===s.nonceCache[c]&&(s.nonceCache[c]=e),r()})):r());case"eth_sendRawTransaction":return void r((function(r,n,a){if(r)return a();var u=t.params[0],c=(o.stripHexPrefix(u),e.from(o.stripHexPrefix(u),"hex"),new i(e.from(o.stripHexPrefix(u),"hex"))),f="0x"+c.getSenderAddress().toString("hex").toLowerCase(),h=o.bufferToInt(c.nonce),l=(++h).toString(16);l.length%2&&(l="0"+l),l="0x"+l,s.nonceCache[f]=l,a()}));case"evm_revert":return s.nonceCache={},void r();default:return void r()}}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(e){var n=r(36),i=r(371),o=n.BN,s=new o("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),a=function(){function t(r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=r||{};var i=[{name:"nonce",length:32,allowLess:!0,default:new e([])},{name:"gasPrice",length:32,allowLess:!0,default:new e([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new e([])},{name:"to",allowZero:!0,length:20,default:new e([])},{name:"value",length:32,allowLess:!0,default:new e([])},{name:"data",alias:"input",allowZero:!0,default:new e([])},{name:"v",allowZero:!0,default:new e([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new e([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new e([])}];n.defineProperties(this,i,r),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var o=n.bufferToInt(this.v),s=Math.floor((o-35)/2);s<0&&(s=0),this._chainId=s||r.chainId||0,this._homestead=!0}return t.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},t.prototype.hash=function(t){void 0===t&&(t=!0);var e=void 0;if(t)e=this.raw;else if(this._chainId>0){var r=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,e=this.raw,this.raw=r}else e=this.raw.slice(0,6);return n.rlphash(e)},t.prototype.getChainId=function(){return this._chainId},t.prototype.getSenderAddress=function(){if(this._from)return this._from;var t=this.getSenderPublicKey();return this._from=n.publicToAddress(t),this._from},t.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},t.prototype.verifySignature=function(){var t=this.hash(!1);if(this._homestead&&1===new o(this.s).cmp(s))return!1;try{var e=n.bufferToInt(this.v);this._chainId>0&&(e-=2*this._chainId+8),this._senderPubKey=n.ecrecover(t,e,this.r,this.s)}catch(t){return!1}return!!this._senderPubKey},t.prototype.sign=function(t){var e=this.hash(!1),r=n.ecsign(e,t);this._chainId>0&&(r.v+=2*this._chainId+8),Object.assign(this,r)},t.prototype.getDataFee=function(){for(var t=this.raw[5],e=new o(0),r=0;r0&&e.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===t||!1===t?0===e.length:e.join(" ")},t}();t.exports=a}).call(this,r(2).Buffer)},function(t){t.exports=JSON.parse('{"genesisGasLimit":{"v":5000,"d":"Gas limit of the Genesis block."},"genesisDifficulty":{"v":17179869184,"d":"Difficulty of the Genesis block."},"genesisNonce":{"v":"0x0000000000000042","d":"the geneis nonce"},"genesisExtraData":{"v":"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa","d":"extra data "},"genesisHash":{"v":"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3","d":"genesis hash"},"genesisStateRoot":{"v":"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544","d":"the genesis state root"},"minGasLimit":{"v":5000,"d":"Minimum the gas limit may ever be."},"gasLimitBoundDivisor":{"v":1024,"d":"The bound divisor of the gas limit, used in update calculations."},"minimumDifficulty":{"v":131072,"d":"The minimum that the difficulty may ever be."},"difficultyBoundDivisor":{"v":2048,"d":"The bound divisor of the difficulty, used in the update calculations."},"durationLimit":{"v":13,"d":"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},"maximumExtraDataSize":{"v":32,"d":"Maximum size extra data may be after Genesis."},"epochDuration":{"v":30000,"d":"Duration between proof-of-work epochs."},"stackLimit":{"v":1024,"d":"Maximum size of VM stack allowed."},"callCreateDepth":{"v":1024,"d":"Maximum depth of call/create stack."},"tierStepGas":{"v":[0,2,3,5,8,10,20],"d":"Once per operation, for a selection of them."},"expGas":{"v":10,"d":"Once per EXP instuction."},"expByteGas":{"v":10,"d":"Times ceil(log256(exponent)) for the EXP instruction."},"sha3Gas":{"v":30,"d":"Once per SHA3 operation."},"sha3WordGas":{"v":6,"d":"Once per word of the SHA3 operation\'s data."},"sloadGas":{"v":50,"d":"Once per SLOAD operation."},"sstoreSetGas":{"v":20000,"d":"Once per SSTORE operation if the zeroness changes from zero."},"sstoreResetGas":{"v":5000,"d":"Once per SSTORE operation if the zeroness does not change from zero."},"sstoreRefundGas":{"v":15000,"d":"Once per SSTORE operation if the zeroness changes to zero."},"jumpdestGas":{"v":1,"d":"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},"logGas":{"v":375,"d":"Per LOG* operation."},"logDataGas":{"v":8,"d":"Per byte in a LOG* operation\'s data."},"logTopicGas":{"v":375,"d":"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},"createGas":{"v":32000,"d":"Once per CREATE operation & contract-creation transaction."},"callGas":{"v":40,"d":"Once per CALL operation & message call transaction."},"callStipend":{"v":2300,"d":"Free gas given at beginning of call."},"callValueTransferGas":{"v":9000,"d":"Paid for CALL when the value transfor is non-zero."},"callNewAccountGas":{"v":25000,"d":"Paid for CALL when the destination address didn\'t exist prior."},"suicideRefundGas":{"v":24000,"d":"Refunded following a suicide operation."},"memoryGas":{"v":3,"d":"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},"quadCoeffDiv":{"v":512,"d":"Divisor for the quadratic particle of the memory cost equation."},"createDataGas":{"v":200,"d":""},"txGas":{"v":21000,"d":"Per transaction. NOTE: Not payable on data of calls between transactions."},"txCreation":{"v":32000,"d":"the cost of creating a contract via tx"},"txDataZeroGas":{"v":4,"d":"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},"txDataNonZeroGas":{"v":68,"d":"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},"copyGas":{"v":3,"d":"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},"ecrecoverGas":{"v":3000,"d":""},"sha256Gas":{"v":60,"d":""},"sha256WordGas":{"v":12,"d":""},"ripemd160Gas":{"v":600,"d":""},"ripemd160WordGas":{"v":120,"d":""},"identityGas":{"v":15,"d":""},"identityWordGas":{"v":3,"d":""},"minerReward":{"v":"5000000000000000000","d":"the amount a miner get rewarded for mining a block"},"ommerReward":{"v":"625000000000000000","d":"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},"niblingReward":{"v":"156250000000000000","d":"the amount a miner gets for inculding a uncle"},"homeSteadForkNumber":{"v":1150000,"d":"the block that the Homestead fork started at"},"homesteadRepriceForkNumber":{"v":2463000,"d":"the block that the Homestead Reprice (EIP150) fork started at"},"timebombPeriod":{"v":100000,"d":"Exponential difficulty timebomb period"},"freeBlockPeriod":{"v":2}}')},function(t,e,r){const n=r(68),i=r(373);t.exports=class extends n{constructor(){super(({blockTracker:t,provider:e,engine:r})=>{const{events:n,middleware:o}=i({blockTracker:t,provider:e});return n.on("notification",t=>r.emit("data",null,t)),o})}}},function(t,e,r){const n=r(69).default,i=r(156),{createAsyncMiddleware:o}=r(152),s=r(151),{unsafeRandomBytes:a,incrementHexInt:u}=r(39),c=r(73);function f(t){return{hash:t.hash,parentHash:t.parentHash,sha3Uncles:t.sha3Uncles,miner:t.miner,stateRoot:t.stateRoot,transactionsRoot:t.transactionsRoot,receiptsRoot:t.receiptsRoot,logsBloom:t.logsBloom,difficulty:t.difficulty,number:t.number,gasLimit:t.gasLimit,gasUsed:t.gasUsed,nonce:t.nonce,mixHash:t.mixHash,timestamp:t.timestamp,extraData:t.extraData}}t.exports=function({blockTracker:t,provider:e}){const r={},h=s({blockTracker:t,provider:e});let l=!1;const d=new n,p=i({eth_subscribe:o((async function(n,i){if(l)throw new Error("SubscriptionManager - attempting to use after destroying");const o=n.params[0],s=a(16);let d;switch(o){case"newHeads":d=function({subId:r}){const n={type:o,destroy:async()=>{t.removeListener("sync",n.update)},update:async({oldBlock:t,newBlock:n})=>{const i=n,o=u(t);(await c({provider:e,fromBlock:o,toBlock:i})).map(f).forEach(t=>{m(r,t)})}};return t.on("sync",n.update),n}({subId:s});break;case"logs":const r=n.params[1],i=await h.newLogFilter(r);d=function({subId:t,filter:e}){e.on("update",e=>m(t,e));return{type:o,destroy:async()=>await h.uninstallFilter(e.idHex)}}({subId:s,filter:i});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${o}"`)}return r[s]=d,void(i.result=s)})),eth_unsubscribe:o((async function(t,e){if(l)throw new Error("SubscriptionManager - attempting to use after destroying");const n=t.params[0],i=r[n];if(!i)return void(e.result=!1);delete r[n],await i.destroy(),e.result=!0}))});return p.destroy=function(){d.removeAllListeners();for(const t in r)r[t].destroy(),delete r[t];l=!0},{events:d,middleware:p};function m(t,e){d.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:t,result:e}})}}},function(t,e,r){"use strict";r.r(e);var n={};r.r(n),r.d(n,"generateKey",(function(){return d})),r.d(n,"verifyHmac",(function(){return p})),r.d(n,"encrypt",(function(){return m})),r.d(n,"decrypt",(function(){return g}));var i=r(1),o=r(161);var s=class{constructor(){this._eventEmitters=[]}subscribe(t){this._eventEmitters.push(t)}unsubscribe(t){this._eventEmitters=this._eventEmitters.filter(e=>e.event!==t)}trigger(t){let e,r=[];e=Object(i.isJsonRpcRequest)(t)?t.method:Object(i.isJsonRpcResponseSuccess)(t)||Object(i.isJsonRpcResponseError)(t)?"response:"+t.id:Object(i.isInternalEvent)(t)?t.event:"",e&&(r=this._eventEmitters.filter(t=>t.event===e)),r&&r.length||Object(i.isReservedEvent)(e)||Object(i.isInternalEvent)(e)||(r=this._eventEmitters.filter(t=>"call_request"===t.event)),r.forEach(e=>{if(Object(i.isJsonRpcResponseError)(t)){const r=new Error(t.error.message);e.callback(r,null)}else e.callback(null,t)})}};var a=class{constructor(t="walletconnect"){this.storageId=t}getSession(){let t=null;const e=Object(i.getLocal)(this.storageId);return e&&Object(i.isWalletConnectSession)(e)&&(t=e),t}setSession(t){return Object(i.setLocal)(this.storageId,t),t}removeSession(){Object(i.removeLocal)(this.storageId)}};const u="abcdefghijklmnopqrstuvwxyz0123456789".split("").map(t=>`https://${t}.bridge.walletconnect.org`);function c(){return u[Math.floor(Math.random()*u.length)]}var f=class{constructor(t){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new s,this._clientMeta=Object(i.getClientMeta)()||t.connectorOpts.clientMeta||null,this._cryptoLib=t.cryptoLib,this._sessionStorage=t.sessionStorage||new a(t.connectorOpts.storageId),this._qrcodeModal=t.connectorOpts.qrcodeModal,this._qrcodeModalOptions=t.connectorOpts.qrcodeModalOptions,this._signingMethods=[...i.signingMethods,...t.connectorOpts.signingMethods||[]],!t.connectorOpts.bridge&&!t.connectorOpts.uri&&!t.connectorOpts.session)throw new Error("Missing one of the required parameters: bridge / uri / session");var e;t.connectorOpts.bridge&&(this.bridge=function(t){return"walletconnect.org"===function(t){return function(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}(t).split(".").slice(-2).join(".")}(t)}(e=t.connectorOpts.bridge)?c():e),t.connectorOpts.uri&&(this.uri=t.connectorOpts.uri);const r=t.connectorOpts.session||this._getStorageSession();r&&(this.session=r),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=t.transport||new o.a({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),t.connectorOpts.uri&&this._subscribeToSessionRequest(),t.pushServerOpts&&this._registerPushServer(t.pushServerOpts)}set bridge(t){t&&(this._bridge=t)}get bridge(){return this._bridge}set key(t){if(!t)return;const e=Object(i.convertHexToArrayBuffer)(t);this._key=e}get key(){if(this._key){return Object(i.convertArrayBufferToHex)(this._key,!0)}return""}set clientId(t){t&&(this._clientId=t)}get clientId(){let t=this._clientId;return t||(t=this._clientId=Object(i.uuid)()),this._clientId}set peerId(t){t&&(this._peerId=t)}get peerId(){return this._peerId}set clientMeta(t){}get clientMeta(){let t=this._clientMeta;return t||(t=this._clientMeta=Object(i.getClientMeta)()),t}set peerMeta(t){this._peerMeta=t}get peerMeta(){return this._peerMeta}set handshakeTopic(t){t&&(this._handshakeTopic=t)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(t){t&&(this._handshakeId=t)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(t){if(!t)return;const{handshakeTopic:e,bridge:r,key:n}=this._parseUri(t);this.handshakeTopic=e,this.bridge=r,this.key=n}set chainId(t){this._chainId=t}get chainId(){return this._chainId}set networkId(t){this._networkId=t}get networkId(){return this._networkId}set accounts(t){this._accounts=t}get accounts(){return this._accounts}set rpcUrl(t){this._rpcUrl=t}get rpcUrl(){return this._rpcUrl}set connected(t){}get connected(){return this._connected}set pending(t){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(t){t&&(this._connected=t.connected,this.accounts=t.accounts,this.chainId=t.chainId,this.bridge=t.bridge,this.key=t.key,this.clientId=t.clientId,this.clientMeta=t.clientMeta,this.peerId=t.peerId,this.peerMeta=t.peerMeta,this.handshakeId=t.handshakeId,this.handshakeTopic=t.handshakeTopic)}on(t,e){const r={event:t,callback:e};this._eventManager.subscribe(r)}off(t){this._eventManager.unsubscribe(t)}async createInstantRequest(t){this._key=await this._generateKey();const e=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(t)}]});this.handshakeId=e.id,this.handshakeTopic=Object(i.uuid)(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error("User close QRCode Modal")});const r=()=>{this.killSession()};try{const t=await this._sendCallRequest(e);return t&&r(),t}catch(t){throw r(),t}}async connect(t){if(!this._qrcodeModal)throw new Error("QRCode Modal not provided");return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(t),new Promise(async(t,e)=>{this.on("modal_closed",()=>e(new Error("User close QRCode Modal"))),this.on("connect",(r,n)=>{if(r)return e(r);t(n.params[0])})}))}async createSession(t){if(this._connected)throw new Error("Session currently connected");if(this.pending)return;this._key=await this._generateKey();const e=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:t&&t.chainId?t.chainId:null}]});this.handshakeId=e.id,this.handshakeTopic=Object(i.uuid)(),this._sendSessionRequest(e,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(t){if(this._connected)throw new Error("Session currently connected");this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},r={id:this.handshakeId,jsonrpc:"2.0",result:e};this._sendResponse(r),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(t){if(this._connected)throw new Error("Session currently connected");const e=t&&t.message?t.message:"Session Rejected",r=this._formatResponse({id:this.handshakeId,error:{message:e}});this._sendResponse(r),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession()}updateSession(t){if(!this._connected)throw new Error("Session currently disconnected");this.chainId=t.chainId,this.accounts=t.accounts,this.networkId=t.networkId||0,this.rpcUrl=t.rpcUrl||"";const e={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},r=this._formatRequest({method:"wc_sessionUpdate",params:[e]});this._sendSessionRequest(r,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(t){const e=t?t.message:"Session Disconnected",r=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});await this._sendRequest(r),this._handleSessionDisconnect(e)}async sendTransaction(t){if(!this._connected)throw new Error("Session currently disconnected");const e=Object(i.parseTransactionData)(t),r=this._formatRequest({method:"eth_sendTransaction",params:[e]});return await this._sendCallRequest(r)}async signTransaction(t){if(!this._connected)throw new Error("Session currently disconnected");const e=Object(i.parseTransactionData)(t),r=this._formatRequest({method:"eth_signTransaction",params:[e]});return await this._sendCallRequest(r)}async signMessage(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"eth_sign",params:t});return await this._sendCallRequest(e)}async signPersonalMessage(t){if(!this._connected)throw new Error("Session currently disconnected");t=Object(i.parsePersonalSign)(t);const e=this._formatRequest({method:"personal_sign",params:t});return await this._sendCallRequest(e)}async signTypedData(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"eth_signTypedData",params:t});return await this._sendCallRequest(e)}async updateChain(t){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"wallet_updateChain",params:[t]});return await this._sendCallRequest(e)}unsafeSend(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),new Promise((e,r)=>{this._subscribeToResponse(t.id,(t,n)=>{if(t)r(t);else{if(!n)throw new Error("Missing JSON RPC response");e(n)}})})}async sendCustomRequest(t,e){if(!this._connected)throw new Error("Session currently disconnected");switch(t.method){case"eth_accounts":return this.accounts;case"eth_chainId":return Object(i.convertNumberToHex)(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":t.params&&(t.params[0]=Object(i.parseTransactionData)(t.params[0]));break;case"personal_sign":t.params&&(t.params=Object(i.parsePersonalSign)(t.params))}const r=this._formatRequest(t);return await this._sendCallRequest(r,e)}approveRequest(t){if(!Object(i.isJsonRpcResponseSuccess)(t))throw new Error('JSON-RPC success response must include "result" field');{const e=this._formatResponse(t);this._sendResponse(e)}}rejectRequest(t){if(!Object(i.isJsonRpcResponseError)(t))throw new Error('JSON-RPC error response must include "error" field');{const e=this._formatResponse(t);this._sendResponse(e)}}transportClose(){this._transport.close()}async _sendRequest(t,e){const r=this._formatRequest(t),n=await this._encrypt(r),o=void 0!==(null==e?void 0:e.topic)?e.topic:this.peerId,s=JSON.stringify(n),a=void 0!==(null==e?void 0:e.forcePushNotification)?!e.forcePushNotification:Object(i.isSilentPayload)(r);this._transport.send(s,o,a)}async _sendResponse(t){const e=await this._encrypt(t),r=this.peerId,n=JSON.stringify(e);this._transport.send(n,r,!0)}async _sendSessionRequest(t,e,r){this._sendRequest(t,r),this._subscribeToSessionResponse(t.id,e)}_sendCallRequest(t,e){return this._sendRequest(t,e),this._eventManager.trigger({event:"call_request_sent",params:[{request:t,options:e}]}),this._subscribeToCallResponse(t.id)}_formatRequest(t){if(void 0===t.method)throw new Error('JSON RPC request must have valid "method" value');return{id:void 0===t.id?Object(i.payloadId)():t.id,jsonrpc:"2.0",method:t.method,params:void 0===t.params?[]:t.params}}_formatResponse(t){if(void 0===t.id)throw new Error('JSON RPC request must have valid "id" value');const e={id:t.id,jsonrpc:"2.0"};if(Object(i.isJsonRpcResponseError)(t)){const r=Object(i.formatRpcError)(t.error);return Object.assign(Object.assign(Object.assign({},e),t),{error:r})}if(Object(i.isJsonRpcResponseSuccess)(t)){return Object.assign(Object.assign({},e),t)}throw new Error("JSON RPC response format is invalid")}_handleSessionDisconnect(t){const e=t||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),Object(i.removeLocal)(i.mobileLinkChoiceKey)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:e}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(t,e){e&&e.approved?(this._connected?(e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,e.chainId&&(this.chainId=e.chainId),e.accounts&&(this.accounts=e.accounts),e.peerId&&!this.peerId&&(this.peerId=e.peerId),e.peerMeta&&!this.peerMeta&&(this.peerMeta=e.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(t)}async _handleIncomingMessages(t){if(![this.clientId,this.handshakeTopic].includes(t.topic))return;let e;try{e=JSON.parse(t.payload)}catch(t){return}const r=await this._decrypt(e);r&&this._eventManager.trigger(r)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(t,e){this.on("response:"+t,e)}_subscribeToSessionResponse(t,e){this._subscribeToResponse(t,(t,r)=>{t?this._handleSessionResponse(t.message):r.result?this._handleSessionResponse(e,r.result):r.error&&r.error.message?this._handleSessionResponse(r.error.message):this._handleSessionResponse(e)})}_subscribeToCallResponse(t){return new Promise((e,r)=>{this._subscribeToResponse(t,(t,n)=>{t?r(t):n.result?e(n.result):n.error&&n.error.message?r(new Error(n.error.message)):r(new Error("JSON RPC response format is invalid"))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(t,e)=>{const{request:r}=e.params[0];if(Object(i.isMobile)()&&this._signingMethods.includes(r.method)){const t=Object(i.getLocal)(i.mobileLinkChoiceKey);t&&(window.location.href=t.href)}}),this.on("wc_sessionRequest",(t,e)=>{t&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:t.toString()}]}),this.handshakeId=e.id,this.peerId=e.params[0].peerId,this.peerMeta=e.params[0].peerMeta;const r=Object.assign(Object.assign({},e),{method:"session_request"});this._eventManager.trigger(r)}),this.on("wc_sessionUpdate",(t,e)=>{t&&this._handleSessionResponse(t.message),this._handleSessionResponse("Session disconnected",e.params[0])})}_initTransport(){this._transport.on("message",t=>this._handleIncomingMessages(t)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(t){const e=Object(i.parseWalletConnectUri)(t);if(e.protocol===this.protocol){if(!e.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const t=e.handshakeTopic;if(!e.bridge)throw Error("Invalid or missing bridge url parameter value");const r=decodeURIComponent(e.bridge);if(!e.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:t,bridge:r,key:e.key}}throw new Error("URI format is invalid")}async _generateKey(){if(this._cryptoLib){return await this._cryptoLib.generateKey()}return null}async _encrypt(t){const e=this._key;if(this._cryptoLib&&e){return await this._cryptoLib.encrypt(t,e)}return null}async _decrypt(t){const e=this._key;if(this._cryptoLib&&e){return await this._cryptoLib.decrypt(t,e)}return null}_getStorageSession(){let t=null;return this._sessionStorage&&(t=this._sessionStorage.getSession()),t}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(t){if(!t.url||"string"!=typeof t.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!t.type||"string"!=typeof t.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!t.token||"string"!=typeof t.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const e={bridge:this.bridge,topic:this.clientId,type:t.type,token:t.token,peerName:"",language:t.language||""};this.on("connect",async(r,n)=>{if(r)throw r;if(t.peerMeta){const t=n.params[0].peerMeta.name;e.peerName=t}try{const r=await fetch(t.url+"/new",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)});if(!(await r.json()).success)throw Error("Failed to register in Push Server")}catch(r){throw Error("Failed to register in Push Server")}})}},h=r(33),l=r(0);async function d(t){const e=(t||256)/8,r=h.randomBytes(e);return Object(i.convertBufferToArrayBuffer)(l.arrayToBuffer(r))}async function p(t,e){const r=l.hexToArray(t.data),n=l.hexToArray(t.iv),i=l.hexToArray(t.hmac),o=l.arrayToHex(i,!1),s=l.concatArrays(r,n),a=await h.hmacSha256Sign(e,s),u=l.arrayToHex(a,!1);return l.removeHexPrefix(o)===l.removeHexPrefix(u)}async function m(t,e,r){const n=l.bufferToArray(Object(i.convertArrayBufferToBuffer)(e)),o=r||await d(128),s=l.bufferToArray(Object(i.convertArrayBufferToBuffer)(o)),a=l.arrayToHex(s,!1),u=JSON.stringify(t),c=l.utf8ToArray(u),f=await h.aesCbcEncrypt(s,n,c),p=l.arrayToHex(f,!1),m=l.concatArrays(f,s),g=await h.hmacSha256Sign(n,m);return{data:p,hmac:l.arrayToHex(g,!1),iv:a}}async function g(t,e){const r=l.bufferToArray(Object(i.convertArrayBufferToBuffer)(e));if(!r)throw new Error("Missing key: required for decryption");if(!await p(t,r))return null;const n=l.hexToArray(t.data),o=l.hexToArray(t.iv),s=await h.aesCbcDecrypt(o,r,n),a=l.arrayToUtf8(s);let u;try{u=JSON.parse(a)}catch(t){return null}return u}e.default=class extends f{constructor(t,e){super({cryptoLib:n,connectorOpts:t,pushServerOpts:e})}}},function(t,e,r){"use strict";r.r(e);function n(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var t=this._currentReleaser;this._currentReleaser=void 0,t()}},t.prototype._dispatch=function(){var t=this,e=this._queue.shift();if(e){var r=!1;this._currentReleaser=function(){r||(r=!0,t._value++,t._dispatch())},e([this._value--,this._currentReleaser])}},t}(),s=function(){function t(){this._semaphore=new o(1)}return t.prototype.acquire=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this._semaphore.acquire()];case 1:return t=e.sent(),[2,t[1]]}}))}))},t.prototype.runExclusive=function(t){return this._semaphore.runExclusive((function(){return t()}))},t.prototype.isLocked=function(){return this._semaphore.isLocked()},t.prototype.release=function(){this._semaphore.release()},t}();function a(t,e,r){var o=this;return void 0===r&&(r=new Error("timeout")),{acquire:function(){return new Promise((function(s,a){return n(o,void 0,void 0,(function(){var n,o;return i(this,(function(i){switch(i.label){case 0:return n=!1,setTimeout((function(){n=!0,a(r)}),e),[4,t.acquire()];case 1:return o=i.sent(),n?(Array.isArray(o)?o[1]:o)():s(o),[2]}}))}))}))},runExclusive:function(t){return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:e=function(){},n.label=1;case 1:return n.trys.push([1,,7,8]),[4,this.acquire()];case 2:return r=n.sent(),Array.isArray(r)?(e=r[1],[4,t(r[0])]):[3,4];case 3:return[2,n.sent()];case 4:return e=r,[4,t()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:return e(),[7];case 8:return[2]}}))}))},release:function(){t.release()},isLocked:function(){return t.isLocked()}}}r.d(e,"Mutex",(function(){return s})),r.d(e,"Semaphore",(function(){return o})),r.d(e,"withTimeout",(function(){return a}))},function(t,e,r){"use strict";r.r(e);var n,i,o,s,a,u,c,f={},h=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function d(t,e){for(var r in e)t[r]=e[r];return t}function p(t){var e=t.parentNode;e&&e.removeChild(t)}function m(t,e,r){var n,i=arguments,o={};for(n in e)"key"!==n&&"ref"!==n&&(o[n]=e[n]);if(arguments.length>3)for(r=[r],n=3;n2&&(e.children=h.slice.call(arguments,2)),r={},e)"key"!==n&&"ref"!==n&&(r[n]=e[n]);return g(t.type,r,e.key||t.key,e.ref||t.ref,null)}function q(t){var e={},r={__c:"__cC"+c++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i=this;return this.getChildContext||(n=[],this.getChildContext=function(){return e[r.__c]=i,e},this.shouldComponentUpdate=function(t){i.props.value!==t.value&&n.some((function(e){e.context=t.value,M(e)}))},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return r.Consumer.contextType=r,r.Provider.__=r,r}n={__e:function(t,e){for(var r,n;e=e.__;)if((r=e.__c)&&!r.__)try{if(r.constructor&&null!=r.constructor.getDerivedStateFromError&&(n=!0,r.setState(r.constructor.getDerivedStateFromError(t))),null!=r.componentDidCatch&&(n=!0,r.componentDidCatch(t)),n)return M(r.__E=r)}catch(e){t=e}throw t}},v.prototype.setState=function(t,e){var r;r=this.__s!==this.state?this.__s:this.__s=d({},this.state),"function"==typeof t&&(t=t(r,this.props)),t&&d(r,t),null!=t&&this.__v&&(e&&this.__h.push(e),M(this))},v.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),M(this))},v.prototype.render=y,i=[],o=0,s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=f,c=0;var U,D,H,z=0,F=[],W=n.__r,K=n.diffed,V=n.__c,J=n.unmount;function Z(t,e){n.__h&&n.__h(D,t,z||e),z=0;var r=D.__H||(D.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function G(t){return z=1,Y(ft,t)}function Y(t,e,r){var n=Z(U++,2);return n.__c||(n.__c=D,n.__=[r?r(e):ft(void 0,e),function(e){var r=t(n.__[0],e);n.__[0]!==r&&(n.__[0]=r,n.__c.setState({}))}]),n.__}function $(t,e){var r=Z(U++,3);!n.__s&&ct(r.__H,e)&&(r.__=t,r.__H=e,D.__H.__h.push(r))}function X(t,e){var r=Z(U++,4);!n.__s&&ct(r.__H,e)&&(r.__=t,r.__H=e,D.__h.push(r))}function Q(t){return z=5,et((function(){return{current:t}}),[])}function tt(t,e,r){z=6,X((function(){"function"==typeof t?t(e()):t&&(t.current=e())}),null==r?r:r.concat(t))}function et(t,e){var r=Z(U++,7);return ct(r.__H,e)?(r.__H=e,r.__h=t,r.__=t()):r.__}function rt(t,e){return z=8,et((function(){return t}),e)}function nt(t){var e=D.context[t.__c],r=Z(U++,9);return r.__c=t,e?(null==r.__&&(r.__=!0,e.sub(D)),e.props.value):t.__}function it(t,e){n.useDebugValue&&n.useDebugValue(e?e(t):t)}function ot(t){var e=Z(U++,10),r=G();return e.__=t,D.componentDidCatch||(D.componentDidCatch=function(t){e.__&&e.__(t),r[1](t)}),[r[0],function(){r[1](void 0)}]}function st(){F.some((function(t){if(t.__P)try{t.__H.__h.forEach(at),t.__H.__h.forEach(ut),t.__H.__h=[]}catch(e){return t.__H.__h=[],n.__e(e,t.__v),!0}})),F=[]}function at(t){t.t&&t.t()}function ut(t){var e=t.__();"function"==typeof e&&(t.t=e)}function ct(t,e){return!t||e.some((function(e,r){return e!==t[r]}))}function ft(t,e){return"function"==typeof e?e(t):e}function ht(t,e){for(var r in e)t[r]=e[r];return t}function lt(t,e){for(var r in t)if("__source"!==r&&!(r in e))return!0;for(var n in e)if("__source"!==n&&t[n]!==e[n])return!0;return!1}n.__r=function(t){W&&W(t),U=0,(D=t.__c).__H&&(D.__H.__h.forEach(at),D.__H.__h.forEach(ut),D.__H.__h=[])},n.diffed=function(t){K&&K(t);var e=t.__c;if(e){var r=e.__H;r&&r.__h.length&&(1!==F.push(e)&&H===n.requestAnimationFrame||((H=n.requestAnimationFrame)||function(t){var e,r=function(){clearTimeout(n),cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,100);"undefined"!=typeof window&&(e=requestAnimationFrame(r))})(st))}},n.__c=function(t,e){e.some((function(t){try{t.__h.forEach(at),t.__h=t.__h.filter((function(t){return!t.__||ut(t)}))}catch(r){e.some((function(t){t.__h&&(t.__h=[])})),e=[],n.__e(r,t.__v)}})),V&&V(t,e)},n.unmount=function(t){J&&J(t);var e=t.__c;if(e){var r=e.__H;if(r)try{r.__.forEach((function(t){return t.t&&t.t()}))}catch(t){n.__e(t,e.__v)}}},r.d(e,"version",(function(){return Nt})),r.d(e,"Children",(function(){return yt})),r.d(e,"render",(function(){return Ot})),r.d(e,"hydrate",(function(){return Pt})),r.d(e,"unmountComponentAtNode",(function(){return Ht})),r.d(e,"createPortal",(function(){return Rt})),r.d(e,"createFactory",(function(){return qt})),r.d(e,"cloneElement",(function(){return Dt})),r.d(e,"isValidElement",(function(){return Ut})),r.d(e,"findDOMNode",(function(){return zt})),r.d(e,"PureComponent",(function(){return dt})),r.d(e,"memo",(function(){return pt})),r.d(e,"forwardRef",(function(){return gt})),r.d(e,"unstable_batchedUpdates",(function(){return Ft})),r.d(e,"Suspense",(function(){return wt})),r.d(e,"SuspenseList",(function(){return xt})),r.d(e,"lazy",(function(){return St})),r.d(e,"useState",(function(){return G})),r.d(e,"useReducer",(function(){return Y})),r.d(e,"useEffect",(function(){return $})),r.d(e,"useLayoutEffect",(function(){return X})),r.d(e,"useRef",(function(){return Q})),r.d(e,"useImperativeHandle",(function(){return tt})),r.d(e,"useMemo",(function(){return et})),r.d(e,"useCallback",(function(){return rt})),r.d(e,"useContext",(function(){return nt})),r.d(e,"useDebugValue",(function(){return it})),r.d(e,"useErrorBoundary",(function(){return ot})),r.d(e,"createElement",(function(){return m})),r.d(e,"createContext",(function(){return q})),r.d(e,"createRef",(function(){return b})),r.d(e,"Fragment",(function(){return y})),r.d(e,"Component",(function(){return v}));var dt=function(t){var e,r;function n(e){var r;return(r=t.call(this,e)||this).isPureReactComponent=!0,r}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,n.prototype.shouldComponentUpdate=function(t,e){return lt(this.props,t)||lt(this.state,e)},n}(v);function pt(t,e){function r(t){var r=this.props.ref,n=r==t.ref;return!n&&r&&(r.call?r(null):r.current=null),e?!e(this.props,t)||!n:lt(this.props,t)}function n(e){return this.shouldComponentUpdate=r,m(t,ht({},e))}return n.prototype.isReactComponent=!0,n.displayName="Memo("+(t.displayName||t.name)+")",n.t=!0,n}var mt=n.__b;function gt(t){function e(e){var r=ht({},e);return delete r.ref,t(r,e.ref)}return e.prototype.isReactComponent=e.t=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}n.__b=function(t){t.type&&t.type.t&&t.ref&&(t.props.ref=t.ref,t.ref=null),mt&&mt(t)};var bt=function(t,e){return t?E(t).reduce((function(t,r,n){return t.concat(e(r,n))}),[]):null},yt={map:bt,forEach:bt,count:function(t){return t?E(t).length:0},only:function(t){if(1!==(t=E(t)).length)throw new Error("Children.only() expects only one child.");return t[0]},toArray:E},vt=n.__e;function _t(t){return t&&((t=ht({},t)).__c=null,t.__k=t.__k&&t.__k.map(_t)),t}function wt(){this.__u=0,this.o=null,this.__b=null}function Mt(t){var e=t.__.__c;return e&&e.u&&e.u(t)}function St(t){var e,r,n;function i(i){if(e||(e=t()).then((function(t){r=t.default||t}),(function(t){n=t})),n)throw n;if(!r)throw e;return m(r,i)}return i.displayName="Lazy",i.t=!0,i}function xt(){this.i=null,this.l=null}n.__e=function(t,e,r){if(t.then)for(var n,i=e;i=i.__;)if((n=i.__c)&&n.__c)return n.__c(t,e.__c);vt(t,e,r)},(wt.prototype=new v).__c=function(t,e){var r=this;null==r.o&&(r.o=[]),r.o.push(e);var n=Mt(r.__v),i=!1,o=function(){i||(i=!0,n?n(s):s())};e.__c=e.componentWillUnmount,e.componentWillUnmount=function(){o(),e.__c&&e.__c()};var s=function(){var t;if(!--r.__u)for(r.__v.__k[0]=r.state.u,r.setState({u:r.__b=null});t=r.o.pop();)t.forceUpdate()};r.__u++||r.setState({u:r.__b=r.__v.__k[0]}),t.then(o,o)},wt.prototype.render=function(t,e){return this.__b&&(this.__v.__k[0]=_t(this.__b),this.__b=null),[m(v,null,e.u?null:t.children),e.u&&t.fallback]};var Et=function(t,e,r){if(++r[1]===r[0]&&t.l.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.l.size))for(r=t.i;r;){for(;r.length>3;)r.pop()();if(r[1]