@snapshot-labs/snapshot.js 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/snapshot.cjs.js +1 -1
- package/dist/snapshot.esm.js +1 -1
- package/dist/snapshot.min.js +1 -1
- package/package.json +1 -1
- package/src/sign/hashedTypes.json +2 -1
- package/src/sign/types.ts +1 -1
package/dist/snapshot.cjs.js
CHANGED
|
@@ -107,7 +107,7 @@ const updateProposalTypes = {
|
|
|
107
107
|
};
|
|
108
108
|
const flagProposalTypes = {
|
|
109
109
|
FlagProposal: [
|
|
110
|
-
{ name: 'from', type: '
|
|
110
|
+
{ name: 'from', type: 'string' },
|
|
111
111
|
{ name: 'space', type: 'string' },
|
|
112
112
|
{ name: 'proposal', type: 'string' },
|
|
113
113
|
{ name: 'timestamp', type: 'uint64' }
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -97,7 +97,7 @@ const updateProposalTypes = {
|
|
|
97
97
|
};
|
|
98
98
|
const flagProposalTypes = {
|
|
99
99
|
FlagProposal: [
|
|
100
|
-
{ name: 'from', type: '
|
|
100
|
+
{ name: 'from', type: 'string' },
|
|
101
101
|
{ name: 'space', type: 'string' },
|
|
102
102
|
{ name: 'proposal', type: 'string' },
|
|
103
103
|
{ name: 'timestamp', type: 'uint64' }
|
package/dist/snapshot.min.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
|
-
***************************************************************************** */;function e(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function r(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function o(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})})),e}function a(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=a((function(t,e){var r="undefined"!=typeof self?self:i,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function m(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function p(t){var e=new FileReader,r=m(e);return e.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&n&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,r,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=m(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=u(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[u(t)]},d.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},d.prototype.set=function(t,e){this.map[u(t)]=l(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},i&&(d.prototype[Symbol.iterator]=d.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var r,i,n=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),w.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function k(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},y.call(v.prototype),y.call(k.prototype),k.prototype.clone=function(){return new k(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},k.error=function(){var t=new k(null,{status:0,statusText:""});return t.type="error",t};var M=[301,302,303,307,308];k.redirect=function(t,e){if(-1===M.indexOf(e))throw new RangeError("Invalid status code");return new k(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(t,r){return new Promise((function(i,o){var a=new v(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function h(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;i(new k(n,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&n&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",h),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",h)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=d,t.Request=v,t.Response=k),e.Headers=d,e.Request=v,e.Response=k,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e})),h=n(s);const u={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},l={Proposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"privacy",type:"string"},{name:"app",type:"string"}]},c={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"plugins",type:"string"},{name:"privacy",type:"string"}]},d={FlagProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},f={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},m={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},p={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},g={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},y={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},w={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},v={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},b={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},k={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},M={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},_={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},E={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},A={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},j={Statement:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"space",type:"string"},{name:"about",type:"string"},{name:"statement",type:"string"},{name:"discourse",type:"string"},{name:"status",type:"string"},{name:"network",type:"string"}]},x={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},S={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var N={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},I={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},T={hub:"http://localhost:3000",sequencer:"http://localhost:3001"},C=[],z=[],O="undefined"!=typeof Uint8Array?Uint8Array:Array,R=!1;function P(){R=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)C[e]=t[e],z[t.charCodeAt(e)]=e;z["-".charCodeAt(0)]=62,z["_".charCodeAt(0)]=63}function B(t,e,r){for(var i,n,o=[],a=e;a<r;a+=3)i=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(C[(n=i)>>18&63]+C[n>>12&63]+C[n>>6&63]+C[63&n]);return o.join("")}function D(t){var e;R||P();for(var r=t.length,i=r%3,n="",o=[],a=16383,s=0,h=r-i;s<h;s+=a)o.push(B(t,s,s+a>h?h:s+a));return 1===i?(e=t[r-1],n+=C[e>>2],n+=C[e<<4&63],n+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],n+=C[e>>10],n+=C[e>>4&63],n+=C[e<<2&63],n+="="),o.push(n),o.join("")}function $(t,e,r,i,n){var o,a,s=8*n-i-1,h=(1<<s)-1,u=h>>1,l=-7,c=r?n-1:0,d=r?-1:1,f=t[e+c];for(c+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+c],c+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=i;l>0;a=256*a+t[e+c],c+=d,l-=8);if(0===o)o=1-u;else{if(o===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=u}return(f?-1:1)*a*Math.pow(2,o-i)}function L(t,e,r,i,n,o){var a,s,h,u=8*o-n-1,l=(1<<u)-1,c=l>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,m=i?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*h-1)*Math.pow(2,n),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;t[r+f]=255&s,f+=m,s/=256,n-=8);for(a=a<<n|s,u+=n;u>0;t[r+f]=255&a,f+=m,a/=256,u-=8);t[r+f-m]|=128*p}var U={}.toString,F=Array.isArray||function(t){return"[object Array]"==U.call(t)};G.TYPED_ARRAY_SUPPORT=void 0===t.TYPED_ARRAY_SUPPORT||t.TYPED_ARRAY_SUPPORT;var q=V();function V(){return G.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function H(t,e){if(V()<e)throw new RangeError("Invalid typed array length");return G.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=G.prototype:(null===t&&(t=new G(e)),t.length=e),t}function G(t,e,r){if(!(G.TYPED_ARRAY_SUPPORT||this instanceof G))return new G(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return J(this,t)}return Z(this,t,e,r)}function Z(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i);G.TYPED_ARRAY_SUPPORT?(t=e).__proto__=G.prototype:t=W(t,e);return t}(t,e,r,i):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!G.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|X(e,r),n=(t=H(t,i)).write(e,r);n!==i&&(t=t.slice(0,n));return t}(t,e,r):function(t,e){if(Q(e)){var r=0|Y(e.length);return 0===(t=H(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?H(t,0):W(t,e);if("Buffer"===e.type&&F(e.data))return W(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function K(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function J(t,e){if(K(e),t=H(t,e<0?0:0|Y(e)),!G.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function W(t,e){var r=e.length<0?0:0|Y(e.length);t=H(t,r);for(var i=0;i<r;i+=1)t[i]=255&e[i];return t}function Y(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return 0|t}function Q(t){return!(null==t||!t._isBuffer)}function X(t,e){if(Q(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 i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return jt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return xt(t).length;default:if(i)return jt(t).length;e=(""+e).toLowerCase(),i=!0}}function tt(t,e,r){var i=!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 pt(this,e,r);case"utf8":case"utf-8":return ct(this,e,r);case"ascii":return ft(this,e,r);case"latin1":case"binary":return mt(this,e,r);case"base64":return lt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gt(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function et(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function rt(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=G.from(e,i)),Q(e))return 0===e.length?-1:it(t,e,r,i,n);if("number"==typeof e)return e&=255,G.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):it(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function it(t,e,r,i,n){var o,a=1,s=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,h/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var l=-1;for(o=r;o<s;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===h)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+h>s&&(r=s-h),o=r;o>=0;o--){for(var c=!0,d=0;d<h;d++)if(u(t,o+d)!==u(e,d)){c=!1;break}if(c)return o}return-1}function nt(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;a<i;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function ot(t,e,r,i){return St(jt(e,t.length-r),t,r,i)}function at(t,e,r,i){return St(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function st(t,e,r,i){return at(t,e,r,i)}function ht(t,e,r,i){return St(xt(e),t,r,i)}function ut(t,e,r,i){return St(function(t,e){for(var r,i,n,o=[],a=0;a<t.length&&!((e-=2)<0);++a)i=(r=t.charCodeAt(a))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function lt(t,e,r){return 0===e&&r===t.length?D(t):D(t.slice(e,r))}function ct(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,a,s,h,u=t[n],l=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[n+1]))&&(h=(31&u)<<6|63&o)>127&&(l=h);break;case 3:o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(h=(15&u)<<12|(63&o)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(h=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(t){var e=t.length;if(e<=dt)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=dt));return r}(i)}G.poolSize=8192,G._augment=function(t){return t.__proto__=G.prototype,t},G.from=function(t,e,r){return Z(null,t,e,r)},G.TYPED_ARRAY_SUPPORT&&(G.prototype.__proto__=Uint8Array.prototype,G.__proto__=Uint8Array),G.alloc=function(t,e,r){return function(t,e,r,i){return K(e),e<=0?H(t,e):void 0!==r?"string"==typeof i?H(t,e).fill(r,i):H(t,e).fill(r):H(t,e)}(null,t,e,r)},G.allocUnsafe=function(t){return J(null,t)},G.allocUnsafeSlow=function(t){return J(null,t)},G.isBuffer=Nt,G.compare=function(t,e){if(!Q(t)||!Q(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},G.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},G.concat=function(t,e){if(!F(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return G.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=G.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(!Q(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},G.byteLength=X,G.prototype._isBuffer=!0,G.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)et(this,e,e+1);return this},G.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)et(this,e,e+3),et(this,e+1,e+2);return this},G.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)et(this,e,e+7),et(this,e+1,e+6),et(this,e+2,e+5),et(this,e+3,e+4);return this},G.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?ct(this,0,t):tt.apply(this,arguments)},G.prototype.equals=function(t){if(!Q(t))throw new TypeError("Argument must be a Buffer");return this===t||0===G.compare(this,t)},G.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},G.prototype.compare=function(t,e,r,i,n){if(!Q(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===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),h=this.slice(i,n),u=t.slice(e,r),l=0;l<s;++l)if(h[l]!==u[l]){o=h[l],a=u[l];break}return o<a?-1:a<o?1:0},G.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},G.prototype.indexOf=function(t,e,r){return rt(this,t,e,r,!0)},G.prototype.lastIndexOf=function(t,e,r){return rt(this,t,e,r,!1)},G.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return nt(this,t,e,r);case"utf8":case"utf-8":return ot(this,t,e,r);case"ascii":return at(this,t,e,r);case"latin1":case"binary":return st(this,t,e,r);case"base64":return ht(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},G.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var dt=4096;function ft(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function mt(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function pt(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=At(t[o]);return n}function gt(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function yt(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function wt(t,e,r,i,n,o){if(!Q(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function vt(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n<o;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function bt(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n<o;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function kt(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Mt(t,e,r,i,n){return n||kt(t,0,r,4),L(t,e,r,i,23,4),r+4}function _t(t,e,r,i,n){return n||kt(t,0,r,8),L(t,e,r,i,52,8),r+8}G.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),G.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=G.prototype;else{var n=e-t;r=new G(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+t]}return r},G.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},G.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},G.prototype.readUInt8=function(t,e){return e||yt(t,1,this.length),this[t]},G.prototype.readUInt16LE=function(t,e){return e||yt(t,2,this.length),this[t]|this[t+1]<<8},G.prototype.readUInt16BE=function(t,e){return e||yt(t,2,this.length),this[t]<<8|this[t+1]},G.prototype.readUInt32LE=function(t,e){return e||yt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},G.prototype.readUInt32BE=function(t,e){return e||yt(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},G.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},G.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},G.prototype.readInt8=function(t,e){return e||yt(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},G.prototype.readInt16LE=function(t,e){e||yt(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},G.prototype.readInt16BE=function(t,e){e||yt(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},G.prototype.readInt32LE=function(t,e){return e||yt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},G.prototype.readInt32BE=function(t,e){return e||yt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},G.prototype.readFloatLE=function(t,e){return e||yt(t,4,this.length),$(this,t,!0,23,4)},G.prototype.readFloatBE=function(t,e){return e||yt(t,4,this.length),$(this,t,!1,23,4)},G.prototype.readDoubleLE=function(t,e){return e||yt(t,8,this.length),$(this,t,!0,52,8)},G.prototype.readDoubleBE=function(t,e){return e||yt(t,8,this.length),$(this,t,!1,52,8)},G.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||wt(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},G.prototype.writeUIntBE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||wt(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},G.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,1,255,0),G.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},G.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,65535,0),G.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):vt(this,t,e,!0),e+2},G.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,65535,0),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):vt(this,t,e,!1),e+2},G.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,4294967295,0),G.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):bt(this,t,e,!0),e+4},G.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,4294967295,0),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):bt(this,t,e,!1),e+4},G.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);wt(this,t,e,r,n-1,-n)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},G.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);wt(this,t,e,r,n-1,-n)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},G.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,1,127,-128),G.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},G.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,32767,-32768),G.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):vt(this,t,e,!0),e+2},G.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,32767,-32768),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):vt(this,t,e,!1),e+2},G.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,2147483647,-2147483648),G.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):bt(this,t,e,!0),e+4},G.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):bt(this,t,e,!1),e+4},G.prototype.writeFloatLE=function(t,e,r){return Mt(this,t,e,!0,r)},G.prototype.writeFloatBE=function(t,e,r){return Mt(this,t,e,!1,r)},G.prototype.writeDoubleLE=function(t,e,r){return _t(this,t,e,!0,r)},G.prototype.writeDoubleBE=function(t,e,r){return _t(this,t,e,!1,r)},G.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n,o=i-r;if(this===t&&r<e&&e<i)for(n=o-1;n>=0;--n)t[n+e]=this[n+r];else if(o<1e3||!G.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},G.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!G.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=Q(t)?t:jt(new G(t,i).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var Et=/[^+\/0-9A-Za-z-_]/g;function At(t){return t<16?"0"+t.toString(16):t.toString(16)}function jt(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],a=0;a<i;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function xt(t){return function(t){var e,r,i,n,o,a;R||P();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new O(3*s/4-o),i=o>0?s-4:s;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)n=z[t.charCodeAt(e)]<<18|z[t.charCodeAt(e+1)]<<12|z[t.charCodeAt(e+2)]<<6|z[t.charCodeAt(e+3)],a[h++]=n>>16&255,a[h++]=n>>8&255,a[h++]=255&n;return 2===o?(n=z[t.charCodeAt(e)]<<2|z[t.charCodeAt(e+1)]>>4,a[h++]=255&n):1===o&&(n=z[t.charCodeAt(e)]<<10|z[t.charCodeAt(e+1)]<<4|z[t.charCodeAt(e+2)]>>2,a[h++]=n>>8&255,a[h++]=255&n),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Et,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function St(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Nt(t){return null!=t&&(!!t._isBuffer||It(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&It(t.slice(0,0))}(t))}function It(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Tt=o(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:q,Buffer:G,SlowBuffer:function(t){return+t!=t&&(t=0),G.alloc(+t)},isBuffer:Nt})),Ct=a((function(t){!function(t,e){function r(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 n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Tt.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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 n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-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"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+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()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){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"],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],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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191<,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));let zt=!1,Ot=!1;const Rt={debug:1,default:2,info:2,warning:3,error:4,off:5};let Pt=Rt.default,Bt=null;const Dt=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var $t,Lt;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}($t||($t={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(Lt||(Lt={}));const Ut="0123456789abcdef";class Ft{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Rt[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Pt>Rt[r]||console.log.apply(console,e)}debug(...t){this._log(Ft.levels.DEBUG,t)}info(...t){this._log(Ft.levels.INFO,t)}warn(...t){this._log(Ft.levels.WARNING,t)}makeError(t,e,r){if(Ot)return this.makeError("censored error",e,{});e||(e=Ft.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=Ut[e[t]>>4],r+=Ut[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case Lt.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Lt.CALL_EXCEPTION:case Lt.INSUFFICIENT_FUNDS:case Lt.MISSING_NEW:case Lt.NONCE_EXPIRED:case Lt.REPLACEMENT_UNDERPRICED:case Lt.TRANSACTION_REPLACED:case Lt.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=n,a.code=e,Object.keys(r).forEach((function(t){a[t]=r[t]})),a}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ft.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){Dt&&this.throwError("platform missing String.prototype.normalize",Ft.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Dt})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ft.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ft.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,Ft.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,Ft.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ft.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ft.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ft.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Bt||(Bt=new Ft("logger/5.6.0")),Bt}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ft.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),zt){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ft.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ot=!!t,zt=!!e}static setLogLevel(t){const e=Rt[t.toLowerCase()];null!=e?Pt=e:Ft.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ft(t)}}Ft.errors=Lt,Ft.levels=$t;const qt=new Ft("bytes/5.6.1");function Vt(t){return!!t.toHexString}function Ht(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ht(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Gt(t){return Qt(t)&&!(t.length%2)||Kt(t)}function Zt(t){return"number"==typeof t&&t==t&&t%1==0}function Kt(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Zt(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Zt(r)||r<0||r>=256)return!1}return!0}function Jt(t,e){if(e||(e={}),"number"==typeof t){qt.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ht(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Vt(t)&&(t=t.toHexString()),Qt(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":qt.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return Ht(new Uint8Array(i))}return Kt(t)?Ht(new Uint8Array(t)):qt.throwArgumentError("invalid arrayify value","value",t)}function Wt(t){const e=t.map((t=>Jt(t))),r=e.reduce(((t,e)=>t+e.length),0),i=new Uint8Array(r);return e.reduce(((t,e)=>(i.set(e,t),t+e.length)),0),Ht(i)}function Yt(t){let e=Jt(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function Qt(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Xt="0123456789abcdef";function te(t,e){if(e||(e={}),"number"==typeof t){qt.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Xt[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Vt(t))return t.toHexString();if(Qt(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":qt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Kt(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=Xt[(240&i)>>4]+Xt[15&i]}return e}return qt.throwArgumentError("invalid hexlify value","value",t)}function ee(t){if("string"!=typeof t)t=te(t);else if(!Qt(t)||t.length%2)return null;return(t.length-2)/2}function re(t,e,r){return"string"!=typeof t?t=te(t):(!Qt(t)||t.length%2)&&qt.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function ie(t){let e="0x";return t.forEach((t=>{e+=te(t).substring(2)})),e}function ne(t){const e=function(t){"string"!=typeof t&&(t=te(t));Qt(t)||qt.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}(te(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function oe(t,e){for("string"!=typeof t?t=te(t):Qt(t)||qt.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&qt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function ae(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Gt(t)){let r=Jt(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64))):65===r.length?(e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64)),e.v=r[64]):qt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:qt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=te(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=Jt(t)).length>e&&qt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ht(r)}(Jt(e._vs),32);e._vs=te(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&qt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=te(r);null==e.s?e.s=n:e.s!==n&&qt.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?qt.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&qt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Qt(e.r)?e.r=oe(e.r,32):qt.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Qt(e.s)?e.s=oe(e.s,32):qt.throwArgumentError("signature missing or invalid s","signature",t);const r=Jt(e.s);r[0]>=128&&qt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=te(r);e._vs&&(Qt(e._vs)||qt.throwArgumentError("signature invalid _vs","signature",t),e._vs=oe(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&qt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var se=Ct.BN;const he=new Ft("bignumber/5.6.2"),ue={},le=9007199254740991;let ce=!1;class de{constructor(t,e){t!==ue&&he.throwError("cannot call constructor directly; use BigNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return me(pe(this).fromTwos(t))}toTwos(t){return me(pe(this).toTwos(t))}abs(){return"-"===this._hex[0]?de.from(this._hex.substring(1)):this}add(t){return me(pe(this).add(pe(t)))}sub(t){return me(pe(this).sub(pe(t)))}div(t){return de.from(t).isZero()&&ge("division-by-zero","div"),me(pe(this).div(pe(t)))}mul(t){return me(pe(this).mul(pe(t)))}mod(t){const e=pe(t);return e.isNeg()&&ge("division-by-zero","mod"),me(pe(this).umod(e))}pow(t){const e=pe(t);return e.isNeg()&&ge("negative-power","pow"),me(pe(this).pow(e))}and(t){const e=pe(t);return(this.isNegative()||e.isNeg())&&ge("unbound-bitwise-result","and"),me(pe(this).and(e))}or(t){const e=pe(t);return(this.isNegative()||e.isNeg())&&ge("unbound-bitwise-result","or"),me(pe(this).or(e))}xor(t){const e=pe(t);return(this.isNegative()||e.isNeg())&&ge("unbound-bitwise-result","xor"),me(pe(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&ge("negative-width","mask"),me(pe(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&ge("negative-width","shl"),me(pe(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&ge("negative-width","shr"),me(pe(this).shrn(t))}eq(t){return pe(this).eq(pe(t))}lt(t){return pe(this).lt(pe(t))}lte(t){return pe(this).lte(pe(t))}gt(t){return pe(this).gt(pe(t))}gte(t){return pe(this).gte(pe(t))}isNegative(){return"-"===this._hex[0]}isZero(){return pe(this).isZero()}toNumber(){try{return pe(this).toNumber()}catch(t){ge("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return he.throwError("this platform does not support BigInt",Ft.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ce||(ce=!0,he.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?he.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ft.errors.UNEXPECTED_ARGUMENT,{}):he.throwError("BigNumber.toString does not accept parameters",Ft.errors.UNEXPECTED_ARGUMENT,{})),pe(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof de)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new de(ue,fe(t)):t.match(/^-?[0-9]+$/)?new de(ue,fe(new se(t))):he.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&ge("underflow","BigNumber.from",t),(t>=le||t<=-le)&&ge("overflow","BigNumber.from",t),de.from(String(t));const e=t;if("bigint"==typeof e)return de.from(e.toString());if(Kt(e))return de.from(te(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return de.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Qt(t)||"-"===t[0]&&Qt(t.substring(1))))return de.from(t)}return he.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function fe(t){if("string"!=typeof t)return fe(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&he.throwArgumentError("invalid hex","value",t),"0x00"===(t=fe(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function me(t){return de.from(fe(t))}function pe(t){const e=de.from(t).toHexString();return"-"===e[0]?new se("-"+e.substring(3),16):new se(e.substring(2),16)}function ge(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),he.throwError(t,Ft.errors.NUMERIC_FAULT,i)}var ye=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const we=new Ft("properties/5.6.0");function ve(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function be(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function ke(t){return ye(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function Me(t){const e={};for(const r in t)e[r]=t[r];return e}const _e={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ee(t){if(null==t||_e[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch(t){continue}if(!Ee(i))return!1}return!0}return we.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ae(t){if(Ee(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>je(t))));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&ve(e,r,je(i))}return e}return we.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function je(t){return Ae(t)}class xe{constructor(t){for(const e in t)this[e]=je(t[e])}}const Se="abi/5.6.4",Ne=new Ft(Se),Ie={};let Te={calldata:!0,memory:!0,storage:!0},Ce={calldata:!0,memory:!0};function ze(t,e){if("bytes"===t||"string"===t){if(Te[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Ce[e])return!0;return(Te[e]||"payable"===e)&&Ne.throwArgumentError("invalid modifier","name",e),!1}function Oe(t,e){for(let r in e)ve(t,r,e[r])}const Re=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Pe=new RegExp(/^(.*)\[([0-9]*)\]$/);class Be{constructor(t,e){t!==Ie&&Ne.throwError("use fromString",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Oe(this,e);let r=this.type.match(Pe);Oe(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Be.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==Re.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===Re.full?", ":",")+")"):e+=this.type,t!==Re.sighash&&(!0===this.indexed&&(e+=" indexed"),t===Re.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Be.fromString(t,e):Be.fromObject(t)}static fromObject(t){return Be.isParamType(t)?t:new Be(Ie,{name:t.name||null,type:Ke(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Be.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function i(e){Ne.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function n(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||i(r),a.state.allowType=!1,a.type=Ke(a.type),a.components=[n(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(e||i(r),a.indexed=!0,a.name=""),ze(a.type,a.name)&&(a.name=""),a.type=Ke(a.type);let t=a;a=a.parent,a||i(r),delete t.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(e||i(r),a.indexed=!0,a.name=""),ze(a.type,a.name)&&(a.name=""),a.type=Ke(a.type);let s=n(a.parent);a.parent.components.push(s),delete a.parent,a=s;break;case" ":a.state.allowType&&""!==a.type&&(a.type=Ke(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(e||i(r),a.indexed&&i(r),a.indexed=!0,a.name=""):ze(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||i(r),a.type+=o,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||i(r),a.type+=o,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=o,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=o,delete a.state.allowArray):a.state.readArray?a.type+=o:i(r)}}return a.parent&&Ne.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===a.name?(e||i(r.length-7),a.indexed&&i(r.length-7),a.indexed=!0,a.name=""):ze(a.type,a.name)&&(a.name=""),o.type=Ke(o.type),o}(t,!!e),Be.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function De(t,e){return function(t){t=t.trim();let e=[],r="",i=0;for(let n=0;n<t.length;n++){let o=t[n];","===o&&0===i?(e.push(r),r=""):(r+=o,"("===o?i++:")"===o&&(i--,-1===i&&Ne.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>Be.fromString(t,e)))}class $e{constructor(t,e){t!==Ie&&Ne.throwError("use a static from method",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Oe(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return $e.isFragment(t)?t:"string"==typeof t?$e.fromString(t):$e.fromObject(t)}static fromObject(t){if($e.isFragment(t))return t;switch(t.type){case"function":return He.fromObject(t);case"event":return Le.fromObject(t);case"constructor":return Ve.fromObject(t);case"error":return Ze.fromObject(t);case"fallback":case"receive":return null}return Ne.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Le.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?He.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Ve.fromString(t.trim()):"error"===t.split(" ")[0]?Ze.fromString(t.substring(5).trim()):Ne.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Le extends $e{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Re.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ",t!==Re.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Le.fromString(t):Le.fromObject(t)}static fromObject(t){if(Le.isEventFragment(t))return t;"event"!==t.type&&Ne.throwArgumentError("invalid event object","value",t);const e={name:We(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Be.fromObject):[],type:"event"};return new Le(Ie,e)}static fromString(t){let e=t.match(Ye);e||Ne.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:Ne.warn("unknown modifier: "+t)}})),Le.fromObject({name:e[1].trim(),anonymous:r,inputs:De(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Ue(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&Ne.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ne.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=de.from(r[1]),r[0]):t}function Fe(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function qe(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&Ne.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&Ne.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||Ne.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ne.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&Ne.throwArgumentError("unable to determine stateMutability","value",t),e}class Ve extends $e{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===Re.sighash&&Ne.throwError("cannot format a constructor for sighash",Ft.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Ve.fromString(t):Ve.fromObject(t)}static fromObject(t){if(Ve.isConstructorFragment(t))return t;"constructor"!==t.type&&Ne.throwArgumentError("invalid constructor object","value",t);let e=qe(t);e.constant&&Ne.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Be.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?de.from(t.gas):null};return new Ve(Ie,r)}static fromString(t){let e={type:"constructor"},r=(t=Ue(t,e)).match(Ye);return r&&"constructor"===r[1].trim()||Ne.throwArgumentError("invalid constructor string","value",t),e.inputs=De(r[2].trim(),!1),Fe(r[3].trim(),e),Ve.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class He extends Ve{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Re.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ",t!==Re.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?He.fromString(t):He.fromObject(t)}static fromObject(t){if(He.isFunctionFragment(t))return t;"function"!==t.type&&Ne.throwArgumentError("invalid function object","value",t);let e=qe(t);const r={type:t.type,name:We(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Be.fromObject):[],outputs:t.outputs?t.outputs.map(Be.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?de.from(t.gas):null};return new He(Ie,r)}static fromString(t){let e={type:"function"},r=(t=Ue(t,e)).split(" returns ");r.length>2&&Ne.throwArgumentError("invalid function string","value",t);let i=r[0].match(Ye);if(i||Ne.throwArgumentError("invalid function signature","value",t),e.name=i[1].trim(),e.name&&We(e.name),e.inputs=De(i[2],!1),Fe(i[3].trim(),e),r.length>1){let i=r[1].match(Ye);""==i[1].trim()&&""==i[3].trim()||Ne.throwArgumentError("unexpected tokens","value",t),e.outputs=De(i[2],!1)}else e.outputs=[];return He.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Ge(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||Ne.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Ze extends $e{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Re.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Ze.fromString(t):Ze.fromObject(t)}static fromObject(t){if(Ze.isErrorFragment(t))return t;"error"!==t.type&&Ne.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:We(t.name),inputs:t.inputs?t.inputs.map(Be.fromObject):[]};return Ge(new Ze(Ie,e))}static fromString(t){let e={type:"error"},r=t.match(Ye);return r||Ne.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&We(e.name),e.inputs=De(r[2],!1),Ge(Ze.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Ke(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Je=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function We(t){return t&&t.match(Je)||Ne.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const Ye=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Qe=new Ft(Se);class Xe{constructor(t,e,r,i){this.name=t,this.type=e,this.localName=r,this.dynamic=i}_throwError(t,e){Qe.throwArgumentError(t,this.localName,e)}}class tr{constructor(t){ve(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return ie(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(Wt(t._data))}writeBytes(t){let e=Jt(t);const r=e.length%this.wordSize;return r&&(e=Wt([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=Jt(de.from(t));return e.length>this.wordSize&&Qe.throwError("value out-of-bounds",Ft.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=Wt([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class er{constructor(t,e,r,i){ve(this,"_data",Jt(t)),ve(this,"wordSize",e||32),ve(this,"_coerceFunc",r),ve(this,"allowLoose",i),this._offset=0}get data(){return te(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):er.coerce(t,e)}_peekBytes(t,e,r){let i=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?i=e:Qe.throwError("data out-of-bounds",Ft.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(t){return new er(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return de.from(this.readBytes(this.wordSize))}}var rr=a((function(t){!function(t,e){function r(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 n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Tt.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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 n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-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"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+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()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){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"],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],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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191<,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));var ir=rr.BN;const nr=new Ft("bignumber/5.6.2"),or={},ar=9007199254740991;let sr=!1;class hr{constructor(t,e){t!==or&&nr.throwError("cannot call constructor directly; use BigNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return lr(cr(this).fromTwos(t))}toTwos(t){return lr(cr(this).toTwos(t))}abs(){return"-"===this._hex[0]?hr.from(this._hex.substring(1)):this}add(t){return lr(cr(this).add(cr(t)))}sub(t){return lr(cr(this).sub(cr(t)))}div(t){return hr.from(t).isZero()&&dr("division-by-zero","div"),lr(cr(this).div(cr(t)))}mul(t){return lr(cr(this).mul(cr(t)))}mod(t){const e=cr(t);return e.isNeg()&&dr("division-by-zero","mod"),lr(cr(this).umod(e))}pow(t){const e=cr(t);return e.isNeg()&&dr("negative-power","pow"),lr(cr(this).pow(e))}and(t){const e=cr(t);return(this.isNegative()||e.isNeg())&&dr("unbound-bitwise-result","and"),lr(cr(this).and(e))}or(t){const e=cr(t);return(this.isNegative()||e.isNeg())&&dr("unbound-bitwise-result","or"),lr(cr(this).or(e))}xor(t){const e=cr(t);return(this.isNegative()||e.isNeg())&&dr("unbound-bitwise-result","xor"),lr(cr(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&dr("negative-width","mask"),lr(cr(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&dr("negative-width","shl"),lr(cr(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&dr("negative-width","shr"),lr(cr(this).shrn(t))}eq(t){return cr(this).eq(cr(t))}lt(t){return cr(this).lt(cr(t))}lte(t){return cr(this).lte(cr(t))}gt(t){return cr(this).gt(cr(t))}gte(t){return cr(this).gte(cr(t))}isNegative(){return"-"===this._hex[0]}isZero(){return cr(this).isZero()}toNumber(){try{return cr(this).toNumber()}catch(t){dr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return nr.throwError("this platform does not support BigInt",Ft.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?sr||(sr=!0,nr.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?nr.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ft.errors.UNEXPECTED_ARGUMENT,{}):nr.throwError("BigNumber.toString does not accept parameters",Ft.errors.UNEXPECTED_ARGUMENT,{})),cr(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof hr)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new hr(or,ur(t)):t.match(/^-?[0-9]+$/)?new hr(or,ur(new ir(t))):nr.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&dr("underflow","BigNumber.from",t),(t>=ar||t<=-ar)&&dr("overflow","BigNumber.from",t),hr.from(String(t));const e=t;if("bigint"==typeof e)return hr.from(e.toString());if(Kt(e))return hr.from(te(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return hr.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Qt(t)||"-"===t[0]&&Qt(t.substring(1))))return hr.from(t)}return nr.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function ur(t){if("string"!=typeof t)return ur(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&nr.throwArgumentError("invalid hex","value",t),"0x00"===(t=ur(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function lr(t){return hr.from(ur(t))}function cr(t){const e=hr.from(t).toHexString();return"-"===e[0]?new ir("-"+e.substring(3),16):new ir(e.substring(2),16)}function dr(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),nr.throwError(t,Ft.errors.NUMERIC_FAULT,i)}
|
|
15
|
+
***************************************************************************** */;function e(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function r(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function o(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})})),e}function a(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=a((function(t,e){var r="undefined"!=typeof self?self:i,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function m(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function p(t){var e=new FileReader,r=m(e);return e.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&n&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,r,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=m(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=u(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[u(t)]},d.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},d.prototype.set=function(t,e){this.map[u(t)]=l(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},i&&(d.prototype[Symbol.iterator]=d.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var r,i,n=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),w.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function k(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},y.call(v.prototype),y.call(k.prototype),k.prototype.clone=function(){return new k(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},k.error=function(){var t=new k(null,{status:0,statusText:""});return t.type="error",t};var M=[301,302,303,307,308];k.redirect=function(t,e){if(-1===M.indexOf(e))throw new RangeError("Invalid status code");return new k(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(t,r){return new Promise((function(i,o){var a=new v(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function h(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;i(new k(n,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&n&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",h),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",h)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=d,t.Request=v,t.Response=k),e.Headers=d,e.Request=v,e.Response=k,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e})),h=n(s);const u={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},l={Proposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"privacy",type:"string"},{name:"app",type:"string"}]},c={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"type",type:"string"},{name:"title",type:"string"},{name:"body",type:"string"},{name:"discussion",type:"string"},{name:"choices",type:"string[]"},{name:"labels",type:"string[]"},{name:"plugins",type:"string"},{name:"privacy",type:"string"}]},d={FlagProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},f={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},m={CancelProposal:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},p={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},g={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},y={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},w={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},v={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"uint32[]"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},b={Vote:[{name:"from",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"},{name:"choice",type:"string"},{name:"reason",type:"string"},{name:"app",type:"string"},{name:"metadata",type:"string"}]},k={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},M={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},_={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},E={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},A={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},j={Statement:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"space",type:"string"},{name:"about",type:"string"},{name:"statement",type:"string"},{name:"discourse",type:"string"},{name:"status",type:"string"},{name:"network",type:"string"}]},x={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},S={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var N={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},I={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},T={hub:"http://localhost:3000",sequencer:"http://localhost:3001"},C=[],z=[],O="undefined"!=typeof Uint8Array?Uint8Array:Array,R=!1;function P(){R=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)C[e]=t[e],z[t.charCodeAt(e)]=e;z["-".charCodeAt(0)]=62,z["_".charCodeAt(0)]=63}function B(t,e,r){for(var i,n,o=[],a=e;a<r;a+=3)i=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(C[(n=i)>>18&63]+C[n>>12&63]+C[n>>6&63]+C[63&n]);return o.join("")}function D(t){var e;R||P();for(var r=t.length,i=r%3,n="",o=[],a=16383,s=0,h=r-i;s<h;s+=a)o.push(B(t,s,s+a>h?h:s+a));return 1===i?(e=t[r-1],n+=C[e>>2],n+=C[e<<4&63],n+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],n+=C[e>>10],n+=C[e>>4&63],n+=C[e<<2&63],n+="="),o.push(n),o.join("")}function $(t,e,r,i,n){var o,a,s=8*n-i-1,h=(1<<s)-1,u=h>>1,l=-7,c=r?n-1:0,d=r?-1:1,f=t[e+c];for(c+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+c],c+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=i;l>0;a=256*a+t[e+c],c+=d,l-=8);if(0===o)o=1-u;else{if(o===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=u}return(f?-1:1)*a*Math.pow(2,o-i)}function L(t,e,r,i,n,o){var a,s,h,u=8*o-n-1,l=(1<<u)-1,c=l>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,m=i?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*h-1)*Math.pow(2,n),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,n),a=0));n>=8;t[r+f]=255&s,f+=m,s/=256,n-=8);for(a=a<<n|s,u+=n;u>0;t[r+f]=255&a,f+=m,a/=256,u-=8);t[r+f-m]|=128*p}var U={}.toString,F=Array.isArray||function(t){return"[object Array]"==U.call(t)};G.TYPED_ARRAY_SUPPORT=void 0===t.TYPED_ARRAY_SUPPORT||t.TYPED_ARRAY_SUPPORT;var q=V();function V(){return G.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function H(t,e){if(V()<e)throw new RangeError("Invalid typed array length");return G.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=G.prototype:(null===t&&(t=new G(e)),t.length=e),t}function G(t,e,r){if(!(G.TYPED_ARRAY_SUPPORT||this instanceof G))return new G(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return J(this,t)}return Z(this,t,e,r)}function Z(t,e,r,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i);G.TYPED_ARRAY_SUPPORT?(t=e).__proto__=G.prototype:t=W(t,e);return t}(t,e,r,i):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!G.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|X(e,r),n=(t=H(t,i)).write(e,r);n!==i&&(t=t.slice(0,n));return t}(t,e,r):function(t,e){if(Q(e)){var r=0|Y(e.length);return 0===(t=H(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?H(t,0):W(t,e);if("Buffer"===e.type&&F(e.data))return W(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function K(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function J(t,e){if(K(e),t=H(t,e<0?0:0|Y(e)),!G.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function W(t,e){var r=e.length<0?0:0|Y(e.length);t=H(t,r);for(var i=0;i<r;i+=1)t[i]=255&e[i];return t}function Y(t){if(t>=V())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V().toString(16)+" bytes");return 0|t}function Q(t){return!(null==t||!t._isBuffer)}function X(t,e){if(Q(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 i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return jt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return xt(t).length;default:if(i)return jt(t).length;e=(""+e).toLowerCase(),i=!0}}function tt(t,e,r){var i=!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 pt(this,e,r);case"utf8":case"utf-8":return ct(this,e,r);case"ascii":return ft(this,e,r);case"latin1":case"binary":return mt(this,e,r);case"base64":return lt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gt(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function et(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function rt(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=G.from(e,i)),Q(e))return 0===e.length?-1:it(t,e,r,i,n);if("number"==typeof e)return e&=255,G.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):it(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function it(t,e,r,i,n){var o,a=1,s=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,h/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(n){var l=-1;for(o=r;o<s;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===h)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+h>s&&(r=s-h),o=r;o>=0;o--){for(var c=!0,d=0;d<h;d++)if(u(t,o+d)!==u(e,d)){c=!1;break}if(c)return o}return-1}function nt(t,e,r,i){r=Number(r)||0;var n=t.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;a<i;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function ot(t,e,r,i){return St(jt(e,t.length-r),t,r,i)}function at(t,e,r,i){return St(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,i)}function st(t,e,r,i){return at(t,e,r,i)}function ht(t,e,r,i){return St(xt(e),t,r,i)}function ut(t,e,r,i){return St(function(t,e){for(var r,i,n,o=[],a=0;a<t.length&&!((e-=2)<0);++a)i=(r=t.charCodeAt(a))>>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function lt(t,e,r){return 0===e&&r===t.length?D(t):D(t.slice(e,r))}function ct(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n<r;){var o,a,s,h,u=t[n],l=null,c=u>239?4:u>223?3:u>191?2:1;if(n+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[n+1]))&&(h=(31&u)<<6|63&o)>127&&(l=h);break;case 3:o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(h=(15&u)<<12|(63&o)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(h=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=c}return function(t){var e=t.length;if(e<=dt)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=dt));return r}(i)}G.poolSize=8192,G._augment=function(t){return t.__proto__=G.prototype,t},G.from=function(t,e,r){return Z(null,t,e,r)},G.TYPED_ARRAY_SUPPORT&&(G.prototype.__proto__=Uint8Array.prototype,G.__proto__=Uint8Array),G.alloc=function(t,e,r){return function(t,e,r,i){return K(e),e<=0?H(t,e):void 0!==r?"string"==typeof i?H(t,e).fill(r,i):H(t,e).fill(r):H(t,e)}(null,t,e,r)},G.allocUnsafe=function(t){return J(null,t)},G.allocUnsafeSlow=function(t){return J(null,t)},G.isBuffer=Nt,G.compare=function(t,e){if(!Q(t)||!Q(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0},G.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},G.concat=function(t,e){if(!F(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return G.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=G.allocUnsafe(e),n=0;for(r=0;r<t.length;++r){var o=t[r];if(!Q(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},G.byteLength=X,G.prototype._isBuffer=!0,G.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)et(this,e,e+1);return this},G.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)et(this,e,e+3),et(this,e+1,e+2);return this},G.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)et(this,e,e+7),et(this,e+1,e+6),et(this,e+2,e+5),et(this,e+3,e+4);return this},G.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?ct(this,0,t):tt.apply(this,arguments)},G.prototype.equals=function(t){if(!Q(t))throw new TypeError("Argument must be a Buffer");return this===t||0===G.compare(this,t)},G.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},G.prototype.compare=function(t,e,r,i,n){if(!Q(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===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),h=this.slice(i,n),u=t.slice(e,r),l=0;l<s;++l)if(h[l]!==u[l]){o=h[l],a=u[l];break}return o<a?-1:a<o?1:0},G.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},G.prototype.indexOf=function(t,e,r){return rt(this,t,e,r,!0)},G.prototype.lastIndexOf=function(t,e,r){return rt(this,t,e,r,!1)},G.prototype.write=function(t,e,r,i){if(void 0===e)i="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)i=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return nt(this,t,e,r);case"utf8":case"utf-8":return ot(this,t,e,r);case"ascii":return at(this,t,e,r);case"latin1":case"binary":return st(this,t,e,r);case"base64":return ht(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},G.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var dt=4096;function ft(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(127&t[n]);return i}function mt(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function pt(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=e;o<r;++o)n+=At(t[o]);return n}function gt(t,e,r){for(var i=t.slice(e,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function yt(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function wt(t,e,r,i,n,o){if(!Q(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function vt(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n<o;++n)t[r+n]=(e&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function bt(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n<o;++n)t[r+n]=e>>>8*(i?n:3-n)&255}function kt(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Mt(t,e,r,i,n){return n||kt(t,0,r,4),L(t,e,r,i,23,4),r+4}function _t(t,e,r,i,n){return n||kt(t,0,r,8),L(t,e,r,i,52,8),r+8}G.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),G.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=G.prototype;else{var n=e-t;r=new G(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+t]}return r},G.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i},G.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},G.prototype.readUInt8=function(t,e){return e||yt(t,1,this.length),this[t]},G.prototype.readUInt16LE=function(t,e){return e||yt(t,2,this.length),this[t]|this[t+1]<<8},G.prototype.readUInt16BE=function(t,e){return e||yt(t,2,this.length),this[t]<<8|this[t+1]},G.prototype.readUInt32LE=function(t,e){return e||yt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},G.prototype.readUInt32BE=function(t,e){return e||yt(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},G.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=this[t],n=1,o=0;++o<e&&(n*=256);)i+=this[t+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*e)),i},G.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||yt(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},G.prototype.readInt8=function(t,e){return e||yt(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},G.prototype.readInt16LE=function(t,e){e||yt(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},G.prototype.readInt16BE=function(t,e){e||yt(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},G.prototype.readInt32LE=function(t,e){return e||yt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},G.prototype.readInt32BE=function(t,e){return e||yt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},G.prototype.readFloatLE=function(t,e){return e||yt(t,4,this.length),$(this,t,!0,23,4)},G.prototype.readFloatBE=function(t,e){return e||yt(t,4,this.length),$(this,t,!1,23,4)},G.prototype.readDoubleLE=function(t,e){return e||yt(t,8,this.length),$(this,t,!0,52,8)},G.prototype.readDoubleBE=function(t,e){return e||yt(t,8,this.length),$(this,t,!1,52,8)},G.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||wt(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o<r&&(n*=256);)this[e+o]=t/n&255;return e+r},G.prototype.writeUIntBE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||wt(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},G.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,1,255,0),G.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},G.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,65535,0),G.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):vt(this,t,e,!0),e+2},G.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,65535,0),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):vt(this,t,e,!1),e+2},G.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,4294967295,0),G.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):bt(this,t,e,!0),e+4},G.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,4294967295,0),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):bt(this,t,e,!1),e+4},G.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);wt(this,t,e,r,n-1,-n)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},G.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);wt(this,t,e,r,n-1,-n)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},G.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,1,127,-128),G.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},G.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,32767,-32768),G.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):vt(this,t,e,!0),e+2},G.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,2,32767,-32768),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):vt(this,t,e,!1),e+2},G.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,2147483647,-2147483648),G.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):bt(this,t,e,!0),e+4},G.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||wt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),G.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):bt(this,t,e,!1),e+4},G.prototype.writeFloatLE=function(t,e,r){return Mt(this,t,e,!0,r)},G.prototype.writeFloatBE=function(t,e,r){return Mt(this,t,e,!1,r)},G.prototype.writeDoubleLE=function(t,e,r){return _t(this,t,e,!0,r)},G.prototype.writeDoubleBE=function(t,e,r){return _t(this,t,e,!1,r)},G.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var n,o=i-r;if(this===t&&r<e&&e<i)for(n=o-1;n>=0;--n)t[n+e]=this[n+r];else if(o<1e3||!G.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},G.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!G.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=Q(t)?t:jt(new G(t,i).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var Et=/[^+\/0-9A-Za-z-_]/g;function At(t){return t<16?"0"+t.toString(16):t.toString(16)}function jt(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],a=0;a<i;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function xt(t){return function(t){var e,r,i,n,o,a;R||P();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new O(3*s/4-o),i=o>0?s-4:s;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)n=z[t.charCodeAt(e)]<<18|z[t.charCodeAt(e+1)]<<12|z[t.charCodeAt(e+2)]<<6|z[t.charCodeAt(e+3)],a[h++]=n>>16&255,a[h++]=n>>8&255,a[h++]=255&n;return 2===o?(n=z[t.charCodeAt(e)]<<2|z[t.charCodeAt(e+1)]>>4,a[h++]=255&n):1===o&&(n=z[t.charCodeAt(e)]<<10|z[t.charCodeAt(e+1)]<<4|z[t.charCodeAt(e+2)]>>2,a[h++]=n>>8&255,a[h++]=255&n),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Et,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function St(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Nt(t){return null!=t&&(!!t._isBuffer||It(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&It(t.slice(0,0))}(t))}function It(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Tt=o(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:q,Buffer:G,SlowBuffer:function(t){return+t!=t&&(t=0),G.alloc(+t)},isBuffer:Nt})),Ct=a((function(t){!function(t,e){function r(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 n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Tt.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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 n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-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"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+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()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){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"],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],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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191<,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));let zt=!1,Ot=!1;const Rt={debug:1,default:2,info:2,warning:3,error:4,off:5};let Pt=Rt.default,Bt=null;const Dt=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var $t,Lt;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}($t||($t={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(Lt||(Lt={}));const Ut="0123456789abcdef";class Ft{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==Rt[r]&&this.throwArgumentError("invalid log level name","logLevel",t),Pt>Rt[r]||console.log.apply(console,e)}debug(...t){this._log(Ft.levels.DEBUG,t)}info(...t){this._log(Ft.levels.INFO,t)}warn(...t){this._log(Ft.levels.WARNING,t)}makeError(t,e,r){if(Ot)return this.makeError("censored error",e,{});e||(e=Ft.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=Ut[e[t]>>4],r+=Ut[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let o="";switch(e){case Lt.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Lt.CALL_EXCEPTION:case Lt.INSUFFICIENT_FUNDS:case Lt.MISSING_NEW:case Lt.NONCE_EXPIRED:case Lt.REPLACEMENT_UNDERPRICED:case Lt.TRANSACTION_REPLACED:case Lt.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=n,a.code=e,Object.keys(r).forEach((function(t){a[t]=r[t]})),a}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Ft.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){Dt&&this.throwError("platform missing String.prototype.normalize",Ft.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Dt})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Ft.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Ft.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,Ft.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,Ft.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",Ft.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Ft.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",Ft.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Bt||(Bt=new Ft("logger/5.6.0")),Bt}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Ft.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),zt){if(!t)return;this.globalLogger().throwError("error censorship permanent",Ft.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Ot=!!t,zt=!!e}static setLogLevel(t){const e=Rt[t.toLowerCase()];null!=e?Pt=e:Ft.globalLogger().warn("invalid log level - "+t)}static from(t){return new Ft(t)}}Ft.errors=Lt,Ft.levels=$t;const qt=new Ft("bytes/5.6.1");function Vt(t){return!!t.toHexString}function Ht(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ht(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Gt(t){return Qt(t)&&!(t.length%2)||Kt(t)}function Zt(t){return"number"==typeof t&&t==t&&t%1==0}function Kt(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Zt(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Zt(r)||r<0||r>=256)return!1}return!0}function Jt(t,e){if(e||(e={}),"number"==typeof t){qt.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),Ht(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Vt(t)&&(t=t.toHexString()),Qt(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":qt.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return Ht(new Uint8Array(i))}return Kt(t)?Ht(new Uint8Array(t)):qt.throwArgumentError("invalid arrayify value","value",t)}function Wt(t){const e=t.map((t=>Jt(t))),r=e.reduce(((t,e)=>t+e.length),0),i=new Uint8Array(r);return e.reduce(((t,e)=>(i.set(e,t),t+e.length)),0),Ht(i)}function Yt(t){let e=Jt(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function Qt(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Xt="0123456789abcdef";function te(t,e){if(e||(e={}),"number"==typeof t){qt.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Xt[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Vt(t))return t.toHexString();if(Qt(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":qt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Kt(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=Xt[(240&i)>>4]+Xt[15&i]}return e}return qt.throwArgumentError("invalid hexlify value","value",t)}function ee(t){if("string"!=typeof t)t=te(t);else if(!Qt(t)||t.length%2)return null;return(t.length-2)/2}function re(t,e,r){return"string"!=typeof t?t=te(t):(!Qt(t)||t.length%2)&&qt.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function ie(t){let e="0x";return t.forEach((t=>{e+=te(t).substring(2)})),e}function ne(t){const e=function(t){"string"!=typeof t&&(t=te(t));Qt(t)||qt.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}(te(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function oe(t,e){for("string"!=typeof t?t=te(t):Qt(t)||qt.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&qt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function ae(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Gt(t)){let r=Jt(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64))):65===r.length?(e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64)),e.v=r[64]):qt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:qt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=te(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=Jt(t)).length>e&&qt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ht(r)}(Jt(e._vs),32);e._vs=te(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&qt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=te(r);null==e.s?e.s=n:e.s!==n&&qt.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?qt.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&qt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Qt(e.r)?e.r=oe(e.r,32):qt.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Qt(e.s)?e.s=oe(e.s,32):qt.throwArgumentError("signature missing or invalid s","signature",t);const r=Jt(e.s);r[0]>=128&&qt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=te(r);e._vs&&(Qt(e._vs)||qt.throwArgumentError("signature invalid _vs","signature",t),e._vs=oe(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&qt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var se=Ct.BN;const he=new Ft("bignumber/5.6.2"),ue={},le=9007199254740991;let ce=!1;class de{constructor(t,e){t!==ue&&he.throwError("cannot call constructor directly; use BigNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return me(pe(this).fromTwos(t))}toTwos(t){return me(pe(this).toTwos(t))}abs(){return"-"===this._hex[0]?de.from(this._hex.substring(1)):this}add(t){return me(pe(this).add(pe(t)))}sub(t){return me(pe(this).sub(pe(t)))}div(t){return de.from(t).isZero()&&ge("division-by-zero","div"),me(pe(this).div(pe(t)))}mul(t){return me(pe(this).mul(pe(t)))}mod(t){const e=pe(t);return e.isNeg()&&ge("division-by-zero","mod"),me(pe(this).umod(e))}pow(t){const e=pe(t);return e.isNeg()&&ge("negative-power","pow"),me(pe(this).pow(e))}and(t){const e=pe(t);return(this.isNegative()||e.isNeg())&&ge("unbound-bitwise-result","and"),me(pe(this).and(e))}or(t){const e=pe(t);return(this.isNegative()||e.isNeg())&&ge("unbound-bitwise-result","or"),me(pe(this).or(e))}xor(t){const e=pe(t);return(this.isNegative()||e.isNeg())&&ge("unbound-bitwise-result","xor"),me(pe(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&ge("negative-width","mask"),me(pe(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&ge("negative-width","shl"),me(pe(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&ge("negative-width","shr"),me(pe(this).shrn(t))}eq(t){return pe(this).eq(pe(t))}lt(t){return pe(this).lt(pe(t))}lte(t){return pe(this).lte(pe(t))}gt(t){return pe(this).gt(pe(t))}gte(t){return pe(this).gte(pe(t))}isNegative(){return"-"===this._hex[0]}isZero(){return pe(this).isZero()}toNumber(){try{return pe(this).toNumber()}catch(t){ge("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return he.throwError("this platform does not support BigInt",Ft.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ce||(ce=!0,he.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?he.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ft.errors.UNEXPECTED_ARGUMENT,{}):he.throwError("BigNumber.toString does not accept parameters",Ft.errors.UNEXPECTED_ARGUMENT,{})),pe(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof de)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new de(ue,fe(t)):t.match(/^-?[0-9]+$/)?new de(ue,fe(new se(t))):he.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&ge("underflow","BigNumber.from",t),(t>=le||t<=-le)&&ge("overflow","BigNumber.from",t),de.from(String(t));const e=t;if("bigint"==typeof e)return de.from(e.toString());if(Kt(e))return de.from(te(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return de.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Qt(t)||"-"===t[0]&&Qt(t.substring(1))))return de.from(t)}return he.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function fe(t){if("string"!=typeof t)return fe(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&he.throwArgumentError("invalid hex","value",t),"0x00"===(t=fe(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function me(t){return de.from(fe(t))}function pe(t){const e=de.from(t).toHexString();return"-"===e[0]?new se("-"+e.substring(3),16):new se(e.substring(2),16)}function ge(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),he.throwError(t,Ft.errors.NUMERIC_FAULT,i)}var ye=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const we=new Ft("properties/5.6.0");function ve(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function be(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function ke(t){return ye(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const r=t[e];return Promise.resolve(r).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function Me(t){const e={};for(const r in t)e[r]=t[r];return e}const _e={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ee(t){if(null==t||_e[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch(t){continue}if(!Ee(i))return!1}return!0}return we.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ae(t){if(Ee(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>je(t))));if("object"==typeof t){const e={};for(const r in t){const i=t[r];void 0!==i&&ve(e,r,je(i))}return e}return we.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function je(t){return Ae(t)}class xe{constructor(t){for(const e in t)this[e]=je(t[e])}}const Se="abi/5.6.4",Ne=new Ft(Se),Ie={};let Te={calldata:!0,memory:!0,storage:!0},Ce={calldata:!0,memory:!0};function ze(t,e){if("bytes"===t||"string"===t){if(Te[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Ce[e])return!0;return(Te[e]||"payable"===e)&&Ne.throwArgumentError("invalid modifier","name",e),!1}function Oe(t,e){for(let r in e)ve(t,r,e[r])}const Re=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Pe=new RegExp(/^(.*)\[([0-9]*)\]$/);class Be{constructor(t,e){t!==Ie&&Ne.throwError("use fromString",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Oe(this,e);let r=this.type.match(Pe);Oe(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Be.fromObject({type:r[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==Re.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===Re.full?", ":",")+")"):e+=this.type,t!==Re.sighash&&(!0===this.indexed&&(e+=" indexed"),t===Re.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Be.fromString(t,e):Be.fromObject(t)}static fromObject(t){return Be.isParamType(t)?t:new Be(Ie,{name:t.name||null,type:Ke(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Be.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function i(e){Ne.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function n(t){let r={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(r.indexed=!1),r}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||i(r),a.state.allowType=!1,a.type=Ke(a.type),a.components=[n(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(e||i(r),a.indexed=!0,a.name=""),ze(a.type,a.name)&&(a.name=""),a.type=Ke(a.type);let t=a;a=a.parent,a||i(r),delete t.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(e||i(r),a.indexed=!0,a.name=""),ze(a.type,a.name)&&(a.name=""),a.type=Ke(a.type);let s=n(a.parent);a.parent.components.push(s),delete a.parent,a=s;break;case" ":a.state.allowType&&""!==a.type&&(a.type=Ke(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(e||i(r),a.indexed&&i(r),a.indexed=!0,a.name=""):ze(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||i(r),a.type+=o,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||i(r),a.type+=o,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=o,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=o,delete a.state.allowArray):a.state.readArray?a.type+=o:i(r)}}return a.parent&&Ne.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===a.name?(e||i(r.length-7),a.indexed&&i(r.length-7),a.indexed=!0,a.name=""):ze(a.type,a.name)&&(a.name=""),o.type=Ke(o.type),o}(t,!!e),Be.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function De(t,e){return function(t){t=t.trim();let e=[],r="",i=0;for(let n=0;n<t.length;n++){let o=t[n];","===o&&0===i?(e.push(r),r=""):(r+=o,"("===o?i++:")"===o&&(i--,-1===i&&Ne.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>Be.fromString(t,e)))}class $e{constructor(t,e){t!==Ie&&Ne.throwError("use a static from method",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Oe(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return $e.isFragment(t)?t:"string"==typeof t?$e.fromString(t):$e.fromObject(t)}static fromObject(t){if($e.isFragment(t))return t;switch(t.type){case"function":return He.fromObject(t);case"event":return Le.fromObject(t);case"constructor":return Ve.fromObject(t);case"error":return Ze.fromObject(t);case"fallback":case"receive":return null}return Ne.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Le.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?He.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Ve.fromString(t.trim()):"error"===t.split(" ")[0]?Ze.fromString(t.substring(5).trim()):Ne.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Le extends $e{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Re.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ",t!==Re.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Le.fromString(t):Le.fromObject(t)}static fromObject(t){if(Le.isEventFragment(t))return t;"event"!==t.type&&Ne.throwArgumentError("invalid event object","value",t);const e={name:We(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Be.fromObject):[],type:"event"};return new Le(Ie,e)}static fromString(t){let e=t.match(Ye);e||Ne.throwArgumentError("invalid event string","value",t);let r=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":r=!0;break;case"":break;default:Ne.warn("unknown modifier: "+t)}})),Le.fromObject({name:e[1].trim(),anonymous:r,inputs:De(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Ue(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&Ne.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ne.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=de.from(r[1]),r[0]):t}function Fe(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function qe(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&Ne.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&Ne.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||Ne.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ne.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&Ne.throwArgumentError("unable to determine stateMutability","value",t),e}class Ve extends $e{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===Re.sighash&&Ne.throwError("cannot format a constructor for sighash",Ft.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Ve.fromString(t):Ve.fromObject(t)}static fromObject(t){if(Ve.isConstructorFragment(t))return t;"constructor"!==t.type&&Ne.throwArgumentError("invalid constructor object","value",t);let e=qe(t);e.constant&&Ne.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Be.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?de.from(t.gas):null};return new Ve(Ie,r)}static fromString(t){let e={type:"constructor"},r=(t=Ue(t,e)).match(Ye);return r&&"constructor"===r[1].trim()||Ne.throwArgumentError("invalid constructor string","value",t),e.inputs=De(r[2].trim(),!1),Fe(r[3].trim(),e),Ve.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class He extends Ve{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Re.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ",t!==Re.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?He.fromString(t):He.fromObject(t)}static fromObject(t){if(He.isFunctionFragment(t))return t;"function"!==t.type&&Ne.throwArgumentError("invalid function object","value",t);let e=qe(t);const r={type:t.type,name:We(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Be.fromObject):[],outputs:t.outputs?t.outputs.map(Be.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?de.from(t.gas):null};return new He(Ie,r)}static fromString(t){let e={type:"function"},r=(t=Ue(t,e)).split(" returns ");r.length>2&&Ne.throwArgumentError("invalid function string","value",t);let i=r[0].match(Ye);if(i||Ne.throwArgumentError("invalid function signature","value",t),e.name=i[1].trim(),e.name&&We(e.name),e.inputs=De(i[2],!1),Fe(i[3].trim(),e),r.length>1){let i=r[1].match(Ye);""==i[1].trim()&&""==i[3].trim()||Ne.throwArgumentError("unexpected tokens","value",t),e.outputs=De(i[2],!1)}else e.outputs=[];return He.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Ge(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||Ne.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Ze extends $e{format(t){if(t||(t=Re.sighash),Re[t]||Ne.throwArgumentError("invalid format type","format",t),t===Re.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Re.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Re.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Ze.fromString(t):Ze.fromObject(t)}static fromObject(t){if(Ze.isErrorFragment(t))return t;"error"!==t.type&&Ne.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:We(t.name),inputs:t.inputs?t.inputs.map(Be.fromObject):[]};return Ge(new Ze(Ie,e))}static fromString(t){let e={type:"error"},r=t.match(Ye);return r||Ne.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&We(e.name),e.inputs=De(r[2],!1),Ge(Ze.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Ke(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Je=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function We(t){return t&&t.match(Je)||Ne.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const Ye=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Qe=new Ft(Se);class Xe{constructor(t,e,r,i){this.name=t,this.type=e,this.localName=r,this.dynamic=i}_throwError(t,e){Qe.throwArgumentError(t,this.localName,e)}}class tr{constructor(t){ve(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return ie(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(Wt(t._data))}writeBytes(t){let e=Jt(t);const r=e.length%this.wordSize;return r&&(e=Wt([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=Jt(de.from(t));return e.length>this.wordSize&&Qe.throwError("value out-of-bounds",Ft.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=Wt([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class er{constructor(t,e,r,i){ve(this,"_data",Jt(t)),ve(this,"wordSize",e||32),ve(this,"_coerceFunc",r),ve(this,"allowLoose",i),this._offset=0}get data(){return te(this._data)}get consumed(){return this._offset}static coerce(t,e){let r=t.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):er.coerce(t,e)}_peekBytes(t,e,r){let i=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?i=e:Qe.throwError("data out-of-bounds",Ft.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(t){return new er(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let r=this._peekBytes(0,t,!!e);return this._offset+=r.length,r.slice(0,t)}readValue(){return de.from(this.readBytes(this.wordSize))}}var rr=a((function(t){!function(t,e){function r(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 n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Tt.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("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 n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-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"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+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()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){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"],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],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];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;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()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191<,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.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<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));var ir=rr.BN;const nr=new Ft("bignumber/5.6.2"),or={},ar=9007199254740991;let sr=!1;class hr{constructor(t,e){t!==or&&nr.throwError("cannot call constructor directly; use BigNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return lr(cr(this).fromTwos(t))}toTwos(t){return lr(cr(this).toTwos(t))}abs(){return"-"===this._hex[0]?hr.from(this._hex.substring(1)):this}add(t){return lr(cr(this).add(cr(t)))}sub(t){return lr(cr(this).sub(cr(t)))}div(t){return hr.from(t).isZero()&&dr("division-by-zero","div"),lr(cr(this).div(cr(t)))}mul(t){return lr(cr(this).mul(cr(t)))}mod(t){const e=cr(t);return e.isNeg()&&dr("division-by-zero","mod"),lr(cr(this).umod(e))}pow(t){const e=cr(t);return e.isNeg()&&dr("negative-power","pow"),lr(cr(this).pow(e))}and(t){const e=cr(t);return(this.isNegative()||e.isNeg())&&dr("unbound-bitwise-result","and"),lr(cr(this).and(e))}or(t){const e=cr(t);return(this.isNegative()||e.isNeg())&&dr("unbound-bitwise-result","or"),lr(cr(this).or(e))}xor(t){const e=cr(t);return(this.isNegative()||e.isNeg())&&dr("unbound-bitwise-result","xor"),lr(cr(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&dr("negative-width","mask"),lr(cr(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&dr("negative-width","shl"),lr(cr(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&dr("negative-width","shr"),lr(cr(this).shrn(t))}eq(t){return cr(this).eq(cr(t))}lt(t){return cr(this).lt(cr(t))}lte(t){return cr(this).lte(cr(t))}gt(t){return cr(this).gt(cr(t))}gte(t){return cr(this).gte(cr(t))}isNegative(){return"-"===this._hex[0]}isZero(){return cr(this).isZero()}toNumber(){try{return cr(this).toNumber()}catch(t){dr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return nr.throwError("this platform does not support BigInt",Ft.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?sr||(sr=!0,nr.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?nr.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ft.errors.UNEXPECTED_ARGUMENT,{}):nr.throwError("BigNumber.toString does not accept parameters",Ft.errors.UNEXPECTED_ARGUMENT,{})),cr(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof hr)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new hr(or,ur(t)):t.match(/^-?[0-9]+$/)?new hr(or,ur(new ir(t))):nr.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&dr("underflow","BigNumber.from",t),(t>=ar||t<=-ar)&&dr("overflow","BigNumber.from",t),hr.from(String(t));const e=t;if("bigint"==typeof e)return hr.from(e.toString());if(Kt(e))return hr.from(te(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return hr.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Qt(t)||"-"===t[0]&&Qt(t.substring(1))))return hr.from(t)}return nr.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function ur(t){if("string"!=typeof t)return ur(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&nr.throwArgumentError("invalid hex","value",t),"0x00"===(t=ur(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function lr(t){return hr.from(ur(t))}function cr(t){const e=hr.from(t).toHexString();return"-"===e[0]?new ir("-"+e.substring(3),16):new ir(e.substring(2),16)}function dr(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),nr.throwError(t,Ft.errors.NUMERIC_FAULT,i)}
|
|
16
16
|
/**
|
|
17
17
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
18
18
|
*
|
package/package.json
CHANGED
|
@@ -74,5 +74,6 @@
|
|
|
74
74
|
"afc5911fd9722b3dc5e8b16a552997510644a52d2b229c3868fb1910b112416e": "vote-string",
|
|
75
75
|
"e4b768874f191321f9a6460e15f87e98800c78c1e3104f9d4e443f2ed9b1c45e": "vote",
|
|
76
76
|
"86c81555a3dda45aa7b151c574dc27f7402c23d9b1432156f1daa6c2e15f9891": "vote-array",
|
|
77
|
-
"c0f418890817b3e6deb58fa3182bf8ed7619242666a9087eab28f27a6876e1da": "vote-string"
|
|
77
|
+
"c0f418890817b3e6deb58fa3182bf8ed7619242666a9087eab28f27a6876e1da": "vote-string",
|
|
78
|
+
"6107486ff2c58778b92eac3f9c92b26ab59f30959a12307ae868c197f382cdf6": "flag-proposal"
|
|
78
79
|
}
|
package/src/sign/types.ts
CHANGED
|
@@ -176,7 +176,7 @@ export const updateProposalTypes = {
|
|
|
176
176
|
|
|
177
177
|
export const flagProposalTypes = {
|
|
178
178
|
FlagProposal: [
|
|
179
|
-
{ name: 'from', type: '
|
|
179
|
+
{ name: 'from', type: 'string' },
|
|
180
180
|
{ name: 'space', type: 'string' },
|
|
181
181
|
{ name: 'proposal', type: 'string' },
|
|
182
182
|
{ name: 'timestamp', type: 'uint64' }
|