tronweb
Version:
JavaScript SDK that encapsulates the TRON HTTP API
1 lines • 726 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TronWeb",[],t):"object"==typeof exports?exports.TronWeb=t():e.TronWeb=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(e,t,r){"use strict";r.d(t,"k",(function(){return a})),r.d(t,"j",(function(){return s})),r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return c})),r.d(t,"o",(function(){return l})),r.d(t,"p",(function(){return f})),r.d(t,"l",(function(){return d})),r.d(t,"i",(function(){return h})),r.d(t,"d",(function(){return p})),r.d(t,"e",(function(){return b})),r.d(t,"c",(function(){return v})),r.d(t,"g",(function(){return g})),r.d(t,"f",(function(){return m})),r.d(t,"h",(function(){return y})),r.d(t,"n",(function(){return A})),r.d(t,"m",(function(){return S}));const n=new(r(3).a)("bytes/5.0.8");function i(e){return!!e.toHexString}function o(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function a(e){return d(e)&&!(e.length%2)||s(e)}function s(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(null==e.length)return!1;for(let t=0;t<e.length;t++){const r=e[t];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function u(e,t){if(t||(t={}),"number"==typeof e){n.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),o(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e)&&(e=e.toHexString()),d(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0x0"+r.substring(2):"right"===t.hexPad?r+="0":n.throwArgumentError("hex data is odd-length","value",e));const i=[];for(let e=0;e<r.length;e+=2)i.push(parseInt(r.substring(e,e+2),16));return o(new Uint8Array(i))}return s(e)?o(new Uint8Array(e)):n.throwArgumentError("invalid arrayify value","value",e)}function c(e){const t=e.map(e=>u(e)),r=t.reduce((e,t)=>e+t.length,0),n=new Uint8Array(r);return t.reduce((e,t)=>(n.set(t,e),e+t.length),0),o(n)}function l(e){let t=u(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function f(e,t){(e=u(e)).length>t&&n.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),o(r)}function d(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}function h(e,t){if(t||(t={}),"number"==typeof e){n.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t="0123456789abcdef"[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e))return e.toHexString();if(d(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":n.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(s(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+="0123456789abcdef"[(240&n)>>4]+"0123456789abcdef"[15&n]}return t}return n.throwArgumentError("invalid hexlify value","value",e)}function p(e){if("string"!=typeof e)e=h(e);else if(!d(e)||e.length%2)return null;return(e.length-2)/2}function b(e,t,r){return"string"!=typeof e?e=h(e):(!d(e)||e.length%2)&&n.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function v(e){let t="0x";return e.forEach(e=>{t+=h(e).substring(2)}),t}function g(e){const t=m(h(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function m(e){"string"!=typeof e&&(e=h(e)),d(e)||n.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}function y(e,t){for("string"!=typeof e?e=h(e):d(e)||n.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&n.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function A(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(a(e)){const r=u(e);65!==r.length&&n.throwArgumentError("invalid signature string; must be 65 bytes","signature",e),t.r=h(r.slice(0,32)),t.s=h(r.slice(32,64)),t.v=r[64],t.v<27&&(0===t.v||1===t.v?t.v+=27:n.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=h(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=f(u(t._vs),32);t._vs=h(r);const i=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const o=h(r);null==t.s?t.s=o:t.s!==o&&n.throwArgumentError("signature v mismatch _vs","signature",e)}null==t.recoveryParam?null==t.v?n.throwArgumentError("signature missing v and recoveryParam","signature",e):t.recoveryParam=1-t.v%2:null==t.v?t.v=27+t.recoveryParam:t.recoveryParam!==1-t.v%2&&n.throwArgumentError("signature recoveryParam mismatch v","signature",e),null!=t.r&&d(t.r)?t.r=y(t.r,32):n.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&d(t.s)?t.s=y(t.s,32):n.throwArgumentError("signature missing or invalid s","signature",e);const r=u(t.s);r[0]>=128&&n.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const i=h(r);t._vs&&(d(t._vs)||n.throwArgumentError("signature invalid _vs","signature",e),t._vs=y(t._vs,32)),null==t._vs?t._vs=i:t._vs!==i&&n.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t}function S(e){return h(c([(e=A(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},function(e,t,r){"use strict";var n={};r.r(n),r.d(n,"byte2hexStr",(function(){return v})),r.d(n,"bytesToString",(function(){return g})),r.d(n,"hextoString",(function(){return m})),r.d(n,"byteArray2hexStr",(function(){return y})),r.d(n,"base64DecodeFromString",(function(){return A})),r.d(n,"base64EncodeToString",(function(){return S}));var i={};r.r(i),r.d(i,"bin2String",(function(){return E})),r.d(i,"arrayEquals",(function(){return x})),r.d(i,"stringToBytes",(function(){return F})),r.d(i,"byte2hexStr",(function(){return v})),r.d(i,"bytesToString",(function(){return g})),r.d(i,"hextoString",(function(){return m})),r.d(i,"byteArray2hexStr",(function(){return y})),r.d(i,"base64DecodeFromString",(function(){return A})),r.d(i,"base64EncodeToString",(function(){return S})),r.d(i,"hexChar2byte",(function(){return P})),r.d(i,"isHexChar",(function(){return k})),r.d(i,"hexStr2byteArray",(function(){return C})),r.d(i,"strToDate",(function(){return B})),r.d(i,"isNumber",(function(){return O})),r.d(i,"getStringType",(function(){return L}));var o={};r.r(o),r.d(o,"encode58",(function(){return J})),r.d(o,"decode58",(function(){return N}));var a={};r.r(a),r.d(a,"getBase58CheckAddress",(function(){return H})),r.d(a,"decodeBase58Address",(function(){return X})),r.d(a,"signTransaction",(function(){return U})),r.d(a,"arrayToBase64String",(function(){return G})),r.d(a,"signBytes",(function(){return z})),r.d(a,"getRowBytesFromTransactionBase64",(function(){return V})),r.d(a,"genPriKey",(function(){return Z})),r.d(a,"computeAddress",(function(){return K})),r.d(a,"getAddressFromPriKey",(function(){return W})),r.d(a,"decode58Check",(function(){return q})),r.d(a,"isAddressValid",(function(){return Q})),r.d(a,"getBase58CheckAddressFromPriKeyBase64String",(function(){return Y})),r.d(a,"getHexStrAddressFromPriKeyBase64String",(function(){return $})),r.d(a,"getAddressFromPriKeyBase64String",(function(){return ee})),r.d(a,"getPubKeyFromPriKey",(function(){return te})),r.d(a,"ECKeySign",(function(){return re})),r.d(a,"SHA256",(function(){return ne})),r.d(a,"passwordToAddress",(function(){return ie})),r.d(a,"pkToAddress",(function(){return oe}));var s={};r.r(s),r.d(s,"generateAccount",(function(){return ae}));var u={};r.r(u),r.d(u,"decodeParams",(function(){return ce})),r.d(u,"encodeParams",(function(){return le}));var c=r(12),l=r.n(c),f=r(2),d=r.n(f),h=r(5),p=r.n(h);function b(){var e=this;this._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",this.encode=function(t){for(var r,n,i,o,a,s,u,c="",l=0;l<t.length;)o=(r=t.charCodeAt(l++))>>2,a=(3&r)<<4|(n=t.charCodeAt(l++))>>4,s=(15&n)<<2|(i=t.charCodeAt(l++))>>6,u=63&i,isNaN(n)?s=u=64:isNaN(i)&&(u=64),c=c+e._keyStr.charAt(o)+e._keyStr.charAt(a)+e._keyStr.charAt(s)+e._keyStr.charAt(u);return c},this.encodeIgnoreUtf8=function(t){for(var r,n,i,o,a,s,u,c="",l=0;l<t.length;)o=(r=t[l++])>>2,a=(3&r)<<4|(n=t[l++])>>4,s=(15&n)<<2|(i=t[l++])>>6,u=63&i,isNaN(n)?s=u=64:isNaN(i)&&(u=64),c=c+e._keyStr.charAt(o)+e._keyStr.charAt(a)+e._keyStr.charAt(s)+e._keyStr.charAt(u);return c},this.decode=function(t){var r,n,i,o,a,s,u="",c=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<t.length;)r=e._keyStr.indexOf(t.charAt(c++))<<2|(o=e._keyStr.indexOf(t.charAt(c++)))>>4,n=(15&o)<<4|(a=e._keyStr.indexOf(t.charAt(c++)))>>2,i=(3&a)<<6|(s=e._keyStr.indexOf(t.charAt(c++))),u+=String.fromCharCode(r),64!=a&&(u+=String.fromCharCode(n)),64!=s&&(u+=String.fromCharCode(i));return e._utf8_decode(u)},this.decodeToByteArray=function(t){var r,n,i,o,a,s,u="",c=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");c<t.length;)r=e._keyStr.indexOf(t.charAt(c++))<<2|(o=e._keyStr.indexOf(t.charAt(c++)))>>4,n=(15&o)<<4|(a=e._keyStr.indexOf(t.charAt(c++)))>>2,i=(3&a)<<6|(s=e._keyStr.indexOf(t.charAt(c++))),u+=String.fromCharCode(r),64!=a&&(u+=String.fromCharCode(n)),64!=s&&(u+=String.fromCharCode(i));return e._out2ByteArray(u)},this._out2ByteArray=function(e){for(var t=new Array(e.length),r=0,n=0;r<e.length;)n=e.charCodeAt(r),t[r]=n,r++;return t},this._utf8_encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):n>127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t},this._utf8_decode=function(e){for(var t="",r=0,n=0,i=0,o=0;r<e.length;)(n=e.charCodeAt(r))<128?(t+=String.fromCharCode(n),r++):n>191&&n<224?(i=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&i),r+=2):(i=e.charCodeAt(r+1),o=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),r+=3);return t}}function v(e){if("number"!=typeof e)throw new Error("Input must be a number");if(e<0||e>255)throw new Error("Input must be a byte");var t="";return t+="0123456789ABCDEF".charAt(e>>4),t+="0123456789ABCDEF".charAt(15&e)}function g(e){if("string"==typeof e)return e;for(var t="",r=0;r<e.length;r++){var n=e[r].toString(2),i=n.match(/^1+?(?=0)/);if(i&&8===n.length){for(var o=i[0].length,a=e[r].toString(2).slice(7-o),s=1;s<o;s++)a+=e[s+r].toString(2).slice(2);t+=String.fromCharCode(parseInt(a,2)),r+=o-1}else t+=String.fromCharCode(e[r])}return t}function m(e){for(var t=e.replace(/^0x/,"").split(""),r="",n=0;n<t.length/2;n++){var i="0x".concat(t[2*n]).concat(t[2*n+1]);r+=String.fromCharCode(i)}return r}function y(e){for(var t="",r=0;r<e.length;r++)t+=v(e[r]);return t}function A(e){return(new b).decodeToByteArray(e)}function S(e){return(new b).encodeIgnoreUtf8(e)}var w=r(25),M=r.n(w),T=r(7);function E(e){return g(e)}function x(e,t,r){if(e.length!=t.length)return!1;var n;for(n=0;n<e.length;n++)if(r){if(e[n]!=t[n])return!1}else if(JSON.stringify(e[n])!=JSON.stringify(t[n]))return!1;return!0}function F(e){if("string"!=typeof e)throw new Error("The passed string is not a string");var t,r,n=new Array;t=e.length;for(var i=0;i<t;i++)(r=e.charCodeAt(i))>=65536&&r<=1114111?(n.push(r>>18&7|240),n.push(r>>12&63|128),n.push(r>>6&63|128),n.push(63&r|128)):r>=2048&&r<=65535?(n.push(r>>12&15|224),n.push(r>>6&63|128),n.push(63&r|128)):r>=128&&r<=2047?(n.push(r>>6&31|192),n.push(63&r|128)):n.push(255&r);return n}function P(e){var t;if(e>="A"&&e<="F"?t=e.charCodeAt(0)-"A".charCodeAt(0)+10:e>="a"&&e<="f"?t=e.charCodeAt(0)-"a".charCodeAt(0)+10:e>="0"&&e<="9"&&(t=e.charCodeAt(0)-"0".charCodeAt(0)),"number"==typeof t)return t;throw new Error("The passed hex char is not a valid hex char")}function k(e){return e>="A"&&e<="F"||e>="a"&&e<="f"||e>="0"&&e<="9"?1:0}function C(e){if("string"!=typeof e)throw new Error("The passed string is not a string");for(var t=Array(),r=0,n=0,i=0,o=0;o<e.length;o++){var a=e.charAt(o);if(!k(a))throw new Error("The passed hex char is not a valid hex string");r<<=4,r+=P(a),0==++n%2&&(t[i++]=r,r=0)}return t}function B(e){if(!/^\d{4}-\d{2}-\d{2}( \d{2}-\d{2}-\d{2}|)/.test(e))throw new Error("The passed date string is not valid");var t=e.split(" "),r=t[0].split("-"),n=parseInt(r[0],10),i=parseInt(r[1],10)-1,o=parseInt(r[2],10);if(t.length>1){var a=t[1].split("-"),s=parseInt(a[0],10),u=parseInt(a[1],10),c=parseInt(a[2],10);return new Date(n,i,o,s,u,c)}return new Date(n,i,o)}function O(e){return e>="0"&&e<="9"?1:0}function L(e){if(null==e)return-1;if("string"!=typeof e)return-1;if(0==e.length||""==e)return-1;var t=0;if(40==e.length)for(;t<40;t++){if(!k(e.charAt(t)))break}if(40==t)return 1;for(t=0;t<e.length;t++){if(!O(e.charAt(t)))break}if(t==e.length)return 2;for(t=0;t<e.length;t++){if(e.charAt(t)>" ")return 3}return-1}for(var _="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",R={},I=0;I<_.length;I++)R[_.charAt(I)]=I;function J(e){if(0===e.length)return"";var t,r,n=[0];for(t=0;t<e.length;t++){for(r=0;r<n.length;r++)n[r]<<=8;n[0]+=e[t];var i=0;for(r=0;r<n.length;++r)n[r]+=i,i=n[r]/58|0,n[r]%=58;for(;i;)n.push(i%58),i=i/58|0}for(t=0;0===e[t]&&t<e.length-1;t++)n.push(0);return n.reverse().map((function(e){return _[e]})).join("")}function N(e){if(0===e.length)return[];var t,r,n=[0];for(t=0;t<e.length;t++){var i=e[t];if(!(i in R))throw new Error("Non-base58 character");for(r=0;r<n.length;r++)n[r]*=58;n[0]+=R[i];var o=0;for(r=0;r<n.length;++r)n[r]+=o,o=n[r]>>8,n[r]&=255;for(;o;)n.push(255&o),o>>=8}for(t=0;"1"===e[t]&&t<e.length-1;t++)n.push(0);return n.reverse()}var D=r(43),j=r(11);function H(e){var t=ne(e),r=ne(t).slice(0,4);return J(r=e.concat(r))}function X(e){if("string"!=typeof e)return!1;if(e.length<=4)return!1;var t=N(e);if(e.length<=4)return!1;var r=t.length-4,n=t.slice(r),i=ne(t=t.slice(0,r)),o=ne(i).slice(0,4);if(n[0]==o[0]&&n[1]==o[1]&&n[2]==o[2]&&n[3]==o[3])return t;throw new Error("Invalid address provided")}function U(e,t){"string"==typeof e&&(e=C(e));var r=re(C(t.txID),e);return Array.isArray(t.signature)?t.signature.includes(r)||t.signature.push(r):t.signature=[r],t}function G(e){return btoa(String.fromCharCode.apply(String,M()(e)))}function z(e,t){return"string"==typeof e&&(e=C(e)),re(ne(t),e)}function V(e){var t=A(e);return proto.protocol.Transaction.deserializeBinary(t).getRawData().serializeBinary()}function Z(){for(var e=new D.ec("secp256k1").genKeyPair().getPrivate().toString("hex");e.length<64;)e="0".concat(e);return C(e)}function K(e){65===e.length&&(e=e.slice(1));var t=Object(j.keccak256)(e).toString().substring(2);return C(T.a+t.substring(24))}function W(e){return K(te(e))}function q(e){var t=N(e);if(t.length<=4)return!1;var r=t.slice(0,t.length-4),n=ne(r),i=ne(n);return i[0]===t[r.length]&&i[1]===t[r.length+1]&&i[2]===t[r.length+2]&&i[3]===t[r.length+3]&&r}function Q(e){if("string"!=typeof e)return!1;if(e.length!==T.d)return!1;var t=N(e);if(25!==t.length)return!1;if(t[0]!==T.b)return!1;var r=t.slice(21),n=ne(t=t.slice(0,21)),i=ne(n).slice(0,4);return r[0]==i[0]&&r[1]==i[1]&&r[2]==i[2]&&r[3]==i[3]}function Y(e){return H(K(te(A(e))))}function $(e){return y(K(te(A(e))))}function ee(e){return S(K(te(A(e))))}function te(e){for(var t=new D.ec("secp256k1").keyFromPrivate(e,"bytes").getPublic(),r=t.x,n=t.y,i=r.toString("hex");i.length<64;)i="0".concat(i);for(var o=n.toString("hex");o.length<64;)o="0".concat(o);return C("04".concat(i).concat(o))}function re(e,t){for(var r=new D.ec("secp256k1").keyFromPrivate(t,"bytes").sign(e),n=r.r,i=r.s,o=r.recoveryParam,a=n.toString("hex");a.length<64;)a="0".concat(a);for(var s=i.toString("hex");s.length<64;)s="0".concat(s);return a+s+v(o)}function ne(e){var t=y(e);return C(Object(j.sha256)("0x"+t).replace(/^0x/,""))}function ie(e){return H(W(A(e)))}function oe(e){return H(W(C(e)))}function ae(){var e=Z(),t=te(e),r=W(e);return{privateKey:y(e),publicKey:y(t),address:{base58:H(r),hex:y(r)}}}var se=r(8),ue=new j.AbiCoder;function ce(e,t,r,n){if(r&&"boolean"!=typeof r||(n=r,r=t,t=e,e=[]),n&&r.replace(/^0x/,"").length%64==8&&(r="0x"+r.replace(/^0x/,"").substring(8)),r.replace(/^0x/,"").length%64)throw new Error("The encoded string is not valid. Its length must be a multiple of 64.");return t=t.map((function(e){return/trcToken/.test(e)&&(e=e.replace(/trcToken/,"uint256")),e})),ue.decode(t,r).reduce((function(r,n,i){return"address"==t[i]&&(n=T.a+n.substr(2).toLowerCase()),e.length?r[e[i]]=n:r.push(n),r}),e.length?{}:[])}function le(e,t){for(var r=0;r<e.length;r++)"address"===e[r]&&(t[r]=se.default.address.toHex(t[r]).replace(T.c,"0x"));return ue.encode(e,t)}var fe=r(95),de=r.n(fe),he=r(29),pe=r.n(he);function be(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(Object(r),!0).forEach((function(t){l()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ge={isValidURL:function(e){return"string"==typeof e&&de.a.isURL(e.toString(),{protocols:["http","https"],require_tld:!1})},isObject:function(e){return e===Object(e)&&"[object Array]"!==Object.prototype.toString.call(e)},isArray:function(e){return Array.isArray(e)},isJson:function(e){try{return!!JSON.parse(e)}catch(e){return!1}},isBoolean:function(e){return"boolean"==typeof e},isBigNumber:function(e){return e&&(e instanceof pe.a||e.constructor&&"BigNumber"===e.constructor.name)},isString:function(e){return"string"==typeof e||e&&e.constructor&&"String"===e.constructor.name},isFunction:function(e){return"function"==typeof e},isHex:function(e){return"string"==typeof e&&!isNaN(parseInt(e,16))&&/^(0x|)[a-fA-F0-9]+$/.test(e)},isInteger:function(e){return null!==e&&Number.isInteger(Number(e))},hasProperty:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},hasProperties:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.length&&!n.map((function(r){return t.hasProperty(e,r)})).includes(!1)},mapEvent:function(e){var t={block:e.block_number,timestamp:e.block_timestamp,contract:e.contract_address,name:e.event_name,transaction:e.transaction_id,result:e.result,resourceNode:e.resource_Node||(e._unconfirmed?"fullNode":"solidityNode")};return e._unconfirmed&&(t.unconfirmed=e._unconfirmed),e._fingerprint&&(t.fingerprint=e._fingerprint),t},parseEvent:function(e,t){var r=t.inputs;if(!e.result)return e;if(this.isObject(e.result))for(var n=0;n<r.length;n++){var i=r[n];"address"==i.type&&i.name in e.result&&(e.result[i.name]=T.a+e.result[i.name].substr(2).toLowerCase())}else this.isArray(e.result)&&(e.result=e.result.reduce((function(e,t,n){var i=r[n],o=i.name;return"address"==i.type&&(t=T.a+t.substr(2).toLowerCase()),e[o]=t,e}),{}));return e},padLeft:function(e,t,r){for(var n=e.toString();n.length<r;)n=t+n;return n},isNotNullOrUndefined:function(e){return null!=e},sleep:function(){var e=arguments;return p()(d.a.mark((function t(){var r;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.length>0&&void 0!==e[0]?e[0]:1e3,t.abrupt("return",new Promise((function(e){return setTimeout(e,r)})));case 2:case"end":return t.stop()}}),t)})))()}};t.a=ve(ve({},ge),{},{code:i,accounts:s,base58:o,bytes:n,crypto:a,abi:u,ethersUtils:j})},function(e,t,r){e.exports=r(105)},function(e,t,r){"use strict";r.d(t,"a",(function(){return f}));let n=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let a=o.default,s=null;const u=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var c,l;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(c||(c={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT"}(l||(l={}));class f{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",e),a>o[r]||console.log.apply(console,t)}debug(...e){this._log(f.levels.DEBUG,e)}info(...e){this._log(f.levels.INFO,e)}warn(...e){this._log(f.levels.WARNING,e)}makeError(e,t,r){if(i)return this.makeError("censored error",t,{});t||(t=f.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(e=>{try{n.push(e+"="+JSON.stringify(r[e]))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}}),n.push("code="+t),n.push("version="+this.version);const o=e;n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=o,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,f.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),u&&this.throwError("platform missing String.prototype.normalize",f.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:u})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,f.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,f.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,f.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",f.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",f.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",f.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return s||(s=new f("logger/5.0.8")),s}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!e)return;this.globalLogger().throwError("error censorship permanent",f.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!e,n=!!t}static setLogLevel(e){const t=o[e.toLowerCase()];null!=t?a=t:f.globalLogger().warn("invalid log level - "+e)}static from(e){return new f(e)}}f.errors=l,f.levels=c},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!("string"==typeof e||e instanceof String)){var t;throw t=null===e?"null":"object"===(t=n(e))&&e.constructor&&e.constructor.hasOwnProperty("name")?e.constructor.name:"a ".concat(t),new TypeError("Expected string but received ".concat(t,"."))}},e.exports=t.default,e.exports.default=t.default},function(e,t){function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)}))}}},function(e,t,r){(function(e){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a=r(128).Buffer}catch(e){}function s(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o<i;o++){var a=e.charCodeAt(o)-48;n<<=4,n|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,o=0;for(r=e.length-6,n=0;r>=t;r-=6)i=s(e,r,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,c=0,l=r;l<s;l+=n)c=u(e,l,l+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var f=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)f*=t;this.imuln(f),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&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?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var l=u>>>26,f=67108863&u,d=Math.min(c,t.length-1),h=Math.max(0,c-e.length+1);h<=d;h++){var p=c-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!==(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],h=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?b+r:c[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,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 a,s,u="le"===t,c=new e(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a<n.length;a++)o=(t=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,i,o,a=e.words,s=t.words,u=r.words,c=0,l=0|a[0],f=8191&l,d=l>>>13,h=0|a[1],p=8191&h,b=h>>>13,v=0|a[2],g=8191&v,m=v>>>13,y=0|a[3],A=8191&y,S=y>>>13,w=0|a[4],M=8191&w,T=w>>>13,E=0|a[5],x=8191&E,F=E>>>13,P=0|a[6],k=8191&P,C=P>>>13,B=0|a[7],O=8191&B,L=B>>>13,_=0|a[8],R=8191&_,I=_>>>13,J=0|a[9],N=8191&J,D=J>>>13,j=0|s[0],H=8191&j,X=j>>>13,U=0|s[1],G=8191&U,z=U>>>13,V=0|s[2],Z=8191&V,K=V>>>13,W=0|s[3],q=8191&W,Q=W>>>13,Y=0|s[4],$=8191&Y,ee=Y>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,be=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ve=(c+(n=Math.imul(f,H))|0)+((8191&(i=(i=Math.imul(f,X))+Math.imul(d,H)|0))<<13)|0;c=((o=Math.imul(d,X))+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,X))+Math.imul(b,H)|0,o=Math.imul(b,X);var ge=(c+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,z)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,z)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,H),i=(i=Math.imul(g,X))+Math.imul(m,H)|0,o=Math.imul(m,X),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,z)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,z)|0;var me=(c+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(A,H),i=(i=Math.imul(A,X))+Math.imul(S,H)|0,o=Math.imul(S,X),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,z)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,z)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,K)|0;var ye=(c+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,Q)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,Q)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(M,H),i=(i=Math.imul(M,X))+Math.imul(T,H)|0,o=Math.imul(T,X),n=n+Math.imul(A,G)|0,i=(i=i+Math.imul(A,z)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,z)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,K)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,K)|0,n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,Q)|0;var Ae=(c+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,X))+Math.imul(F,H)|0,o=Math.imul(F,X),n=n+Math.imul(M,G)|0,i=(i=i+Math.imul(M,z)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,z)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,K)|0,n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,Q)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,ee)|0;var Se=(c+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(k,H),i=(i=Math.imul(k,X))+Math.imul(C,H)|0,o=Math.imul(C,X),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,z)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,z)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,K)|0,n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,Q)|0)+Math.imul(S,q)|0,o=o+Math.imul(S,Q)|0,n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var we=(c+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(O,H),i=(i=Math.imul(O,X))+Math.imul(L,H)|0,o=Math.imul(L,X),n=n+Math.imul(k,G)|0,i=(i=i+Math.imul(k,z)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,z)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(F,Z)|0,o=o+Math.imul(F,K)|0,n=n+Math.imul(M,q)|0,i=(i=i+Math.imul(M,Q)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0;var Me=(c+(n=n+Math.imul(f,ue)|0)|0)+((8191&(i=(i=i+Math.imul(f,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(R,H),i=(i=Math.imul(R,X))+Math.imul(I,H)|0,o=Math.imul(I,X),n=n+Math.imul(O,G)|0,i=(i=i+Math.imul(O,z)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,z)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,K)|0,n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(F,q)|0,o=o+Math.imul(F,Q)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0;var Te=(c+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,X))+Math.imul(D,H)|0,o=Math.imul(D,X),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,z)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,z)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,K)|0,n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,Q)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(F,$)|0,o=o+Math.imul(F,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(T,re)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,n=n+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,fe)|0,o=o+Math.imul(b,de)|0;var Ee=(c+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,be)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(N,G),i=(i=Math.imul(N,z))+Math.imul(D,G)|0,o=Math.imul(D,z),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,Q)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(F,re)|0,o=o+Math.imul(F,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,ae)|0,n=n+Math.imul(A,ue)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(N,Z),i=(i=Math.imul(N,K))+Math.imul(D,Z)|0,o=Math.imul(D,K),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,Q)|0)+Math.imul(I,q)|0,o=o+Math.imul(I,Q)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,ae)|0,n=n+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,ce)|0)+Math.imul(T,ue)|0,o=o+Math.imul(T,ce)|0,n=n+Math.imul(A,fe)|0,i=(i=i+Math.imul(A,de)|0)+Math.imul(S,fe)|0,o=o+Math.imul(S,de)|0;var Fe=(c+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,be)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,be)|0)+(i>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,Q))+Math.imul(D,q)|0,o=Math.imul(D,Q),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(F,ue)|0,o=o+Math.imul(F,ce)|0,n=n+Math.imul(M,fe)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(T,fe)|0,o=o+Math.imul(T,de)|0;var Pe=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,be)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(N,$),i=(i=Math.imul(N,ee))+Math.imul(D,$)|0,o=Math.imul(D,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(F,fe)|0,o=o+Math.imul(F,de)|0;var ke=(c+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,be)|0)+Math.imul(T,pe)|0))<<13)|0;c=((o=o+Math.imul(T,be)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(N,re),i=(i=Math.imul(N,ne))+Math.imul(D,re)|0,o=Math.imul(D,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,ce)|0,n=n+Math.imul(k,fe)|0,i=(i=i+Math.imul(k,de)|0)+Math.imul(C,fe)|0,o=o+Math.imul(C,de)|0;var Ce=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(F,pe)|0))<<13)|0;c=((o=o+Math.imul(F,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(N,oe),i=(i=Math.imul(N,ae))+Math.imul(D,oe)|0,o=Math.imul(D,ae),n=n+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,n=n+Math.imul(O,fe)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(L,fe)|0,o=o+Math.imul(L,de)|0;var Be=(c+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(N,ue),i=(i=Math.imul(N,ce))+Math.imul(D,ue)|0,o=Math.imul(D,ce),n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,de)|0;var Oe=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,be)|0)+Math.imul(L,pe)|0))<<13)|0;c=((o=o+Math.imul(L,be)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(N,fe),i=(i=Math.imul(N,de))+Math.imul(D,fe)|0,o=Math.imul(D,de);var Le=(c+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,be)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,be)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var _e=(c+(n=Math.imul(N,pe))|0)+((8191&(i=(i=Math.imul(N,be))+Math.imul(D,pe)|0))<<13)|0;return c=((o=Math.imul(D,be))+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,u[0]=ve,u[1]=ge,u[2]=me,u[3]=ye,u[4]=Ae,u[5]=Se,u[6]=we,u[7]=Me,u[8]=Te,u[9]=Ee,u[10]=xe,u[11]=Fe,u[12]=Pe,u[13]=ke,u[14]=Ce,u[15]=Be,u[16]=Oe,u[17]=Le,u[18]=_e,0!==c&&(u[19]=c,r.length++),r};function p(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(h=d),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,f=(0|e.words[l])*(0|t.words[c]),d=67108863&f;s=67108863&(d=d+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},b.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a<o;a++)n[a]=t[e[a]],i[a]=r[e[a]]},b.prototype.transform=function(e,t,r,n,i,o){this.permute(o,e,t,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,d=c,h=0;h<a;h++){var p=r[l+h],b=n[l+h],v=r[l+h+a],g=n[l+h+a],m=f*v-d*g;g=f*g+d*v,v=m,r[l+h]=p+v,n[l+h]=b+g,r[l+h+a]=p-v,n[l+h+a]=b-g,h!==s&&(m=u*f-c*d,d=u*d+c*f,f=m)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},b.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),c=new Array(n