@snapshot-labs/snapshot.js 0.12.0-beta.4 → 0.12.0-beta.6
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 +34 -19
- package/dist/snapshot.esm.js +34 -19
- package/dist/snapshot.min.js +2 -2
- package/dist/src/utils.d.ts +1 -1
- package/package.json +6 -5
- package/src/networks.json +6 -6
- package/src/sign/hashedTypes.json +2 -1
- package/src/sign/index.ts +8 -2
- package/src/sign/types.ts +1 -0
- package/src/utils.spec.js +85 -1
- package/src/utils.ts +25 -15
- package/src/verify/starknet.spec.ts +12 -0
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 t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}function o(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=o((function(t,e){var n="undefined"!=typeof self?self:r,i=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[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&&a.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 n&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?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 d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function m(t){var e=new FileReader,r=p(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:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(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"))},i&&(this.blob=function(){var t=d(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?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);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}f.prototype.append=function(t,e){t=u(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},f.prototype.delete=function(t){delete this.map[u(t)]},f.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},f.prototype.set=function(t,e){this.map[u(t)]=l(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},n&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,n,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=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 f(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),v.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(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 f(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];_.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new _(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 A(t,r){return new Promise((function(n,o){var s=new w(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",h)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=f,t.Request=w,t.Response=_),e.Headers=f,e.Request=w,e.Response=_,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;(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})),a=n(s);let h=!1,u=!1;const l={debug:1,default:2,info:2,warning:3,error:4,off:5};let c=l.default,f=null;const d=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 p,m;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(p||(p={})),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"}(m||(m={}));const g="0123456789abcdef";class y{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==l[r]&&this.throwArgumentError("invalid log level name","logLevel",t),c>l[r]||console.log.apply(console,e)}debug(...t){this._log(y.levels.DEBUG,t)}info(...t){this._log(y.levels.INFO,t)}warn(...t){this._log(y.levels.WARNING,t)}makeError(t,e,r){if(u)return this.makeError("censored error",e,{});e||(e=y.errors.UNKNOWN_ERROR),r||(r={});const n=[];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+=g[e[t]>>4],r+=g[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case m.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 m.CALL_EXCEPTION:case m.INSUFFICIENT_FUNDS:case m.MISSING_NEW:case m.NONCE_EXPIRED:case m.REPLACEMENT_UNDERPRICED:case m.TRANSACTION_REPLACED:case m.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,y.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){d&&this.throwError("platform missing String.prototype.normalize",y.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:d})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,y.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,y.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",y.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",y.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",y.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return f||(f=new y("logger/5.6.0")),f}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),h){if(!t)return;this.globalLogger().throwError("error censorship permanent",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}u=!!t,h=!!e}static setLogLevel(t){const e=l[t.toLowerCase()];null!=e?c=e:y.globalLogger().warn("invalid log level - "+t)}static from(t){return new y(t)}}y.errors=m,y.levels=p;const v=new y("bytes/5.6.1");function w(t){return!!t.toHexString}function b(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return b(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function _(t){return S(t)&&!(t.length%2)||A(t)}function E(t){return"number"==typeof t&&t==t&&t%1==0}function A(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!E(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!E(r)||r<0||r>=256)return!1}return!0}function k(t,e){if(e||(e={}),"number"==typeof t){v.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),b(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),w(t)&&(t=t.toHexString()),S(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":v.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return b(new Uint8Array(n))}return A(t)?b(new Uint8Array(t)):v.throwArgumentError("invalid arrayify value","value",t)}function M(t){const e=t.map((t=>k(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),b(n)}function x(t){let e=k(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 S(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const N="0123456789abcdef";function I(t,e){if(e||(e={}),"number"==typeof t){v.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=N[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),w(t))return t.toHexString();if(S(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":v.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(A(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=N[(240&n)>>4]+N[15&n]}return e}return v.throwArgumentError("invalid hexlify value","value",t)}function C(t){if("string"!=typeof t)t=I(t);else if(!S(t)||t.length%2)return null;return(t.length-2)/2}function T(t,e,r){return"string"!=typeof t?t=I(t):(!S(t)||t.length%2)&&v.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function P(t){let e="0x";return t.forEach((t=>{e+=I(t).substring(2)})),e}function R(t){const e=function(t){"string"!=typeof t&&(t=I(t));S(t)||v.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)}(I(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function O(t,e){for("string"!=typeof t?t=I(t):S(t)||v.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&v.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function $(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(_(t)){let r=k(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64))):65===r.length?(e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64)),e.v=r[64]):v.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:v.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=I(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=k(t)).length>e&&v.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),b(r)}(k(e._vs),32);e._vs=I(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&v.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=I(r);null==e.s?e.s=i:e.s!==i&&v.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?v.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&&v.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&S(e.r)?e.r=O(e.r,32):v.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&S(e.s)?e.s=O(e.s,32):v.throwArgumentError("signature missing or invalid s","signature",t);const r=k(e.s);r[0]>=128&&v.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=I(r);e._vs&&(S(e._vs)||v.throwArgumentError("signature invalid _vs","signature",t),e._vs=O(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&v.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var B="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},D=[],F=[],U="undefined"!=typeof Uint8Array?Uint8Array:Array,j=!1;function L(){j=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)D[e]=t[e],F[t.charCodeAt(e)]=e;F["-".charCodeAt(0)]=62,F["_".charCodeAt(0)]=63}function z(t,e,r){for(var n,i,o=[],s=e;s<r;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(D[(i=n)>>18&63]+D[i>>12&63]+D[i>>6&63]+D[63&i]);return o.join("")}function q(t){var e;j||L();for(var r=t.length,n=r%3,i="",o=[],s=16383,a=0,h=r-n;a<h;a+=s)o.push(z(t,a,a+s>h?h:a+s));return 1===n?(e=t[r-1],i+=D[e>>2],i+=D[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=D[e>>10],i+=D[e>>4&63],i+=D[e<<2&63],i+="="),o.push(i),o.join("")}function V(t,e,r,n,i){var o,s,a=8*i-n-1,h=(1<<a)-1,u=h>>1,l=-7,c=r?i-1:0,f=r?-1:1,d=t[e+c];for(c+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+c],c+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+c],c+=f,l-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)}function H(t,e,r,n,i,o){var s,a,h,u=8*o-i-1,l=(1<<u)-1,c=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(s++,h/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*h-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*m}var G={}.toString,K=Array.isArray||function(t){return"[object Array]"==G.call(t)};Y.TYPED_ARRAY_SUPPORT=void 0===B.TYPED_ARRAY_SUPPORT||B.TYPED_ARRAY_SUPPORT;var Z=J();function J(){return Y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Q(t,e){if(J()<e)throw new RangeError("Invalid typed array length");return Y.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Y.prototype:(null===t&&(t=new Y(e)),t.length=e),t}function Y(t,e,r){if(!(Y.TYPED_ARRAY_SUPPORT||this instanceof Y))return new Y(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 tt(this,t)}return W(this,t,e,r)}function W(t,e,r,n){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,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);Y.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Y.prototype:t=et(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!Y.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|it(e,r),i=(t=Q(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(nt(e)){var r=0|rt(e.length);return 0===(t=Q(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||(n=e.length)!=n?Q(t,0):et(t,e);if("Buffer"===e.type&&K(e.data))return et(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function X(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 tt(t,e){if(X(e),t=Q(t,e<0?0:0|rt(e)),!Y.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function et(t,e){var r=e.length<0?0:0|rt(e.length);t=Q(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function rt(t){if(t>=J())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+J().toString(16)+" bytes");return 0|t}function nt(t){return!(null==t||!t._isBuffer)}function it(t,e){if(nt(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Tt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Pt(t).length;default:if(n)return Tt(t).length;e=(""+e).toLowerCase(),n=!0}}function ot(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return bt(this,e,r);case"utf8":case"utf-8":return gt(this,e,r);case"ascii":return vt(this,e,r);case"latin1":case"binary":return wt(this,e,r);case"base64":return mt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _t(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function st(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function at(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Y.from(e,n)),nt(e))return 0===e.length?-1:ht(t,e,r,n,i);if("number"==typeof e)return e&=255,Y.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ht(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ht(t,e,r,n,i){var o,s=1,a=t.length,h=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===h)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var c=!0,f=0;f<h;f++)if(u(t,o+f)!==u(e,f)){c=!1;break}if(c)return o}return-1}function ut(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function lt(t,e,r,n){return Rt(Tt(e,t.length-r),t,r,n)}function ct(t,e,r,n){return Rt(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function ft(t,e,r,n){return ct(t,e,r,n)}function dt(t,e,r,n){return Rt(Pt(e),t,r,n)}function pt(t,e,r,n){return Rt(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function mt(t,e,r){return 0===e&&r===t.length?q(t):q(t.slice(e,r))}function gt(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,h,u=t[i],l=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[i+1]))&&(h=(31&u)<<6|63&o)>127&&(l=h);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(h=(15&u)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}return function(t){var e=t.length;if(e<=yt)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=yt));return r}(n)}Y.poolSize=8192,Y._augment=function(t){return t.__proto__=Y.prototype,t},Y.from=function(t,e,r){return W(null,t,e,r)},Y.TYPED_ARRAY_SUPPORT&&(Y.prototype.__proto__=Uint8Array.prototype,Y.__proto__=Uint8Array),Y.alloc=function(t,e,r){return function(t,e,r,n){return X(e),e<=0?Q(t,e):void 0!==r?"string"==typeof n?Q(t,e).fill(r,n):Q(t,e).fill(r):Q(t,e)}(null,t,e,r)},Y.allocUnsafe=function(t){return tt(null,t)},Y.allocUnsafeSlow=function(t){return tt(null,t)},Y.isBuffer=Ot,Y.compare=function(t,e){if(!nt(t)||!nt(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},Y.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}},Y.concat=function(t,e){if(!K(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Y.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=Y.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!nt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},Y.byteLength=it,Y.prototype._isBuffer=!0,Y.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)st(this,e,e+1);return this},Y.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)st(this,e,e+3),st(this,e+1,e+2);return this},Y.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)st(this,e,e+7),st(this,e+1,e+6),st(this,e+2,e+5),st(this,e+3,e+4);return this},Y.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?gt(this,0,t):ot.apply(this,arguments)},Y.prototype.equals=function(t){if(!nt(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Y.compare(this,t)},Y.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+">"},Y.prototype.compare=function(t,e,r,n,i){if(!nt(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(n,i),u=t.slice(e,r),l=0;l<a;++l)if(h[l]!==u[l]){o=h[l],s=u[l];break}return o<s?-1:s<o?1:0},Y.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},Y.prototype.indexOf=function(t,e,r){return at(this,t,e,r,!0)},Y.prototype.lastIndexOf=function(t,e,r){return at(this,t,e,r,!1)},Y.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=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===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return ut(this,t,e,r);case"utf8":case"utf-8":return lt(this,t,e,r);case"ascii":return ct(this,t,e,r);case"latin1":case"binary":return ft(this,t,e,r);case"base64":return dt(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var yt=4096;function vt(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function wt(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function bt(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Ct(t[o]);return i}function _t(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function Et(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 At(t,e,r,n,i,o){if(!nt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function kt(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Mt(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function xt(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function St(t,e,r,n,i){return i||xt(t,0,r,4),H(t,e,r,n,23,4),r+4}function Nt(t,e,r,n,i){return i||xt(t,0,r,8),H(t,e,r,n,52,8),r+8}Y.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),Y.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=Y.prototype;else{var i=e-t;r=new Y(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},Y.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},Y.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},Y.prototype.readUInt8=function(t,e){return e||Et(t,1,this.length),this[t]},Y.prototype.readUInt16LE=function(t,e){return e||Et(t,2,this.length),this[t]|this[t+1]<<8},Y.prototype.readUInt16BE=function(t,e){return e||Et(t,2,this.length),this[t]<<8|this[t+1]},Y.prototype.readUInt32LE=function(t,e){return e||Et(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Y.prototype.readUInt32BE=function(t,e){return e||Et(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Y.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},Y.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Y.prototype.readInt8=function(t,e){return e||Et(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Y.prototype.readInt16LE=function(t,e){e||Et(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Y.prototype.readInt16BE=function(t,e){e||Et(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Y.prototype.readInt32LE=function(t,e){return e||Et(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Y.prototype.readInt32BE=function(t,e){return e||Et(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Y.prototype.readFloatLE=function(t,e){return e||Et(t,4,this.length),V(this,t,!0,23,4)},Y.prototype.readFloatBE=function(t,e){return e||Et(t,4,this.length),V(this,t,!1,23,4)},Y.prototype.readDoubleLE=function(t,e){return e||Et(t,8,this.length),V(this,t,!0,52,8)},Y.prototype.readDoubleBE=function(t,e){return e||Et(t,8,this.length),V(this,t,!1,52,8)},Y.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||At(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},Y.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||At(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Y.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,1,255,0),Y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Y.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,65535,0),Y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):kt(this,t,e,!0),e+2},Y.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,65535,0),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):kt(this,t,e,!1),e+2},Y.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,4294967295,0),Y.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Mt(this,t,e,!0),e+4},Y.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,4294967295,0),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mt(this,t,e,!1),e+4},Y.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);At(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Y.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);At(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Y.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,1,127,-128),Y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Y.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,32767,-32768),Y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):kt(this,t,e,!0),e+2},Y.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,32767,-32768),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):kt(this,t,e,!1),e+2},Y.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,2147483647,-2147483648),Y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Mt(this,t,e,!0),e+4},Y.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mt(this,t,e,!1),e+4},Y.prototype.writeFloatLE=function(t,e,r){return St(this,t,e,!0,r)},Y.prototype.writeFloatBE=function(t,e,r){return St(this,t,e,!1,r)},Y.prototype.writeDoubleLE=function(t,e,r){return Nt(this,t,e,!0,r)},Y.prototype.writeDoubleBE=function(t,e,r){return Nt(this,t,e,!1,r)},Y.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===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(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Y.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},Y.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Y.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}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 s=nt(t)?t:Tt(new Y(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var It=/[^+\/0-9A-Za-z-_]/g;function Ct(t){return t<16?"0"+t.toString(16):t.toString(16)}function Tt(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Pt(t){return function(t){var e,r,n,i,o,s;j||L();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new U(3*a/4-o),n=o>0?a-4:a;var h=0;for(e=0,r=0;e<n;e+=4,r+=3)i=F[t.charCodeAt(e)]<<18|F[t.charCodeAt(e+1)]<<12|F[t.charCodeAt(e+2)]<<6|F[t.charCodeAt(e+3)],s[h++]=i>>16&255,s[h++]=i>>8&255,s[h++]=255&i;return 2===o?(i=F[t.charCodeAt(e)]<<2|F[t.charCodeAt(e+1)]>>4,s[h++]=255&i):1===o&&(i=F[t.charCodeAt(e)]<<10|F[t.charCodeAt(e+1)]<<4|F[t.charCodeAt(e+2)]>>2,s[h++]=i>>8&255,s[h++]=255&i),s}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(It,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Rt(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Ot(t){return null!=t&&(!!t._isBuffer||$t(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&$t(t.slice(0,0))}(t))}function $t(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Bt=i(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:Z,Buffer:Y,SlowBuffer:function(t){return+t!=t&&(t=0),Y.alloc(+t)},isBuffer:Ot})),Dt=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Ft=Dt.BN;const Ut=new y("bignumber/5.6.2"),jt={},Lt=9007199254740991;let zt=!1;class qt{constructor(t,e){t!==jt&&Ut.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Ht(Gt(this).fromTwos(t))}toTwos(t){return Ht(Gt(this).toTwos(t))}abs(){return"-"===this._hex[0]?qt.from(this._hex.substring(1)):this}add(t){return Ht(Gt(this).add(Gt(t)))}sub(t){return Ht(Gt(this).sub(Gt(t)))}div(t){return qt.from(t).isZero()&&Kt("division-by-zero","div"),Ht(Gt(this).div(Gt(t)))}mul(t){return Ht(Gt(this).mul(Gt(t)))}mod(t){const e=Gt(t);return e.isNeg()&&Kt("division-by-zero","mod"),Ht(Gt(this).umod(e))}pow(t){const e=Gt(t);return e.isNeg()&&Kt("negative-power","pow"),Ht(Gt(this).pow(e))}and(t){const e=Gt(t);return(this.isNegative()||e.isNeg())&&Kt("unbound-bitwise-result","and"),Ht(Gt(this).and(e))}or(t){const e=Gt(t);return(this.isNegative()||e.isNeg())&&Kt("unbound-bitwise-result","or"),Ht(Gt(this).or(e))}xor(t){const e=Gt(t);return(this.isNegative()||e.isNeg())&&Kt("unbound-bitwise-result","xor"),Ht(Gt(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Kt("negative-width","mask"),Ht(Gt(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Kt("negative-width","shl"),Ht(Gt(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Kt("negative-width","shr"),Ht(Gt(this).shrn(t))}eq(t){return Gt(this).eq(Gt(t))}lt(t){return Gt(this).lt(Gt(t))}lte(t){return Gt(this).lte(Gt(t))}gt(t){return Gt(this).gt(Gt(t))}gte(t){return Gt(this).gte(Gt(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Gt(this).isZero()}toNumber(){try{return Gt(this).toNumber()}catch(t){Kt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ut.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?zt||(zt=!0,Ut.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ut.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Ut.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Gt(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof qt)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new qt(jt,Vt(t)):t.match(/^-?[0-9]+$/)?new qt(jt,Vt(new Ft(t))):Ut.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Kt("underflow","BigNumber.from",t),(t>=Lt||t<=-Lt)&&Kt("overflow","BigNumber.from",t),qt.from(String(t));const e=t;if("bigint"==typeof e)return qt.from(e.toString());if(A(e))return qt.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return qt.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(S(t)||"-"===t[0]&&S(t.substring(1))))return qt.from(t)}return Ut.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Vt(t){if("string"!=typeof t)return Vt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ut.throwArgumentError("invalid hex","value",t),"0x00"===(t=Vt(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 Ht(t){return qt.from(Vt(t))}function Gt(t){const e=qt.from(t).toHexString();return"-"===e[0]?new Ft("-"+e.substring(3),16):new Ft(e.substring(2),16)}function Kt(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ut.throwError(t,y.errors.NUMERIC_FAULT,n)}function Zt(){throw new Error("setTimeout has not been defined")}function Jt(){throw new Error("clearTimeout has not been defined")}var Qt=Zt,Yt=Jt;function Wt(t){if(Qt===setTimeout)return setTimeout(t,0);if((Qt===Zt||!Qt)&&setTimeout)return Qt=setTimeout,setTimeout(t,0);try{return Qt(t,0)}catch(e){try{return Qt.call(null,t,0)}catch(e){return Qt.call(this,t,0)}}}"function"==typeof B.setTimeout&&(Qt=setTimeout),"function"==typeof B.clearTimeout&&(Yt=clearTimeout);var Xt,te=[],ee=!1,re=-1;function ne(){ee&&Xt&&(ee=!1,Xt.length?te=Xt.concat(te):re=-1,te.length&&ie())}function ie(){if(!ee){var t=Wt(ne);ee=!0;for(var e=te.length;e;){for(Xt=te,te=[];++re<e;)Xt&&Xt[re].run();re=-1,e=te.length}Xt=null,ee=!1,function(t){if(Yt===clearTimeout)return clearTimeout(t);if((Yt===Jt||!Yt)&&clearTimeout)return Yt=clearTimeout,clearTimeout(t);try{Yt(t)}catch(e){try{return Yt.call(null,t)}catch(e){return Yt.call(this,t)}}}(t)}}function oe(t,e){this.fun=t,this.array=e}oe.prototype.run=function(){this.fun.apply(null,this.array)};function se(){}var ae=se,he=se,ue=se,le=se,ce=se,fe=se,de=se;var pe=B.performance||{},me=pe.now||pe.mozNow||pe.msNow||pe.oNow||pe.webkitNow||function(){return(new Date).getTime()};var ge=new Date;var ye={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];te.push(new oe(t,e)),1!==te.length||ee||Wt(ie)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ae,addListener:he,once:ue,off:le,removeListener:ce,removeAllListeners:fe,emit:de,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*me.call(pe),r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r-=t[0],(n-=t[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ge)/1e3}},ve=o((function(t){!function(){var e="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof ye&&ye.versions&&ye.versions.node?i=r:o&&(i=self);var s=!i.JS_SHA3_NO_COMMON_JS&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),u=[4,1024,262144,67108864],l=[0,8,16,24],c=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],f=[224,256,384,512],d=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],m={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var g=function(t,e,r){return function(n){return new T(t,e,t).update(n)[r]()}},y=function(t,e,r){return function(n,i){return new T(t,e,i).update(n)[r]()}},v=function(t,e,r){return function(e,n,i,o){return A["cshake"+t].update(e,n,i,o)[r]()}},w=function(t,e,r){return function(e,n,i,o){return A["kmac"+t].update(e,n,i,o)[r]()}},b=function(t,e,r,n){for(var i=0;i<p.length;++i){var o=p[i];t[o]=e(r,n,o)}return t},_=function(t,e){var r=g(t,e,"hex");return r.create=function(){return new T(t,e,t)},r.update=function(t){return r.create().update(t)},b(r,g,t,e)},E=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:_},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:_},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var r=y(t,e,"hex");return r.create=function(r){return new T(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},b(r,y,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var r=m[t],n=v(t,0,"hex");return n.create=function(n,i,o){return i||o?new T(t,e,n).bytepad([i,o],r):A["shake"+t].create(n)},n.update=function(t,e,r,i){return n.create(e,r,i).update(t)},b(n,v,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var r=m[t],n=w(t,0,"hex");return n.create=function(n,i,o){return new P(t,e,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(t,e,r,i){return n.create(t,r,i).update(e)},b(n,w,t,e)}}],A={},k=[],M=0;M<E.length;++M)for(var x=E[M],S=x.bits,N=0;N<S.length;++N){var I=x.name+"_"+S[N];if(k.push(I),A[I]=x.createMethod(S[N],x.padding),"sha3"!==x.name){var C=x.name+S[N];k.push(C),A[C]=A[I]}}function T(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function P(t,e,r){T.call(this,t,e,r)}T.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,o,s=this.blocks,h=this.byteCount,u=t.length,c=this.blockCount,f=0,d=this.s;f<u;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<c+1;++i)s[i]=0;if(r)for(i=this.start;f<u&&i<h;++f)s[i>>2]|=t[f]<<l[3&i++];else for(i=this.start;f<u&&i<h;++f)(o=t.charCodeAt(f))<128?s[i>>2]|=o<<l[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<l[3&i++],s[i>>2]|=(128|63&o)<<l[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<l[3&i++],s[i>>2]|=(128|o>>6&63)<<l[3&i++],s[i>>2]|=(128|63&o)<<l[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++f)),s[i>>2]|=(240|o>>18)<<l[3&i++],s[i>>2]|=(128|o>>12&63)<<l[3&i++],s[i>>2]|=(128|o>>6&63)<<l[3&i++],s[i>>2]|=(128|63&o)<<l[3&i++]);if(this.lastByteIndex=i,i>=h){for(this.start=i-h,this.block=s[c],i=0;i<c;++i)d[i]^=s[i];R(d),this.reset=!0}else this.start=i}return this},T.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},T.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,o=t.length;if(r)i=o;else for(var s=0;s<t.length;++s){var h=t.charCodeAt(s);h<128?i+=1:h<2048?i+=2:h<55296||h>=57344?i+=3:(h=65536+((1023&h)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},T.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=e-r%e,o=[];return o.length=i,this.update(o),this},T.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];R(n)}},T.prototype.toString=T.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<e&&s<n;++o,++s)t=r[o],a+=h[t>>4&15]+h[15&t]+h[t>>12&15]+h[t>>8&15]+h[t>>20&15]+h[t>>16&15]+h[t>>28&15]+h[t>>24&15];s%e==0&&(R(r),o=0)}return i&&(t=r[o],a+=h[t>>4&15]+h[15&t],i>1&&(a+=h[t>>12&15]+h[t>>8&15]),i>2&&(a+=h[t>>20&15]+h[t>>16&15])),a},T.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var h=new Uint32Array(t);s<n;){for(o=0;o<e&&s<n;++o,++s)h[s]=r[o];s%e==0&&R(r)}return i&&(h[o]=r[o],t=t.slice(0,a)),t},T.prototype.buffer=T.prototype.arrayBuffer,T.prototype.digest=T.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,h=[];a<i;){for(s=0;s<r&&a<i;++s,++a)t=a<<2,e=n[s],h[t]=255&e,h[t+1]=e>>8&255,h[t+2]=e>>16&255,h[t+3]=e>>24&255;a%r==0&&R(n)}return o&&(t=a<<2,e=n[s],h[t]=255&e,o>1&&(h[t+1]=e>>8&255),o>2&&(h[t+2]=e>>16&255)),h},P.prototype=new T,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),T.prototype.finalize.call(this)};var R=function(t){var e,r,n,i,o,s,a,h,u,l,f,d,p,m,g,y,v,w,b,_,E,A,k,M,x,S,N,I,C,T,P,R,O,$,B,D,F,U,j,L,z,q,V,H,G,K,Z,J,Q,Y,W,X,tt,et,rt,nt,it,ot,st,at,ht,ut,lt;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],h=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(h<<1|u>>>31),r=o^(u<<1|h>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(l<<1|f>>>31),r=a^(f<<1|l>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=h^(d<<1|p>>>31),r=u^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=l^(i<<1|o>>>31),r=f^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],g=t[1],K=t[11]<<4|t[10]>>>28,Z=t[10]<<4|t[11]>>>28,I=t[20]<<3|t[21]>>>29,C=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ht=t[30]<<9|t[31]>>>23,q=t[40]<<18|t[41]>>>14,V=t[41]<<18|t[40]>>>14,$=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,T=t[33]<<13|t[32]>>>19,P=t[32]<<13|t[33]>>>19,ut=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,D=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,Y=t[34]<<15|t[35]>>>17,W=t[35]<<15|t[34]>>>17,R=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,j=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,E=t[37]<<21|t[36]>>>11,X=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,N=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,L=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,k=t[49]<<14|t[48]>>>18,t[0]=m^~y&w,t[1]=g^~v&b,t[10]=M^~S&I,t[11]=x^~N&C,t[20]=$^~D&U,t[21]=B^~F&j,t[30]=H^~K&J,t[31]=G^~Z&Q,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=y^~w&_,t[3]=v^~b&E,t[12]=S^~I&T,t[13]=N^~C&P,t[22]=D^~U&L,t[23]=F^~j&z,t[32]=K^~J&Y,t[33]=Z^~Q&W,t[42]=nt^~ot&at,t[43]=it^~st&ht,t[4]=w^~_&A,t[5]=b^~E&k,t[14]=I^~T&R,t[15]=C^~P&O,t[24]=U^~L&q,t[25]=j^~z&V,t[34]=J^~Y&X,t[35]=Q^~W&tt,t[44]=ot^~at&ut,t[45]=st^~ht<,t[6]=_^~A&m,t[7]=E^~k&g,t[16]=T^~R&M,t[17]=P^~O&x,t[26]=L^~q&$,t[27]=z^~V&B,t[36]=Y^~X&H,t[37]=W^~tt&G,t[46]=at^~ut&et,t[47]=ht^~lt&rt,t[8]=A^~m&y,t[9]=k^~g&v,t[18]=R^~M&S,t[19]=O^~x&N,t[28]=q^~$&D,t[29]=V^~B&F,t[38]=X^~H&K,t[39]=tt^~G&Z,t[48]=ut^~et&nt,t[49]=lt^~rt&it,t[0]^=c[n],t[1]^=c[n+1]};if(s)t.exports=A;else for(M=0;M<k.length;++M)i[k[M]]=A[k[M]]}()}));function we(t){return"0x"+ve.keccak_256(k(t))}const be=new y("rlp/5.6.1");function _e(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Ee(t,e,r){let n=0;for(let i=0;i<r;i++)n=256*n+t[e+i];return n}function Ae(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(Ae(t))})),e.length<=55)return e.unshift(192+e.length),e;const r=_e(e.length);return r.unshift(247+r.length),r.concat(e)}_(t)||be.throwArgumentError("RLP object must be BytesLike","object",t);const e=Array.prototype.slice.call(k(t));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=_e(e.length);return r.unshift(183+r.length),r.concat(e)}function ke(t){return I(Ae(t))}function Me(t,e,r,n){const i=[];for(;r<e+1+n;){const o=xe(t,r);i.push(o.result),(r+=o.consumed)>e+1+n&&be.throwError("child data too short",y.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function xe(t,e){if(0===t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&be.throwError("data short segment too short",y.errors.BUFFER_OVERRUN,{});const n=Ee(t,e+1,r);return e+1+r+n>t.length&&be.throwError("data long segment too short",y.errors.BUFFER_OVERRUN,{}),Me(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{}),Me(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});const n=Ee(t,e+1,r);e+1+r+n>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:I(t.slice(e+1+r,e+1+r+n))}}if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:I(t.slice(e+1,e+1+r))}}return{consumed:1,result:I(t[e])}}function Se(t){const e=k(t),r=xe(e,0);return r.consumed!==e.length&&be.throwArgumentError("invalid rlp data","data",t),r.result}const Ne=new y("address/5.6.1");function Ie(t){S(t,20)||Ne.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=k(we(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Ce={};for(let t=0;t<10;t++)Ce[String(t)]=String(t);for(let t=0;t<26;t++)Ce[String.fromCharCode(65+t)]=String(10+t);const Te=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Pe(t){let e=null;if("string"!=typeof t&&Ne.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Ie(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ne.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Ce[t])).join("");for(;e.length>=Te;){let t=e.substring(0,Te);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Ne.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Ft(r,36).toString(16);e.length<40;)e="0"+e;e=Ie("0x"+e)}else Ne.throwArgumentError("invalid address","address",t);var r;return e}function Re(t){try{return Pe(t),!0}catch(t){}return!1}function Oe(t){let e=null;try{e=Pe(t.from)}catch(e){Ne.throwArgumentError("missing from address","transaction",t)}return Pe(T(we(ke([e,x(k(qt.from(t.nonce).toHexString()))])),12))}const $e={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},Be={Proposal:[{name:"from",type:"address"},{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:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"app",type:"string"}]},De={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"address"},{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:"plugins",type:"string"}]},Fe={FlagProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},Ue={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},je={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},Le={Vote:[{name:"from",type:"address"},{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"}]},ze={Vote:[{name:"from",type:"address"},{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"}]},qe={Vote:[{name:"from",type:"address"},{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"}]},Ve={Vote:[{name:"from",type:"address"},{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"}]},He={Vote:[{name:"from",type:"address"},{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"}]},Ge={Vote:[{name:"from",type:"address"},{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"}]},Ke={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Ze={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Je={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Qe={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Ye={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},We={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"}]},Xe={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},tr={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var er={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},rr={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},nr={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const ir={name:"snapshot",version:"0.1.4"};class or{constructor(t=er.sequencer,e={}){t=(t=(t=t.replace(er.hub,er.sequencer)).replace(rr.hub,rr.sequencer)).replace(nr.hub,nr.sequencer),this.address=t,this.options=e}sign(t,r,n,i){return e(this,void 0,void 0,(function*(){var e;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,s=Pe(r);n.from=n.from?Pe(n.from):s,n.timestamp||(n.timestamp=parseInt((Date.now()/1e3).toFixed()));const a=Object.assign({},ir);"undefined"!=typeof window&&(null===(e=window.ethereum)||void 0===e?void 0:e.isTrust)&&(a.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:a,types:i,message:n},u=yield o._signTypedData(a,h.types,n);return yield this.send({address:s,sig:u,data:h})}))}send(t){return e(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,n)=>{a(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(n).catch(n);throw e})).catch(n)}))}))}space(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,$e)}))}proposal(t,r,n){return e(this,void 0,void 0,(function*(){return n.discussion||(n.discussion=""),n.app||(n.app=""),yield this.sign(t,r,n,Be)}))}updateProposal(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,De)}))}flagProposal(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Fe)}))}cancelProposal(t,r,n){return e(this,void 0,void 0,(function*(){const e=n.proposal.startsWith("0x");return yield this.sign(t,r,n,e?je:Ue)}))}vote(t,r,n){return e(this,void 0,void 0,(function*(){const e="shutter"===(null==n?void 0:n.privacy);n.reason||(n.reason=""),n.app||(n.app=""),n.metadata||(n.metadata="{}");const i=n.proposal.startsWith("0x");let o=i?Ve:Le;return["approval","ranked-choice"].includes(n.type)&&(o=i?He:ze),!e&&["quadratic","weighted"].includes(n.type)&&(o=i?Ge:qe,n.choice=JSON.stringify(n.choice)),e&&(o=i?Ge:qe),delete n.privacy,delete n.type,yield this.sign(t,r,n,o)}))}follow(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Ke)}))}unfollow(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Ze)}))}subscribe(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Je)}))}unsubscribe(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Qe)}))}profile(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Ye)}))}statement(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,We)}))}alias(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Xe)}))}deleteSpace(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,tr)}))}}var sr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:4e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxItems:500},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:24}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},ar={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:2e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxItems:500},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},hr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:1e3},app:{type:"string",title:"app",maxLength:24}},required:["proposal","choice"],additionalProperties:!1}}},ur={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},lr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},cr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},fr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}},dr={space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"uri",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1,maxLength:32},symbol:{type:"string",title:"symbol",minLength:1,maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64},strategies:{type:"array",minItems:1,maxItemsWithSpaceType:{default:8,turbo:10},uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",maxLength:12,title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"}]},delegationContract:{type:"string",format:"address",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"]},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:15552e3,errorMessage:{maximum:"Delay must be less than 180 days"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector"]}},treasuries:{type:"array",maxItems:10,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},network:{type:"string",snapshotNetwork:!0,title:"Network",maxLength:12}},required:["name","address","network"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1}},required:["name","network","symbol","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:sr.definitions.Proposal,updateProposal:ar.definitions.UpdateProposal,vote:hr.definitions.Vote,profile:ur.definitions.Profile,statement:lr.definitions.Statement,zodiac:cr.definitions.Zodiac,alias:fr.definitions.Alias};var pr=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const mr=new y("properties/5.6.0");function gr(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function yr(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 vr(t){return pr(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 wr(t){const e={};for(const r in t)e[r]=t[r];return e}const br={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function _r(t){if(null==t||br[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 n=null;try{n=t[e[r]]}catch(t){continue}if(!_r(n))return!1}return!0}return mr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Er(t){if(_r(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>Ar(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&gr(e,r,Ar(n))}return e}return mr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ar(t){return Er(t)}class kr{constructor(t){for(const e in t)this[e]=Ar(t[e])}}const Mr="abi/5.6.4",xr=new y(Mr),Sr={};let Nr={calldata:!0,memory:!0,storage:!0},Ir={calldata:!0,memory:!0};function Cr(t,e){if("bytes"===t||"string"===t){if(Nr[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Ir[e])return!0;return(Nr[e]||"payable"===e)&&xr.throwArgumentError("invalid modifier","name",e),!1}function Tr(t,e){for(let r in e)gr(t,r,e[r])}const Pr=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Rr=new RegExp(/^(.*)\[([0-9]*)\]$/);class Or{constructor(t,e){t!==Sr&&xr.throwError("use fromString",y.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Tr(this,e);let r=this.type.match(Rr);Tr(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Or.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=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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!==Pr.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===Pr.full?", ":",")+")"):e+=this.type,t!==Pr.sighash&&(!0===this.indexed&&(e+=" indexed"),t===Pr.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Or.fromString(t,e):Or.fromObject(t)}static fromObject(t){return Or.isParamType(t)?t:new Or(Sr,{name:t.name||null,type:Hr(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Or.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){xr.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(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}},s=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||n(r),s.state.allowType=!1,s.type=Hr(s.type),s.components=[i(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),Cr(s.type,s.name)&&(s.name=""),s.type=Hr(s.type);let t=s;s=s.parent,s||n(r),delete t.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),Cr(s.type,s.name)&&(s.name=""),s.type=Hr(s.type);let a=i(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=Hr(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(e||n(r),s.indexed&&n(r),s.indexed=!0,s.name=""):Cr(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||n(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||n(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:n(r)}}return s.parent&&xr.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===s.name?(e||n(r.length-7),s.indexed&&n(r.length-7),s.indexed=!0,s.name=""):Cr(s.type,s.name)&&(s.name=""),o.type=Hr(o.type),o}(t,!!e),Or.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function $r(t,e){return function(t){t=t.trim();let e=[],r="",n=0;for(let i=0;i<t.length;i++){let o=t[i];","===o&&0===n?(e.push(r),r=""):(r+=o,"("===o?n++:")"===o&&(n--,-1===n&&xr.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>Or.fromString(t,e)))}class Br{constructor(t,e){t!==Sr&&xr.throwError("use a static from method",y.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Tr(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Br.isFragment(t)?t:"string"==typeof t?Br.fromString(t):Br.fromObject(t)}static fromObject(t){if(Br.isFragment(t))return t;switch(t.type){case"function":return zr.fromObject(t);case"event":return Dr.fromObject(t);case"constructor":return Lr.fromObject(t);case"error":return Vr.fromObject(t);case"fallback":case"receive":return null}return xr.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]?Dr.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?zr.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Lr.fromString(t.trim()):"error"===t.split(" ")[0]?Vr.fromString(t.substring(5).trim()):xr.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Dr extends Br{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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!==Pr.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ",t!==Pr.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Dr.fromString(t):Dr.fromObject(t)}static fromObject(t){if(Dr.isEventFragment(t))return t;"event"!==t.type&&xr.throwArgumentError("invalid event object","value",t);const e={name:Kr(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Or.fromObject):[],type:"event"};return new Dr(Sr,e)}static fromString(t){let e=t.match(Zr);e||xr.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:xr.warn("unknown modifier: "+t)}})),Dr.fromObject({name:e[1].trim(),anonymous:r,inputs:$r(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Fr(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&xr.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||xr.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=qt.from(r[1]),r[0]):t}function Ur(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 jr(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&&xr.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&xr.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||xr.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&&xr.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&&xr.throwArgumentError("unable to determine stateMutability","value",t),e}class Lr extends Br{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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===Pr.sighash&&xr.throwError("cannot format a constructor for sighash",y.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Lr.fromString(t):Lr.fromObject(t)}static fromObject(t){if(Lr.isConstructorFragment(t))return t;"constructor"!==t.type&&xr.throwArgumentError("invalid constructor object","value",t);let e=jr(t);e.constant&&xr.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Or.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?qt.from(t.gas):null};return new Lr(Sr,r)}static fromString(t){let e={type:"constructor"},r=(t=Fr(t,e)).match(Zr);return r&&"constructor"===r[1].trim()||xr.throwArgumentError("invalid constructor string","value",t),e.inputs=$r(r[2].trim(),!1),Ur(r[3].trim(),e),Lr.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class zr extends Lr{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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!==Pr.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ",t!==Pr.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?zr.fromString(t):zr.fromObject(t)}static fromObject(t){if(zr.isFunctionFragment(t))return t;"function"!==t.type&&xr.throwArgumentError("invalid function object","value",t);let e=jr(t);const r={type:t.type,name:Kr(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Or.fromObject):[],outputs:t.outputs?t.outputs.map(Or.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?qt.from(t.gas):null};return new zr(Sr,r)}static fromString(t){let e={type:"function"},r=(t=Fr(t,e)).split(" returns ");r.length>2&&xr.throwArgumentError("invalid function string","value",t);let n=r[0].match(Zr);if(n||xr.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&Kr(e.name),e.inputs=$r(n[2],!1),Ur(n[3].trim(),e),r.length>1){let n=r[1].match(Zr);""==n[1].trim()&&""==n[3].trim()||xr.throwArgumentError("unexpected tokens","value",t),e.outputs=$r(n[2],!1)}else e.outputs=[];return zr.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function qr(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||xr.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Vr extends Br{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Pr.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Vr.fromString(t):Vr.fromObject(t)}static fromObject(t){if(Vr.isErrorFragment(t))return t;"error"!==t.type&&xr.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:Kr(t.name),inputs:t.inputs?t.inputs.map(Or.fromObject):[]};return qr(new Vr(Sr,e))}static fromString(t){let e={type:"error"},r=t.match(Zr);return r||xr.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&Kr(e.name),e.inputs=$r(r[2],!1),qr(Vr.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Hr(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Gr=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Kr(t){return t&&t.match(Gr)||xr.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const Zr=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Jr=new y(Mr);class Qr{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){Jr.throwArgumentError(t,this.localName,e)}}class Yr{constructor(t){gr(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return P(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(M(t._data))}writeBytes(t){let e=k(t);const r=e.length%this.wordSize;return r&&(e=M([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=k(qt.from(t));return e.length>this.wordSize&&Jr.throwError("value out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=M([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 Wr{constructor(t,e,r,n){gr(this,"_data",k(t)),gr(this,"wordSize",e||32),gr(this,"_coerceFunc",r),gr(this,"allowLoose",n),this._offset=0}get data(){return I(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):Wr.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:Jr.throwError("data out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new Wr(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 qt.from(this.readBytes(this.wordSize))}}class Xr extends Qr{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=Pe(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return Pe(O(t.readValue().toHexString(),20))}}class tn extends Qr{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const en=new y(Mr);function rn(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||en.throwError("cannot encode object for signature with missing names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&en.throwError("cannot encode object for signature with duplicate names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else en.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&en.throwArgumentError("types/value length mismatch","tuple",r);let i=new Yr(t.wordSize),o=new Yr(t.wordSize),s=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=o.length;t.encode(o,r);let n=i.writeUpdatableValue();s.push((t=>{n(t+e)}))}else t.encode(i,r)})),s.forEach((t=>{t(i.length)}));let a=t.appendWriter(i);return a+=t.appendWriter(o),a}function nn(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let r=t.readValue(),o=n.subReader(r.toNumber());try{i=e.decode(o)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)}));const i=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(r)}class on extends Qr{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),en.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let t=0;t<e.length;t++)n.push(this.coder);return rn(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&en.throwError("insufficient data length",y.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new tn(this.coder));return t.coerce(this.name,nn(t,r))}}class sn extends Qr{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class an extends Qr{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=k(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class hn extends an{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,I(super.decode(t)))}}class un extends Qr{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let r=k(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,I(t.readBytes(this.size)))}}class ln extends Qr{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}const cn=qt.from(-1),fn=qt.from(0),dn=qt.from(1),pn=qt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class mn extends Qr{constructor(t,e,r){const n=(e?"int":"uint")+8*t;super(n,n,r,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let r=qt.from(e),n=pn.mask(8*t.wordSize);if(this.signed){let t=n.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(dn).mul(cn)))&&this._throwError("value out-of-bounds",e)}else(r.lt(fn)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}const gn=new y("strings/5.6.1");var yn,vn;function wn(t,e,r,n,i){if(t===vn.BAD_PREFIX||t===vn.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n<r.length&&r[n]>>6==2;n++)t++;return t}return t===vn.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(yn||(yn={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(vn||(vn={}));const bn=Object.freeze({error:function(t,e,r,n,i){return gn.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:wn,replace:function(t,e,r,n,i){return t===vn.OVERLONG?(n.push(i),0):(n.push(65533),wn(t,e,r))}});function _n(t,e){null==e&&(e=bn.error),t=k(t);const r=[];let n=0;for(;n<t.length;){const i=t[n++];if(i>>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?vn.UNEXPECTED_CONTINUE:vn.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(vn.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=t[n];if(128!=(192&i)){n+=e(vn.MISSING_CONTINUE,n,t,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=e(vn.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(vn.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(vn.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function En(t,e=yn.current){e!=yn.current&&(gn.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return k(r)}function An(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function kn(t,e){return An(_n(t,e))}function Mn(t,e=yn.current){return _n(En(t,e))}function xn(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function Sn(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function Nn(t,e){let r=0;for(let n=0;n<e.length;n++){let i=e[n];if(r+=i.l,t>=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const In=Sn("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Cn="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Tn=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Pn=xn("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Rn=xn("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),On=xn("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e})),$n=Sn("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function Bn(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Mn(t);var r;r=e.map((t=>{if(Cn.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=Nn(t,Tn);if(e)return[t+e.s];let r=Pn[t];if(r)return r;let n=Rn[t];return n?[t+n[0]]:On[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Mn(An(e),yn.NFKC),e.forEach((t=>{if(Nn(t,$n))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(Nn(t,In))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=An(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");if(n.length>63)throw new Error("too long");return n}class Dn extends an{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,En(e))}decode(t){return kn(super.decode(t))}}class Fn extends Qr{constructor(t,e){let r=!1;const n=[];t.forEach((t=>{t.dynamic&&(r=!0),n.push(t.type)}));super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[n]))})),Object.freeze(t)}encode(t,e){return rn(t,this.coders,e)}decode(t){return t.coerce(this.name,nn(t,this.coders))}}const Un=new y(Mr),jn=new RegExp(/^bytes([0-9]*)$/),Ln=new RegExp(/^(u?int)([0-9]*)$/);const zn=new class{constructor(t){gr(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new Xr(t.name);case"bool":return new sn(t.name);case"string":return new Dn(t.name);case"bytes":return new hn(t.name);case"array":return new on(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Fn((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new ln(t.name)}let e=t.type.match(Ln);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&Un.throwArgumentError("invalid "+e[1]+" bit length","param",t),new mn(r/8,"int"===e[1],t.name)}if(e=t.type.match(jn),e){let r=parseInt(e[1]);return(0===r||r>32)&&Un.throwArgumentError("invalid bytes length","param",t),new un(r,t.name)}return Un.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new Wr(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new Yr(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Or.from(t))));return new Fn(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Un.throwError("types/values length mismatch",y.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(Or.from(t)))),n=new Fn(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const n=t.map((t=>this._getCoder(Or.from(t))));return new Fn(n,"_").decode(this._getReader(k(e),r))}};function qn(t){return we(En(t))}const Vn=new y(Mr);class Hn extends kr{}class Gn extends kr{}class Kn extends kr{}class Zn extends kr{static isIndexed(t){return!(!t||!t._isIndexed)}}const Jn={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Qn(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class Yn{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,gr(this,"fragments",e.map((t=>Br.from(t))).filter((t=>null!=t))),gr(this,"_abiCoder",yr(new.target,"getAbiCoder")()),gr(this,"functions",{}),gr(this,"errors",{}),gr(this,"events",{}),gr(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void Vn.warn("duplicate definition - constructor"):void gr(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?Vn.warn("duplicate definition - "+r):e[r]=t})),this.deploy||gr(this,"deploy",Lr.from({payable:!1,type:"constructor"})),gr(this,"_isInterface",!0)}format(t){t||(t=Pr.full),t===Pr.sighash&&Vn.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===Pr.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return zn}static getAddress(t){return Pe(t)}static getSighash(t){return T(qn(t.format()),0,4)}static getEventTopic(t){return qn(t.format())}getFunction(t){if(S(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];Vn.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?Vn.throwArgumentError("no matching function","name",e):r.length>1&&Vn.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[zr.fromString(t).format()];return e||Vn.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(S(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];Vn.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?Vn.throwArgumentError("no matching event","name",e):r.length>1&&Vn.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[Dr.fromString(t).format()];return e||Vn.throwArgumentError("no matching event","signature",t),e}getError(t){if(S(t)){const e=yr(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}Vn.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?Vn.throwArgumentError("no matching error","name",e):r.length>1&&Vn.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[zr.fromString(t).format()];return e||Vn.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return yr(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),yr(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=k(e);return I(r.slice(0,4))!==this.getSighash(t)&&Vn.throwArgumentError(`data signature does not match error ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),I(M([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=k(e);return I(r.slice(0,4))!==this.getSighash(t)&&Vn.throwArgumentError(`data signature does not match function ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(M([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=k(e),n=null,i="",o=null,s=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=I(r.slice(0,4)),e=Jn[t];if(e)o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.signature,e.reason&&(n=o[0]),"Error"===s?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===s&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.format()}catch(t){}break}}return Vn.throwError("call revert exception"+i,y.errors.CALL_EXCEPTION,{method:t.format(),data:I(e),errorArgs:o,errorName:s,errorSignature:a,reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&Vn.throwError("too many arguments for "+t.format(),y.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?qn(e):"bytes"===t.type?we(I(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=qt.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),O(I(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?Vn.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>n(o,t)))):r.push(n(o,e)):null!=e&&Vn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&Vn.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(qn(s));else if("bytes"===t.type)r.push(we(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else n.push(t),i.push(s)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);S(r[0],32)&&r[0].toLowerCase()===e||Vn.throwError("fragment/topic mismatch",y.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(Or.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let s=null!=r?this._abiCoder.decode(n,M(r)):null,a=this._abiCoder.decode(i,e,!0),h=[],u=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==s)h[e]=new Zn({_isIndexed:!0,hash:null});else if(o[e])h[e]=new Zn({_isIndexed:!0,hash:s[l++]});else try{h[e]=s[l++]}catch(t){h[e]=t}else try{h[e]=a[u++]}catch(t){h[e]=t}if(t.name&&null==h[t.name]){const r=h[e];r instanceof Error?Object.defineProperty(h,t.name,{enumerable:!0,get:()=>{throw Qn(`property ${JSON.stringify(t.name)}`,r)}}):h[t.name]=r}}));for(let t=0;t<h.length;t++){const e=h[t];e instanceof Error&&Object.defineProperty(h,t,{enumerable:!0,get:()=>{throw Qn(`index ${t}`,e)}})}return Object.freeze(h)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new Gn({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:qt.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new Hn({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=I(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new Kn({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var Wn=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const Xn=new y("abstract-provider/5.6.1");class ti extends kr{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class ei{constructor(){Xn.checkAbstract(new.target,ei),gr(this,"_isProvider",!0)}getFeeData(){return Wn(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield vr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let r=null,n=null;return t&&t.baseFeePerGas&&(n=qt.from("1500000000"),r=t.baseFeePerGas.mul(2).add(n)),{maxFeePerGas:r,maxPriorityFeePerGas:n,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var ri=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const ni=new y("abstract-signer/5.6.2"),ii=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],oi=[y.errors.INSUFFICIENT_FUNDS,y.errors.NONCE_EXPIRED,y.errors.REPLACEMENT_UNDERPRICED];class si{constructor(){ni.checkAbstract(new.target,si),gr(this,"_isSigner",!0)}getBalance(t){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return ri(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield vr(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return ri(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield vr(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return ri(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return ri(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return ri(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===ii.indexOf(e)&&ni.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=wr(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&ni.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return ri(this,void 0,void 0,(function*(){const e=yield vr(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>ri(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&ni.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||ni.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):ni.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&ni.throwError("network does not support EIP-1559",y.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):ni.throwError("failed to get consistent fee data",y.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(oi.indexOf(t.code)>=0)throw t;return ni.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&ni.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield vr(e)}))}_checkProvider(t){this.provider||ni.throwError("missing provider",y.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class ai extends si{constructor(t,e){super(),gr(this,"address",t),gr(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{ni.throwError(t,y.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new ai(this.address,t)}}var hi=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)})),ui=li;function li(t,e){if(!t)throw new Error(e||"Assertion failed")}function ci(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function fi(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function di(t){return 1===t.length?"0"+t:t}function pi(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}li.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var mi={inherits:o((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):ci(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},toHex:function(t){for(var e="",r=0;r<t.length;r++)e+=di(t[r].toString(16));return e},htonl:fi,toHex32:function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=fi(i)),r+=pi(i.toString(16))}return r},zero2:di,zero8:pi,join32:function(t,e,r,n){var i=r-e;ui(i%4==0);for(var o=new Array(i/4),s=0,a=e;s<o.length;s++,a+=4){var h;h="big"===n?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=h>>>0}return o},split32:function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<<e|t>>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,r){return t+e+r>>>0},sum32_4:function(t,e,r,n){return t+e+r+n>>>0},sum32_5:function(t,e,r,n,i){return t+e+r+n+i>>>0},sum64:function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o<n?1:0)+r+i;t[e]=s>>>0,t[e+1]=o},sum64_hi:function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},sum64_lo:function(t,e,r,n){return e+n>>>0},sum64_4_hi:function(t,e,r,n,i,o,s,a){var h=0,u=e;return h+=(u=u+n>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+r+i+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},sum64_5_hi:function(t,e,r,n,i,o,s,a,h,u){var l=0,c=e;return l+=(c=c+n>>>0)<e?1:0,l+=(c=c+o>>>0)<o?1:0,l+=(c=c+a>>>0)<a?1:0,t+r+i+s+h+(l+=(c=c+u>>>0)<u?1:0)>>>0},sum64_5_lo:function(t,e,r,n,i,o,s,a,h,u){return e+n+o+a+u>>>0},rotr64_hi:function(t,e,r){return(e<<32-r|t>>>r)>>>0},rotr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0},shr64_hi:function(t,e,r){return t>>>r},shr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0}};function gi(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var yi=gi;gi.prototype.update=function(t,e){if(t=mi.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=mi.join32(t,0,t.length-r,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this},gi.prototype.digest=function(t){return this.update(this._pad()),ui(null===this.pending),this._digest(t)},gi.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n};var vi={BlockHash:yi},wi=mi.rotr32;var bi=function(t,e,r,n){return 0===t?_i(e,r,n):1===t||3===t?Ai(e,r,n):2===t?Ei(e,r,n):void 0};function _i(t,e,r){return t&e^~t&r}function Ei(t,e,r){return t&e^t&r^e&r}function Ai(t,e,r){return t^e^r}var ki=function(t){return wi(t,2)^wi(t,13)^wi(t,22)};var Mi=function(t){return wi(t,6)^wi(t,11)^wi(t,25)};var xi=function(t){return wi(t,7)^wi(t,18)^t>>>3};var Si=function(t){return wi(t,17)^wi(t,19)^t>>>10},Ni={ft_1:bi,ch32:_i,maj32:Ei,p32:Ai,s0_256:ki,s1_256:Mi,g0_256:xi,g1_256:Si},Ii=mi.rotl32,Ci=mi.sum32,Ti=mi.sum32_5,Pi=Ni.ft_1,Ri=vi.BlockHash,Oi=[1518500249,1859775393,2400959708,3395469782];function $i(){if(!(this instanceof $i))return new $i;Ri.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}mi.inherits($i,Ri);var Bi=$i;$i.blockSize=512,$i.outSize=160,$i.hmacStrength=80,$i.padLength=64,$i.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=Ii(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4];for(n=0;n<r.length;n++){var u=~~(n/20),l=Ti(Ii(i,5),Pi(u,o,s,a),h,r[n],Oi[u]);h=a,a=s,s=Ii(o,30),o=i,i=l}this.h[0]=Ci(this.h[0],i),this.h[1]=Ci(this.h[1],o),this.h[2]=Ci(this.h[2],s),this.h[3]=Ci(this.h[3],a),this.h[4]=Ci(this.h[4],h)},$i.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")};var Di=mi.sum32,Fi=mi.sum32_4,Ui=mi.sum32_5,ji=Ni.ch32,Li=Ni.maj32,zi=Ni.s0_256,qi=Ni.s1_256,Vi=Ni.g0_256,Hi=Ni.g1_256,Gi=vi.BlockHash,Ki=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Zi(){if(!(this instanceof Zi))return new Zi;Gi.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Ki,this.W=new Array(64)}mi.inherits(Zi,Gi);var Ji=Zi;function Qi(){if(!(this instanceof Qi))return new Qi;Ji.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Zi.blockSize=512,Zi.outSize=256,Zi.hmacStrength=192,Zi.padLength=64,Zi.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=Fi(Hi(r[n-2]),r[n-7],Vi(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4],u=this.h[5],l=this.h[6],c=this.h[7];for(ui(this.k.length===r.length),n=0;n<r.length;n++){var f=Ui(c,qi(h),ji(h,u,l),this.k[n],r[n]),d=Di(zi(i),Li(i,o,s));c=l,l=u,u=h,h=Di(a,f),a=s,s=o,o=i,i=Di(f,d)}this.h[0]=Di(this.h[0],i),this.h[1]=Di(this.h[1],o),this.h[2]=Di(this.h[2],s),this.h[3]=Di(this.h[3],a),this.h[4]=Di(this.h[4],h),this.h[5]=Di(this.h[5],u),this.h[6]=Di(this.h[6],l),this.h[7]=Di(this.h[7],c)},Zi.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")},mi.inherits(Qi,Ji);var Yi=Qi;Qi.blockSize=512,Qi.outSize=224,Qi.hmacStrength=192,Qi.padLength=64,Qi.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h.slice(0,7),"big"):mi.split32(this.h.slice(0,7),"big")};var Wi=mi.rotr64_hi,Xi=mi.rotr64_lo,to=mi.shr64_hi,eo=mi.shr64_lo,ro=mi.sum64,no=mi.sum64_hi,io=mi.sum64_lo,oo=mi.sum64_4_hi,so=mi.sum64_4_lo,ao=mi.sum64_5_hi,ho=mi.sum64_5_lo,uo=vi.BlockHash,lo=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function co(){if(!(this instanceof co))return new co;uo.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=lo,this.W=new Array(160)}mi.inherits(co,uo);var fo=co;function po(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function mo(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function go(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function yo(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function vo(t,e){var r=Wi(t,e,28)^Wi(e,t,2)^Wi(e,t,7);return r<0&&(r+=4294967296),r}function wo(t,e){var r=Xi(t,e,28)^Xi(e,t,2)^Xi(e,t,7);return r<0&&(r+=4294967296),r}function bo(t,e){var r=Wi(t,e,14)^Wi(t,e,18)^Wi(e,t,9);return r<0&&(r+=4294967296),r}function _o(t,e){var r=Xi(t,e,14)^Xi(t,e,18)^Xi(e,t,9);return r<0&&(r+=4294967296),r}function Eo(t,e){var r=Wi(t,e,1)^Wi(t,e,8)^to(t,e,7);return r<0&&(r+=4294967296),r}function Ao(t,e){var r=Xi(t,e,1)^Xi(t,e,8)^eo(t,e,7);return r<0&&(r+=4294967296),r}function ko(t,e){var r=Wi(t,e,19)^Wi(e,t,29)^to(t,e,6);return r<0&&(r+=4294967296),r}function Mo(t,e){var r=Xi(t,e,19)^Xi(e,t,29)^eo(t,e,6);return r<0&&(r+=4294967296),r}function xo(){if(!(this instanceof xo))return new xo;fo.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}co.blockSize=1024,co.outSize=512,co.hmacStrength=192,co.padLength=128,co.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=ko(r[n-4],r[n-3]),o=Mo(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],h=Eo(r[n-30],r[n-29]),u=Ao(r[n-30],r[n-29]),l=r[n-32],c=r[n-31];r[n]=oo(i,o,s,a,h,u,l,c),r[n+1]=so(i,o,s,a,h,u,l,c)}},co.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],h=this.h[5],u=this.h[6],l=this.h[7],c=this.h[8],f=this.h[9],d=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],v=this.h[15];ui(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var b=y,_=v,E=bo(c,f),A=_o(c,f),k=po(c,f,d,p,m),M=mo(c,f,d,p,m,g),x=this.k[w],S=this.k[w+1],N=r[w],I=r[w+1],C=ao(b,_,E,A,k,M,x,S,N,I),T=ho(b,_,E,A,k,M,x,S,N,I);b=vo(n,i),_=wo(n,i),E=go(n,i,o,s,a),A=yo(n,i,o,s,a,h);var P=no(b,_,E,A),R=io(b,_,E,A);y=m,v=g,m=d,g=p,d=c,p=f,c=no(u,l,C,T),f=io(l,l,C,T),u=a,l=h,a=o,h=s,o=n,s=i,n=no(C,T,P,R),i=io(C,T,P,R)}ro(this.h,0,n,i),ro(this.h,2,o,s),ro(this.h,4,a,h),ro(this.h,6,u,l),ro(this.h,8,c,f),ro(this.h,10,d,p),ro(this.h,12,m,g),ro(this.h,14,y,v)},co.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")},mi.inherits(xo,fo);var So=xo;xo.blockSize=1024,xo.outSize=384,xo.hmacStrength=192,xo.padLength=128,xo.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h.slice(0,12),"big"):mi.split32(this.h.slice(0,12),"big")};var No={sha1:Bi,sha224:Yi,sha256:Ji,sha384:So,sha512:fo},Io=mi.rotl32,Co=mi.sum32,To=mi.sum32_3,Po=mi.sum32_4,Ro=vi.BlockHash;function Oo(){if(!(this instanceof Oo))return new Oo;Ro.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}mi.inherits(Oo,Ro);var $o=Oo;function Bo(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function Do(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Fo(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}Oo.blockSize=512,Oo.outSize=160,Oo.hmacStrength=192,Oo.padLength=64,Oo.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],o=this.h[3],s=this.h[4],a=r,h=n,u=i,l=o,c=s,f=0;f<80;f++){var d=Co(Io(Po(r,Bo(f,n,i,o),t[Uo[f]+e],Do(f)),Lo[f]),s);r=s,s=o,o=Io(i,10),i=n,n=d,d=Co(Io(Po(a,Bo(79-f,h,u,l),t[jo[f]+e],Fo(f)),zo[f]),c),a=c,c=l,l=Io(u,10),u=h,h=d}d=To(this.h[1],i,l),this.h[1]=To(this.h[2],o,c),this.h[2]=To(this.h[3],s,a),this.h[3]=To(this.h[4],r,h),this.h[4]=To(this.h[0],n,u),this.h[0]=d},Oo.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"little"):mi.split32(this.h,"little")};var Uo=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],jo=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Lo=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],zo=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],qo={ripemd160:$o};function Vo(t,e,r){if(!(this instanceof Vo))return new Vo(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(mi.toArray(e,r))}var Ho=Vo;Vo.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),ui(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Vo.prototype.update=function(t,e){return this.inner.update(t,e),this},Vo.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};var Go=o((function(t,e){var r=e;r.utils=mi,r.common=vi,r.sha=No,r.ripemd=qo,r.hmac=Ho,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}));function Ko(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}var Zo=Jo;function Jo(t,e){if(!t)throw new Error(e||"Assertion failed")}Jo.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Qo=Ko((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Yo=Ko((function(t,e){var r=e;r.assert=Zo,r.toArray=Qo.toArray,r.zero2=Qo.zero2,r.toHex=Qo.toHex,r.encode=Qo.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,h=o.andln(i-1);o.isOdd()?(a=h>(i>>1)-1?(i>>1)-h:h,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,h=t.andln(3)+i&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==h?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new hi(t,"hex","le")}})),Wo=Yo.getNAF,Xo=Yo.getJSF,ts=Yo.assert;function es(t,e){this.type=t,this.p=new hi(e.p,16),this.red=e.prime?hi.red(e.prime):hi.mont(this.p),this.zero=new hi(0).toRed(this.red),this.one=new hi(1).toRed(this.red),this.two=new hi(2).toRed(this.red),this.n=e.n&&new hi(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var rs=es;function ns(t,e){this.curve=t,this.type=e,this.precomputed=null}es.prototype.point=function(){throw new Error("Not implemented")},es.prototype.validate=function(){throw new Error("Not implemented")},es.prototype._fixedNafMul=function(t,e){ts(t.precomputed);var r=t._getDoubles(),n=Wo(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<n.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+n[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o<a.length;o++)(s=a[o])===c?l=l.mixedAdd(r.points[o]):s===-c&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},es.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Wo(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];ts(0!==u),s="affine"===t.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},es.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,c=0;for(o=0;o<n;o++){var f=(a=e[o])._getNAFPoints(t);h[o]=f.wnd,u[o]=f.points}for(o=n-1;o>=1;o-=2){var d=o-1,p=o;if(1===h[d]&&1===h[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Xo(r[d],r[p]);for(c=Math.max(y[0].length,c),l[d]=new Array(c),l[p]=new Array(c),s=0;s<c;s++){var v=0|y[0][s],w=0|y[1][s];l[d][s]=g[3*(v+1)+(w+1)],l[p][s]=0,u[d]=m}}else l[d]=Wo(r[d],h[d],this._bitLength),l[p]=Wo(r[p],h[p],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[p].length,c)}var b=this.jpoint(null,null,null),_=this._wnafT4;for(o=c;o>=0;o--){for(var E=0;o>=0;){var A=!0;for(s=0;s<n;s++)_[s]=0|l[s][o],0!==_[s]&&(A=!1);if(!A)break;E++,o--}if(o>=0&&E++,b=b.dblp(E),o<0)break;for(s=0;s<n;s++){var k=_[s];0!==k&&(k>0?a=u[s][k-1>>1]:k<0&&(a=u[s][-k-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(o=0;o<n;o++)u[o]=null;return i?b:b.toP()},es.BasePoint=ns,ns.prototype.eq=function(){throw new Error("Not implemented")},ns.prototype.validate=function(){return this.curve.validate(this)},es.prototype.decodePoint=function(t,e){t=Yo.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?ts(t[t.length-1]%2==0):7===t[0]&&ts(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},ns.prototype.encodeCompressed=function(t){return this.encode(t,!0)},ns.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},ns.prototype.encode=function(t,e){return Yo.encode(this._encode(e),t)},ns.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},ns.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},ns.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},ns.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},ns.prototype._getBeta=function(){return null},ns.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var is=Ko((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),os=Yo.assert;function ss(t){rs.call(this,"short",t),this.a=new hi(t.a,16).toRed(this.red),this.b=new hi(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}is(ss,rs);var as=ss;function hs(t,e,r,n){rs.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new hi(e,16),this.y=new hi(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function us(t,e,r,n){rs.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new hi(0)):(this.x=new hi(e,16),this.y=new hi(r,16),this.z=new hi(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ss.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new hi(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new hi(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],os(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new hi(t.a,16),b:new hi(t.b,16)}})):this._getEndoBasis(r)}}},ss.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:hi.mont(t),r=new hi(2).toRed(e).redInvm(),n=r.redNeg(),i=new hi(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},ss.prototype._getEndoBasis=function(t){for(var e,r,n,i,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=t,f=this.n.clone(),d=new hi(1),p=new hi(0),m=new hi(0),g=new hi(1),y=0;0!==c.cmpn(0);){var v=f.div(c);h=f.sub(v.mul(c)),u=m.sub(v.mul(d));var w=g.sub(v.mul(p));if(!n&&h.cmp(l)<0)e=a.neg(),r=d,n=h.neg(),i=u;else if(n&&2==++y)break;a=h,f=c,c=h,m=d,d=u,g=p,p=w}o=h.neg(),s=u;var b=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(b)>=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},ss.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),h=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},ss.prototype.pointFromX=function(t,e){(t=new hi(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},ss.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},ss.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),n[2*o]=a,n[2*o+1]=h,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,n,i,2*o,r),l=0;l<2*o;l++)n[l]=null,i[l]=null;return u},is(hs,rs.BasePoint),ss.prototype.point=function(t,e,r){return new hs(this,t,e,r)},ss.prototype.pointFromJSON=function(t,e){return hs.fromJSON(this,t,e)},hs.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},hs.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},hs.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},hs.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},hs.prototype.isInfinity=function(){return this.inf},hs.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},hs.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},hs.prototype.getX=function(){return this.x.fromRed()},hs.prototype.getY=function(){return this.y.fromRed()},hs.prototype.mul=function(t){return t=new hi(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},hs.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},hs.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},hs.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},hs.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},hs.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},is(us,rs.BasePoint),ss.prototype.jpoint=function(t,e,r){return new us(this,t,e,r)},us.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},us.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},us.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=n.redMul(u),f=h.redSqr().redIAdd(l).redISub(c).redISub(c),d=h.redMul(c.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},us.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),c=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(c)).redISub(i.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},us.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),c=u.redSqr(),f=c.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(h)),p=o.redMul(c),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=d.redMul(g);y=y.redIAdd(y).redISub(f);var v=u.redMul(a);e+1<t&&(h=h.redMul(f)),o=m,a=v,u=y}return this.curve.jpoint(o,u.redMul(i),a)},us.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},us.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),c=this.y.redSqr(),f=c.redSqr(),d=this.x.redAdd(c).redSqr().redISub(l).redISub(f);d=d.redIAdd(d);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=f.redIAdd(f);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},us.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),c=this.y.redSqr(),f=this.x.redMul(c),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var p=f.redIAdd(f),m=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(l);var g=c.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},us.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),c=u.redISub(l),f=s.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=a.redMul(c).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,d,p)},us.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=n.redIAdd(n);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var c=this.x.redMul(a).redISub(l);c=(c=c.redIAdd(c)).redIAdd(c);var f=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,f,d)},us.prototype.mul=function(t,e){return t=new hi(t,e),this.curve._wnafMul(this,t)},us.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},us.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},us.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},us.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ls=Ko((function(t,e){var r=e;r.base=rs,r.short=as,r.mont=null,r.edwards=null})),cs=Ko((function(t,e){var r,n=e,i=Yo.assert;function o(t){"short"===t.type?this.curve=new ls.short(t):"edwards"===t.type?this.curve=new ls.edwards(t):this.curve=new ls.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Go.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Go.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Go.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Go.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Go.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Go.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Go.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Go.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function fs(t){if(!(this instanceof fs))return new fs(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Qo.toArray(t.entropy,t.entropyEnc||"hex"),r=Qo.toArray(t.nonce,t.nonceEnc||"hex"),n=Qo.toArray(t.pers,t.persEnc||"hex");Zo(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var ds=fs;fs.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},fs.prototype._hmac=function(){return new Go.hmac(this.hash,this.K)},fs.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},fs.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=Qo.toArray(t,e),r=Qo.toArray(r,n),Zo(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},fs.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Qo.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(r),this._reseed++,Qo.encode(o,e)};var ps=Yo.assert;function ms(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var gs=ms;ms.fromPublic=function(t,e,r){return e instanceof ms?e:new ms(t,{pub:e,pubEnc:r})},ms.fromPrivate=function(t,e,r){return e instanceof ms?e:new ms(t,{priv:e,privEnc:r})},ms.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},ms.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},ms.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},ms.prototype._importPrivate=function(t,e){this.priv=new hi(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},ms.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?ps(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||ps(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},ms.prototype.derive=function(t){return t.validate()||ps(t.validate(),"public point not validated"),t.mul(this.priv).getX()},ms.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},ms.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},ms.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var ys=Yo.assert;function vs(t,e){if(t instanceof vs)return t;this._importDER(t,e)||(ys(t.r&&t.s,"Signature without r or s"),this.r=new hi(t.r,16),this.s=new hi(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ws=vs;function bs(){this.place=0}function _s(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function Es(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function As(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}vs.prototype._importDER=function(t,e){t=Yo.toArray(t,e);var r=new bs;if(48!==t[r.place++])return!1;var n=_s(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=_s(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=_s(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new hi(o),this.s=new hi(a),this.recoveryParam=null,!0},vs.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Es(e),r=Es(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];As(n,e.length),(n=n.concat(e)).push(2),As(n,r.length);var i=n.concat(r),o=[48];return As(o,i.length),o=o.concat(i),Yo.encode(o,t)};var ks=function(){throw new Error("unsupported")},Ms=Yo.assert;function xs(t){if(!(this instanceof xs))return new xs(t);"string"==typeof t&&(Ms(Object.prototype.hasOwnProperty.call(cs,t),"Unknown curve "+t),t=cs[t]),t instanceof cs.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Ss=xs;xs.prototype.keyPair=function(t){return new gs(this,t)},xs.prototype.keyFromPrivate=function(t,e){return gs.fromPrivate(this,t,e)},xs.prototype.keyFromPublic=function(t,e){return gs.fromPublic(this,t,e)},xs.prototype.genKeyPair=function(t){t||(t={});for(var e=new ds({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||ks(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new hi(2));;){var i=new hi(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},xs.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},xs.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new hi(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new ds({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new hi(1)),u=0;;u++){var l=n.k?n.k(u):new hi(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var c=this.g.mul(l);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new ws({r:d,s:p,recoveryParam:m})}}}}}},xs.prototype.verify=function(t,e,r,n){t=this._truncateToN(new hi(t,16)),r=this.keyFromPublic(r,n);var i=(e=new ws(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),h=a.mul(t).umod(this.n),u=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},xs.prototype.recoverPubKey=function(t,e,r,n){Ms((3&r)===r,"The recovery param is more than two bits"),e=new ws(e,n);var i=this.n,o=new hi(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(i),c=i.sub(o).mul(l).umod(i),f=a.mul(l).umod(i);return this.g.mulAdd(c,s,f)},xs.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new ws(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Ns=Ko((function(t,e){var r=e;r.version="6.5.4",r.utils=Yo,r.rand=function(){throw new Error("unsupported")},r.curve=ls,r.curves=cs,r.ec=Ss,r.eddsa=null})).ec;const Is=new y("signing-key/5.6.2");let Cs=null;function Ts(){return Cs||(Cs=new Ns("secp256k1")),Cs}class Ps{constructor(t){gr(this,"curve","secp256k1"),gr(this,"privateKey",I(t)),32!==C(this.privateKey)&&Is.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=Ts().keyFromPrivate(k(this.privateKey));gr(this,"publicKey","0x"+e.getPublic(!1,"hex")),gr(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),gr(this,"_isSigningKey",!0)}_addPoint(t){const e=Ts().keyFromPublic(k(this.publicKey)),r=Ts().keyFromPublic(k(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Ts().keyFromPrivate(k(this.privateKey)),r=k(t);32!==r.length&&Is.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return $({recoveryParam:n.recoveryParam,r:O("0x"+n.r.toString(16),32),s:O("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=Ts().keyFromPrivate(k(this.privateKey)),r=Ts().keyFromPublic(k(Rs(t)));return O("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Rs(t,e){const r=k(t);if(32===r.length){const t=new Ps(r);return e?"0x"+Ts().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?I(r):"0x"+Ts().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Ts().keyFromPublic(r).getPublic(!0,"hex"):I(r):Is.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Os=new y("transactions/5.6.2");var $s;function Bs(t){return"0x"===t?null:Pe(t)}function Ds(t){return"0x"===t?fn:qt.from(t)}function Fs(t,e){return function(t){return Pe(T(we(T(Rs(t),1)),12))}(function(t,e){const r=$(e),n={r:k(r.r),s:k(r.s)};return"0x"+Ts().recoverPubKey(k(t),n,r.recoveryParam).encode("hex",!1)}(k(t),e))}function Us(t,e){const r=x(qt.from(t).toHexString());return r.length>32&&Os.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function js(t,e){return{address:Pe(t),storageKeys:(e||[]).map(((e,r)=>(32!==C(e)&&Os.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function Ls(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&Os.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),js(t[0],t[1])):js(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return js(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function zs(t){return Ls(t).map((t=>[t.address,t.storageKeys]))}function qs(t,e){if(null!=t.gasPrice){const e=qt.from(t.gasPrice),r=qt.from(t.maxFeePerGas||0);e.eq(r)||Os.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[Us(t.chainId||0,"chainId"),Us(t.nonce||0,"nonce"),Us(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Us(t.maxFeePerGas||0,"maxFeePerGas"),Us(t.gasLimit||0,"gasLimit"),null!=t.to?Pe(t.to):"0x",Us(t.value||0,"value"),t.data||"0x",zs(t.accessList||[])];if(e){const t=$(e);r.push(Us(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return P(["0x02",ke(r)])}function Vs(t,e){const r=[Us(t.chainId||0,"chainId"),Us(t.nonce||0,"nonce"),Us(t.gasPrice||0,"gasPrice"),Us(t.gasLimit||0,"gasLimit"),null!=t.to?Pe(t.to):"0x",Us(t.value||0,"value"),t.data||"0x",zs(t.accessList||[])];if(e){const t=$(e);r.push(Us(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return P(["0x01",ke(r)])}function Hs(t,e,r){try{const r=Ds(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){Os.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=O(e[1],32),t.s=O(e[2],32);try{const e=we(r(t));t.from=Fs(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function Gs(t){const e=k(t);if(e[0]>127)return function(t){const e=Se(t);9!==e.length&&6!==e.length&&Os.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:Ds(e[0]).toNumber(),gasPrice:Ds(e[1]),gasLimit:Ds(e[2]),to:Bs(e[3]),value:Ds(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=qt.from(e[6]).toNumber()}catch(t){return r}if(r.r=O(e[7],32),r.s=O(e[8],32),qt.from(r.r).isZero()&&qt.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);0!==r.chainId&&(i.push(I(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=we(ke(i));try{r.from=Fs(o,{r:I(r.r),s:I(r.s),recoveryParam:n})}catch(t){}r.hash=we(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=Se(t.slice(1));8!==e.length&&11!==e.length&&Os.throwArgumentError("invalid component count for transaction type: 1","payload",I(t));const r={type:1,chainId:Ds(e[0]).toNumber(),nonce:Ds(e[1]).toNumber(),gasPrice:Ds(e[2]),gasLimit:Ds(e[3]),to:Bs(e[4]),value:Ds(e[5]),data:e[6],accessList:Ls(e[7])};return 8===e.length||(r.hash=we(t),Hs(r,e.slice(8),Vs)),r}(e);case 2:return function(t){const e=Se(t.slice(1));9!==e.length&&12!==e.length&&Os.throwArgumentError("invalid component count for transaction type: 2","payload",I(t));const r=Ds(e[2]),n=Ds(e[3]),i={type:2,chainId:Ds(e[0]).toNumber(),nonce:Ds(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Ds(e[4]),to:Bs(e[5]),value:Ds(e[6]),data:e[7],accessList:Ls(e[8])};return 9===e.length||(i.hash=we(t),Hs(i,e.slice(9),qs)),i}(e)}return Os.throwError(`unsupported transaction type: ${e[0]}`,y.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}($s||($s={}));var Ks=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const Zs=new y("contracts/5.6.2");function Js(t,e){return Ks(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&Zs.throwArgumentError("invalid address or ENS name","name",r);try{return Pe(r)}catch(t){}t||Zs.throwError("a provider or signer is needed to resolve ENS names",y.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return null==n&&Zs.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function Qs(t,e,r){return Ks(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>Qs(t,Array.isArray(e)?e[n]:e[r.name],r)))):"address"===r.type?yield Js(t,e):"tuple"===r.type?yield Qs(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>Qs(t,e,r.arrayChildren)))):Promise.reject(Zs.makeError("invalid value for array",y.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function Ys(t,e,r){return Ks(this,void 0,void 0,(function*(){let n={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=wr(r.pop())),Zs.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=vr({override:Js(t.signer,n.from),signer:t.signer.getAddress()}).then((t=>Ks(this,void 0,void 0,(function*(){return Pe(t.signer)!==t.override&&Zs.throwError("Contract with a Signer cannot override from",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):n.from=t.signer.getAddress():n.from&&(n.from=Js(t.provider,n.from));const i=yield vr({args:Qs(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:vr(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=qt.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=qt.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=qt.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=qt.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=qt.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=Ls(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=k(o);for(let e=0;e<r.length;e++)t+=4,r[e]&&(t+=64);s.gasLimit=qt.from(e.gas).add(t)}if(a.value){const t=qt.from(a.value);t.isZero()||e.payable||Zs.throwError("non-payable method cannot override value",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),s.value=t}a.customData&&(s.customData=wr(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const h=Object.keys(n).filter((t=>null!=n[t]));return h.length&&Zs.throwError(`cannot override ${h.map((t=>JSON.stringify(t))).join(",")}`,y.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:h}),s}))}function Ws(t,e,r){const n=t.signer||t.provider;return function(...i){return Ks(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=wr(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield Ys(t,e,i),a=yield n.call(s,o);try{let n=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(n=n[0]),n}catch(e){throw e.code===y.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=s),e}}))}}function Xs(t,e){return function(...r){return Ks(this,void 0,void 0,(function*(){t.signer||Zs.throwError("sending a transaction requires a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const n=yield Ys(t,e,r),i=yield t.signer.sendTransaction(n);return function(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let n=Ar(r),i=null;try{i=t.interface.parseLog(r)}catch(t){}return i&&(n.args=i.args,n.decode=(e,r)=>t.interface.decodeEventLog(i.eventFragment,e,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>t.provider,n.getBlock=()=>t.provider.getBlock(e.blockHash),n.getTransaction=()=>t.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(e),n})),e)))}(t,i),i}))}}function ta(t,e,r){return e.constant?Ws(t,e,r):Xs(t,e)}function ea(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class ra{constructor(t,e){gr(this,"tag",t),gr(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t)||(e=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class na extends ra{constructor(){super("error",null)}}class ia extends ra{constructor(t,e,r,n){const i={address:t};let o=e.getEventTopic(r);n?(o!==n[0]&&Zs.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(ea(i),i),gr(this,"address",t),gr(this,"interface",e),gr(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class oa extends ra{constructor(t,e){super("*",{address:t}),gr(this,"address",t),gr(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class sa extends class{constructor(t,e,r){gr(this,"interface",yr(new.target,"getInterface")(e)),null==r?(gr(this,"provider",null),gr(this,"signer",null)):si.isSigner(r)?(gr(this,"provider",r.provider||null),gr(this,"signer",r)):ei.isProvider(r)?(gr(this,"provider",r),gr(this,"signer",null)):Zs.throwArgumentError("invalid signer or provider","signerOrProvider",r),gr(this,"callStatic",{}),gr(this,"estimateGas",{}),gr(this,"functions",{}),gr(this,"populateTransaction",{}),gr(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];gr(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?gr(this.filters,e,this.filters[r[0]]):Zs.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if(gr(this,"_runningEvents",{}),gr(this,"_wrappedEmits",{}),null==t&&Zs.throwArgumentError("invalid contract address or ENS name","addressOrName",t),gr(this,"address",t),this.provider)gr(this,"resolvedAddress",Js(this.provider,t));else try{gr(this,"resolvedAddress",Promise.resolve(Pe(t)))}catch(t){Zs.throwError("provider is required to use ENS name as contract address",y.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])Zs.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const r=e.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(t)}null==this[t]&&gr(this,t,ta(this,e,!0)),null==this.functions[t]&&gr(this.functions,t,ta(this,e,!1)),null==this.callStatic[t]&&gr(this.callStatic,t,Ws(this,e,!0)),null==this.populateTransaction[t]&&gr(this.populateTransaction,t,function(t,e){return function(...r){return Ys(t,e,r)}}(this,e)),null==this.estimateGas[t]&&gr(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...n){return Ks(this,void 0,void 0,(function*(){r||Zs.throwError("estimate require a provider or signer",y.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Ys(t,e,n);return yield r.estimateGas(i)}))}}(this,e))}})),Object.keys(n).forEach((t=>{const e=n[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&gr(this,t,this[r])}catch(t){}null==this.functions[t]&&gr(this.functions,t,this.functions[r]),null==this.callStatic[t]&&gr(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&gr(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&gr(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return Oe(t)}static getInterface(t){return Yn.isInterface(t)?t:new Yn(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&Zs.throwError("contract not deployed",y.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||Zs.throwError("sending a transactions require a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=wr(t||{});return["from","to"].forEach((function(t){null!=e[t]&&Zs.throwError("cannot override "+t,y.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new ai(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&gr(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return Zn.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new na);if("event"===t)return this._normalizeRunningEvent(new ra("event",null));if("*"===t)return this._normalizeRunningEvent(new oa(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new ia(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new ia(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new ra(ea(e),e))}return this._normalizeRunningEvent(new oa(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const n=Ar(e);return n.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},n.getBlock=()=>this.provider.getBlock(e.blockHash),n.getTransaction=()=>this.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(n),n}_addEventListener(t,e,r){if(this.provider||Zs.throwError("events require a provider or a signer with a provider",y.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let n=this._wrapEvent(t,r,e);if(null==n.decodeError)try{const e=t.getEmit(n);this.emit(t.filter,...e)}catch(t){n.decodeError=t.error}null!=t.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const n=this._getRunningEvent(t),i=wr(n.filter);return"string"==typeof e&&S(e,32)?(null!=r&&Zs.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(n,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),n=r.run(e)>0;return this._checkRunningEvents(r),n}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}{}var aa=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));let ha=!1,ua=!1;const la={debug:1,default:2,info:2,warning:3,error:4,off:5};let ca=la.default,fa=null;const da=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 pa,ma;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(pa||(pa={})),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",t.ACTION_REJECTED="ACTION_REJECTED"}(ma||(ma={}));const ga="0123456789abcdef";class ya{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==la[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ca>la[r]||console.log.apply(console,e)}debug(...t){this._log(ya.levels.DEBUG,t)}info(...t){this._log(ya.levels.INFO,t)}warn(...t){this._log(ya.levels.WARNING,t)}makeError(t,e,r){if(ua)return this.makeError("censored error",e,{});e||(e=ya.errors.UNKNOWN_ERROR),r||(r={});const n=[];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+=ga[e[t]>>4],r+=ga[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case ma.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 ma.CALL_EXCEPTION:case ma.INSUFFICIENT_FUNDS:case ma.MISSING_NEW:case ma.NONCE_EXPIRED:case ma.REPLACEMENT_UNDERPRICED:case ma.TRANSACTION_REPLACED:case ma.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ya.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){da&&this.throwError("platform missing String.prototype.normalize",ya.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:da})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ya.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ya.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,ya.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,ya.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ya.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",ya.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ya.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return fa||(fa=new ya("logger/5.7.0")),fa}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ya.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ha){if(!t)return;this.globalLogger().throwError("error censorship permanent",ya.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ua=!!t,ha=!!e}static setLogLevel(t){const e=la[t.toLowerCase()];null!=e?ca=e:ya.globalLogger().warn("invalid log level - "+t)}static from(t){return new ya(t)}}ya.errors=ma,ya.levels=pa;const va=new ya("bytes/5.7.0");function wa(t){return!!t.toHexString}function ba(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return ba(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function _a(t){return"number"==typeof t&&t==t&&t%1==0}function Ea(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!_a(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!_a(r)||r<0||r>=256)return!1}return!0}function Aa(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const ka="0123456789abcdef";function Ma(t,e){if(e||(e={}),"number"==typeof t){va.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=ka[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),wa(t))return t.toHexString();if(Aa(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":va.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ea(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=ka[(240&n)>>4]+ka[15&n]}return e}return va.throwArgumentError("invalid hexlify value","value",t)}function xa(t,e){for("string"!=typeof t?t=Ma(t):Aa(t)||va.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&va.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const Sa="bignumber/5.7.0";var Na=aa.BN;const Ia=new ya(Sa),Ca={},Ta=9007199254740991;let Pa=!1;class Ra{constructor(t,e){t!==Ca&&Ia.throwError("cannot call constructor directly; use BigNumber.from",ya.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return $a(Ba(this).fromTwos(t))}toTwos(t){return $a(Ba(this).toTwos(t))}abs(){return"-"===this._hex[0]?Ra.from(this._hex.substring(1)):this}add(t){return $a(Ba(this).add(Ba(t)))}sub(t){return $a(Ba(this).sub(Ba(t)))}div(t){return Ra.from(t).isZero()&&Da("division-by-zero","div"),$a(Ba(this).div(Ba(t)))}mul(t){return $a(Ba(this).mul(Ba(t)))}mod(t){const e=Ba(t);return e.isNeg()&&Da("division-by-zero","mod"),$a(Ba(this).umod(e))}pow(t){const e=Ba(t);return e.isNeg()&&Da("negative-power","pow"),$a(Ba(this).pow(e))}and(t){const e=Ba(t);return(this.isNegative()||e.isNeg())&&Da("unbound-bitwise-result","and"),$a(Ba(this).and(e))}or(t){const e=Ba(t);return(this.isNegative()||e.isNeg())&&Da("unbound-bitwise-result","or"),$a(Ba(this).or(e))}xor(t){const e=Ba(t);return(this.isNegative()||e.isNeg())&&Da("unbound-bitwise-result","xor"),$a(Ba(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Da("negative-width","mask"),$a(Ba(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Da("negative-width","shl"),$a(Ba(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Da("negative-width","shr"),$a(Ba(this).shrn(t))}eq(t){return Ba(this).eq(Ba(t))}lt(t){return Ba(this).lt(Ba(t))}lte(t){return Ba(this).lte(Ba(t))}gt(t){return Ba(this).gt(Ba(t))}gte(t){return Ba(this).gte(Ba(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ba(this).isZero()}toNumber(){try{return Ba(this).toNumber()}catch(t){Da("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ia.throwError("this platform does not support BigInt",ya.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Pa||(Pa=!0,Ia.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ia.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ya.errors.UNEXPECTED_ARGUMENT,{}):Ia.throwError("BigNumber.toString does not accept parameters",ya.errors.UNEXPECTED_ARGUMENT,{})),Ba(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ra)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ra(Ca,Oa(t)):t.match(/^-?[0-9]+$/)?new Ra(Ca,Oa(new Na(t))):Ia.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Da("underflow","BigNumber.from",t),(t>=Ta||t<=-Ta)&&Da("overflow","BigNumber.from",t),Ra.from(String(t));const e=t;if("bigint"==typeof e)return Ra.from(e.toString());if(Ea(e))return Ra.from(Ma(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ra.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Aa(t)||"-"===t[0]&&Aa(t.substring(1))))return Ra.from(t)}return Ia.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Oa(t){if("string"!=typeof t)return Oa(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ia.throwArgumentError("invalid hex","value",t),"0x00"===(t=Oa(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 $a(t){return Ra.from(Oa(t))}function Ba(t){const e=Ra.from(t).toHexString();return"-"===e[0]?new Na("-"+e.substring(3),16):new Na(e.substring(2),16)}function Da(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ia.throwError(t,ya.errors.NUMERIC_FAULT,n)}const Fa=new ya(Sa),Ua={},ja=Ra.from(0),La=Ra.from(-1);function za(t,e,r,n){const i={fault:e,operation:r};return void 0!==n&&(i.value=n),Fa.throwError(t,ya.errors.NUMERIC_FAULT,i)}let qa="0";for(;qa.length<256;)qa+=qa;function Va(t){if("number"!=typeof t)try{t=Ra.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+qa.substring(0,t):Fa.throwArgumentError("invalid decimal size","decimals",t)}function Ha(t,e){null==e&&(e=0);const r=Va(e),n=(t=Ra.from(t)).lt(ja);n&&(t=t.mul(La));let i=t.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=t.div(r).toString();return t=1===r.length?o:o+"."+i,n&&(t="-"+t),t}function Ga(t,e){null==e&&(e=0);const r=Va(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||Fa.throwArgumentError("invalid decimal value","value",t);const n="-"===t.substring(0,1);n&&(t=t.substring(1)),"."===t&&Fa.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&Fa.throwArgumentError("too many decimal points","value",t);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&za("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Ra.from(o),h=Ra.from(s);let u=a.mul(r).add(h);return n&&(u=u.mul(La)),u}class Ka{constructor(t,e,r,n){t!==Ua&&Fa.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ya.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=n,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=Va(n),Object.freeze(this)}static from(t){if(t instanceof Ka)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,n=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Fa.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(t){const i=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&Fa.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&Fa.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Fa.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Ka(Ua,e,r,n)}}class Za{constructor(t,e,r,n){t!==Ua&&Fa.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ya.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Fa.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Za.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(Ja.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Za.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(Ja.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Fa.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=Za.from("1"+qa.substring(0,t),this.format),n=Qa.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&Fa.throwArgumentError("invalid byte width","width",t);return xa(Ra.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return Za.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||function(t){return null!=t&&(Ra.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Aa(t)||"bigint"==typeof t||Ea(t))}(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),Za.fromString(Ha(t,e),Ka.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=Ka.from(e),n=Ga(t,r.decimals);!r.signed&&n.lt(ja)&&za("unsigned value cannot be negative","overflow","value",t);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=xa(i,r.width/8));const o=Ha(n,r.decimals);return new Za(Ua,i,o,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=Ka.from(e);if(function(t,e){if(e||(e={}),"number"==typeof t){va.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),ba(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wa(t)&&(t=t.toHexString()),Aa(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":va.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return ba(new Uint8Array(n))}return Ea(t)?ba(new Uint8Array(t)):va.throwArgumentError("invalid arrayify value","value",t)}(t).length>r.width/8)throw new Error("overflow");let n=Ra.from(t);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=Ha(n,r.decimals);return new Za(Ua,i,o,r)}static from(t,e){if("string"==typeof t)return Za.fromString(t,e);if(Ea(t))return Za.fromBytes(t,e);try{return Za.fromValue(t,0,e)}catch(t){if(t.code!==ya.errors.INVALID_ARGUMENT)throw t}return Fa.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Ja=Za.from(1),Qa=Za.from("0.5"),Ya=new ya("units/5.7.0"),Wa=["wei","kwei","mwei","gwei","szabo","finney","ether"];let Xa=!1,th=!1;const eh={debug:1,default:2,info:2,warning:3,error:4,off:5};let rh=eh.default,nh=null;const ih=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 oh,sh;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(oh||(oh={})),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",t.ACTION_REJECTED="ACTION_REJECTED"}(sh||(sh={}));const ah="0123456789abcdef";class hh{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==eh[r]&&this.throwArgumentError("invalid log level name","logLevel",t),rh>eh[r]||console.log.apply(console,e)}debug(...t){this._log(hh.levels.DEBUG,t)}info(...t){this._log(hh.levels.INFO,t)}warn(...t){this._log(hh.levels.WARNING,t)}makeError(t,e,r){if(th)return this.makeError("censored error",e,{});e||(e=hh.errors.UNKNOWN_ERROR),r||(r={});const n=[];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+=ah[e[t]>>4],r+=ah[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case sh.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 sh.CALL_EXCEPTION:case sh.INSUFFICIENT_FUNDS:case sh.MISSING_NEW:case sh.NONCE_EXPIRED:case sh.REPLACEMENT_UNDERPRICED:case sh.TRANSACTION_REPLACED:case sh.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,hh.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){ih&&this.throwError("platform missing String.prototype.normalize",hh.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ih})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,hh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,hh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,hh.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,hh.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",hh.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",hh.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",hh.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return nh||(nh=new hh("logger/5.7.0")),nh}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",hh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Xa){if(!t)return;this.globalLogger().throwError("error censorship permanent",hh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}th=!!t,Xa=!!e}static setLogLevel(t){const e=eh[t.toLowerCase()];null!=e?rh=e:hh.globalLogger().warn("invalid log level - "+t)}static from(t){return new hh(t)}}hh.errors=sh,hh.levels=oh;const uh=new hh("bytes/5.7.0");function lh(t){return!!t.toHexString}function ch(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return ch(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function fh(t){return"number"==typeof t&&t==t&&t%1==0}function dh(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!fh(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!fh(r)||r<0||r>=256)return!1}return!0}function ph(t,e){if(e||(e={}),"number"==typeof t){uh.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),ch(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),lh(t)&&(t=t.toHexString()),gh(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":uh.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return ch(new Uint8Array(n))}return dh(t)?ch(new Uint8Array(t)):uh.throwArgumentError("invalid arrayify value","value",t)}function mh(t){const e=t.map((t=>ph(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),ch(n)}function gh(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const yh="0123456789abcdef";function vh(t,e){if(e||(e={}),"number"==typeof t){uh.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=yh[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),lh(t))return t.toHexString();if(gh(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":uh.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(dh(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=yh[(240&n)>>4]+yh[15&n]}return e}return uh.throwArgumentError("invalid hexlify value","value",t)}function wh(t){let e="0x";return t.forEach((t=>{e+=vh(t).substring(2)})),e}function bh(t,e){for("string"!=typeof t?t=vh(t):gh(t)||uh.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&uh.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function _h(t){return"0x"+ve.keccak_256(ph(t))}var Eh=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Ah=Eh.BN;const kh=new hh("bignumber/5.7.0"),Mh={},xh=9007199254740991;let Sh=!1;class Nh{constructor(t,e){t!==Mh&&kh.throwError("cannot call constructor directly; use BigNumber.from",hh.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Ch(Th(this).fromTwos(t))}toTwos(t){return Ch(Th(this).toTwos(t))}abs(){return"-"===this._hex[0]?Nh.from(this._hex.substring(1)):this}add(t){return Ch(Th(this).add(Th(t)))}sub(t){return Ch(Th(this).sub(Th(t)))}div(t){return Nh.from(t).isZero()&&Ph("division-by-zero","div"),Ch(Th(this).div(Th(t)))}mul(t){return Ch(Th(this).mul(Th(t)))}mod(t){const e=Th(t);return e.isNeg()&&Ph("division-by-zero","mod"),Ch(Th(this).umod(e))}pow(t){const e=Th(t);return e.isNeg()&&Ph("negative-power","pow"),Ch(Th(this).pow(e))}and(t){const e=Th(t);return(this.isNegative()||e.isNeg())&&Ph("unbound-bitwise-result","and"),Ch(Th(this).and(e))}or(t){const e=Th(t);return(this.isNegative()||e.isNeg())&&Ph("unbound-bitwise-result","or"),Ch(Th(this).or(e))}xor(t){const e=Th(t);return(this.isNegative()||e.isNeg())&&Ph("unbound-bitwise-result","xor"),Ch(Th(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ph("negative-width","mask"),Ch(Th(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ph("negative-width","shl"),Ch(Th(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ph("negative-width","shr"),Ch(Th(this).shrn(t))}eq(t){return Th(this).eq(Th(t))}lt(t){return Th(this).lt(Th(t))}lte(t){return Th(this).lte(Th(t))}gt(t){return Th(this).gt(Th(t))}gte(t){return Th(this).gte(Th(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Th(this).isZero()}toNumber(){try{return Th(this).toNumber()}catch(t){Ph("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return kh.throwError("this platform does not support BigInt",hh.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Sh||(Sh=!0,kh.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?kh.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",hh.errors.UNEXPECTED_ARGUMENT,{}):kh.throwError("BigNumber.toString does not accept parameters",hh.errors.UNEXPECTED_ARGUMENT,{})),Th(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Nh)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Nh(Mh,Ih(t)):t.match(/^-?[0-9]+$/)?new Nh(Mh,Ih(new Ah(t))):kh.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ph("underflow","BigNumber.from",t),(t>=xh||t<=-xh)&&Ph("overflow","BigNumber.from",t),Nh.from(String(t));const e=t;if("bigint"==typeof e)return Nh.from(e.toString());if(dh(e))return Nh.from(vh(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Nh.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(gh(t)||"-"===t[0]&&gh(t.substring(1))))return Nh.from(t)}return kh.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Ih(t){if("string"!=typeof t)return Ih(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&kh.throwArgumentError("invalid hex","value",t),"0x00"===(t=Ih(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 Ch(t){return Nh.from(Ih(t))}function Th(t){const e=Nh.from(t).toHexString();return"-"===e[0]?new Ah("-"+e.substring(3),16):new Ah(e.substring(2),16)}function Ph(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),kh.throwError(t,hh.errors.NUMERIC_FAULT,n)}const Rh=new hh("strings/5.7.0");var Oh,$h;function Bh(t,e,r,n,i){if(t===$h.BAD_PREFIX||t===$h.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n<r.length&&r[n]>>6==2;n++)t++;return t}return t===$h.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Oh||(Oh={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}($h||($h={}));const Dh=Object.freeze({error:function(t,e,r,n,i){return Rh.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Bh,replace:function(t,e,r,n,i){return t===$h.OVERLONG?(n.push(i),0):(n.push(65533),Bh(t,e,r))}});function Fh(t,e){null==e&&(e=Dh.error),t=ph(t);const r=[];let n=0;for(;n<t.length;){const i=t[n++];if(i>>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?$h.UNEXPECTED_CONTINUE:$h.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e($h.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=t[n];if(128!=(192&i)){n+=e($h.MISSING_CONTINUE,n,t,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=e($h.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e($h.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e($h.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function Uh(t,e=Oh.current){e!=Oh.current&&(Rh.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return ph(r)}function jh(t,e){return Fh(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Lh(t){return _h(Uh(t))}const zh="hash/5.7.0";function qh(t,e){null==e&&(e=1);const r=[],n=r.forEach,i=function(t,e){n.call(t,(function(t){e>0&&Array.isArray(t)?i(t,e-1):r.push(t)}))};return i(t,e),r}function Vh(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let t=1;t<n;t++)o.push(i+=r());let s=r(),a=e;e+=s;let h=0,u=0;function l(){return 0==h&&(u=u<<8|t[e++],h=8),u>>--h&1}const c=Math.pow(2,31),f=c>>>1,d=f>>1,p=c-1;let m=0;for(let t=0;t<31;t++)m=m<<1|l();let g=[],y=0,v=c;for(;;){let t=Math.floor(((m-y+1)*i-1)/v),e=0,r=n;for(;r-e>1;){let n=e+r>>>1;t<o[n]?r=n:e=n}if(0==e)break;g.push(e);let s=y+Math.floor(v*o[e]/i),a=y+Math.floor(v*o[e+1]/i)-1;for(;0==((s^a)&f);)m=m<<1&p|l(),s=s<<1&p,a=a<<1&p|1;for(;s&~a&d;)m=m&f|m<<1&p>>>1|l(),s=s<<1^f,a=(a^f)<<1|f|1;y=s,v=1+a-s}let w=n-4;return g.map((e=>{switch(e-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return e-1}}))}(t))}function Hh(t){return 1&t?~t>>1:t>>1}function Gh(t,e){let r=Array(t);for(let n=0,i=-1;n<t;n++)r[n]=i+=1+e();return r}function Kh(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=Hh(e());return r}function Zh(t,e){let r=Gh(t(),t),n=t(),i=Gh(n,t),o=function(t,e){let r=Array(t);for(let n=0;n<t;n++)r[n]=1+e();return r}(n,t);for(let t=0;t<n;t++)for(let e=0;e<o[t];e++)r.push(i[t]+e);return e?r.map((t=>e[t])):r}function Jh(t,e,r){let n=Array(t).fill(void 0).map((()=>[]));for(let i=0;i<e;i++)Kh(t,r).forEach(((t,e)=>n[e].push(t)));return n}function Qh(t,e){let r=1+e(),n=e(),i=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return qh(Jh(i.length,1+t,e).map(((t,e)=>{const o=t[0],s=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*n;return[o+e*r,s.map((t=>t+i))]}))})))}function Yh(t,e){return Jh(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const Wh=Vh(function(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return ph(e)}("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Xh=new Set(Zh(Wh)),tu=new Set(Zh(Wh)),eu=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(Qh(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Yh(r,t))}return function(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[n[0]]=n[1]}return e}(qh(e))}(Wh),ru=function(t){let e=Zh(t).sort(((t,e)=>t-e));return function r(){let n=[];for(;;){let i=Zh(t,e);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(Wh);function nu(t){return function(t,e=Oh.current){return Fh(Uh(t,e))}(t)}function iu(t){return t.filter((t=>65039!=t))}function ou(t){for(let e of t.split(".")){let t=nu(e);try{for(let e=t.lastIndexOf(95)-1;e>=0;e--)if(95!==t[e])throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&45===t[2]&&45===t[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function su(t){return ou(function(t,e){let r=nu(t).reverse(),n=[];for(;r.length;){let t=au(r);if(t){n.push(...e(t));continue}let i=r.pop();if(Xh.has(i)){n.push(i);continue}if(tu.has(i))continue;let o=eu[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return ou(function(t){return t.normalize("NFC")}(String.fromCodePoint(...n)))}(t,iu))}function au(t,e){var r;let n,i,o=ru,s=[],a=t.length;for(e&&(e.length=0);a;){let h=t[--a];if(o=null===(r=o.branches.find((t=>t.set.has(h))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=h;else if(o.check&&h===i)break;s.push(h),o.fe0f&&(s.push(65039),a>0&&65039==t[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return n}const hu=new hh(zh),uu=new Uint8Array(32);function lu(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function cu(t){const e=Uh(su(t)),r=[];if(0===t.length)return r;let n=0;for(let t=0;t<e.length;t++){46===e[t]&&(r.push(lu(e.slice(n,t))),n=t+1)}if(n>=e.length)throw new Error("invalid ENS name; empty component");return r.push(lu(e.slice(n))),r}function fu(t){return cu(t).map((t=>jh(t))).join(".")}function du(t){"string"!=typeof t&&hu.throwArgumentError("invalid ENS name; not a string","name",t);let e=uu;const r=cu(t);for(;r.length;)e=_h(mh([e,_h(r.pop())]));return vh(e)}uu.fill(0);const pu=new hh("address/5.7.0");function mu(t){gh(t,20)||pu.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=ph(_h(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const gu={};for(let t=0;t<10;t++)gu[String(t)]=String(t);for(let t=0;t<26;t++)gu[String.fromCharCode(65+t)]=String(10+t);const yu=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function vu(t){let e=null;if("string"!=typeof t&&pu.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=mu(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&pu.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>gu[t])).join("");for(;e.length>=yu;){let t=e.substring(0,yu);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&pu.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Ah(r,36).toString(16);e.length<40;)e="0"+e;e=mu("0x"+e)}else pu.throwArgumentError("invalid address","address",t);var r;return e}window&&window.__awaiter;const wu=new hh("properties/5.7.0");function bu(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function _u(t){const e={};for(const r in t)e[r]=t[r];return e}const Eu={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Au(t){if(null==t||Eu[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 n=null;try{n=t[e[r]]}catch(t){continue}if(!Au(n))return!1}return!0}return wu.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function ku(t){if(Au(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>Mu(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&bu(e,r,Mu(n))}return e}return wu.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Mu(t){return ku(t)}var xu=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const Su=new hh(zh),Nu=new Uint8Array(32);Nu.fill(0);const Iu=Nh.from(-1),Cu=Nh.from(0),Tu=Nh.from(1),Pu=Nh.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ru=bh(Tu.toHexString(),32),Ou=bh(Cu.toHexString(),32),$u={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Bu=["name","version","chainId","verifyingContract","salt"];function Du(t){return function(e){return"string"!=typeof e&&Su.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Fu={name:Du("name"),version:Du("version"),chainId:function(t){try{return Nh.from(t).toString()}catch(t){}return Su.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return vu(t).toLowerCase()}catch(t){}return Su.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=ph(t);if(32!==e.length)throw new Error("bad length");return vh(e)}catch(t){}return Su.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Uu(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&Su.throwArgumentError("invalid numeric width","type",t);const i=Pu.mask(r?n-1:n),o=r?i.add(Tu).mul(Iu):Cu;return function(e){const r=Nh.from(e);return(r.lt(o)||r.gt(i))&&Su.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),bh(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&Su.throwArgumentError("invalid bytes width","type",t),function(e){return ph(e).length!==r&&Su.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=ph(t),r=e.length%32;return r?wh([e,Nu.slice(r)]):vh(e)}(e)}}}switch(t){case"address":return function(t){return bh(vu(t),32)};case"bool":return function(t){return t?Ru:Ou};case"bytes":return function(t){return _h(t)};case"string":return function(t){return Lh(t)}}return null}function ju(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class Lu{constructor(t){bu(this,"types",Object.freeze(Mu(t))),bu(this,"_encoderCache",{}),bu(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&Su.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&Su.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);Uu(s)||(r[s]||Su.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?Su.throwArgumentError("missing primary type","types",t):i.length>1&&Su.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),bu(this,"primaryType",i[0]),function i(o,s){s[o]&&Su.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=ju(e,t[e])+r.map((e=>ju(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Uu(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&Su.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(_h)),_h(wh(i))}}const r=this.types[t];if(r){const e=Lh(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?_h(n):n}));return n.unshift(e),wh(n)}}return Su.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Su.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return _h(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(Uu(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&Su.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):Su.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Lu(t)}static getPrimaryType(t){return Lu.from(t).primaryType}static hashStruct(t,e,r){return Lu.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=$u[r];n||Su.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>Bu.indexOf(t.name)-Bu.indexOf(e.name))),Lu.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return wh(["0x1901",Lu.hashDomain(t),Lu.from(e).hash(r)])}static hash(t,e,r){return _h(Lu.encode(t,e,r))}static resolveNames(t,e,r,n){return xu(this,void 0,void 0,(function*(){t=_u(t);const i={};t.verifyingContract&&!gh(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Lu.from(e);o.visit(r,((t,e)=>("address"!==t||gh(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){Lu.hashDomain(t);const n={},i=[];Bu.forEach((e=>{const r=t[e];null!=r&&(n[e]=Fu[e](r),i.push({name:e,type:$u[e]}))}));const o=Lu.from(e),s=_u(e);return s.EIP712Domain?Su.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return vh(ph(e));if(t.match(/^u?int/))return Nh.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Su.throwArgumentError("invalid string","value",e),e}return Su.throwArgumentError("unsupported type","type",t)}))}}}var zu=function(t){this.value=t},qu=Object.defineProperty({EnumType:zu},"__esModule",{value:!0}),Vu=function(){function t(t){this.value=t}return t.prototype.toJSON=function(){return"$"+this.value},t}(),Hu=Object.defineProperty({VariableType:Vu},"__esModule",{value:!0}),Gu=o((function(t,e){function r(t){if(t instanceof qu.EnumType)return t.value;if(t instanceof Hu.VariableType)return"$"+t.value;if("object"!=typeof t||null===t)return JSON.stringify(t);if(Array.isArray(t))return"["+t.map((function(t){return r(t)})).join(", ")+"]";var e=Object.keys(t).map((function(e){return e+": "+r(t[e])})).join(", ");return"{"+e+"}"}function n(t,r){return-1==e.configFields.indexOf(t)&&-1==r.indexOf(t)}function i(t,e,o,s){Object.keys(t).filter((function(t){return n(t,s.ignoreFields)})).forEach((function(a){var h=t[a];if("object"==typeof h){if(Array.isArray(h)&&!(h=h.find((function(t){return t&&"object"==typeof t}))))return void o.push([""+a,e]);var u=Object.keys(h).filter((function(t){return n(t,s.ignoreFields)})).length>0,l="object"==typeof h.__args&&Object.keys(h.__args).length>0,c="object"==typeof h.__directives,f=h.__all_on instanceof Array,d="object"==typeof h.__on,p=""+a;if("string"==typeof h.__name&&(p=p+" "+h.__name),"string"==typeof h.__aliasFor&&(p=p+": "+h.__aliasFor),"object"==typeof h.__variables&&Object.keys(h.__variables).length>0)p=p+" ("+function(t){var e=[];for(var r in t)e.push("$"+r+": "+t[r]);return e.join(", ")}(h.__variables)+")";else if(l||c){var m="",g="";c&&(g=Object.entries(h.__directives).map((function(t){var e;return"@"+function(t){var e=Object.keys(t)[0],n=t[e];if("boolean"==typeof n||"object"==typeof n&&0===Object.keys(n).length)return e;if("object"==typeof n){var i=[];for(var o in n){var s=r(n[o]).replace(/"/g,"");i.push(o+": "+s)}return e+"("+i.join(", ")+")"}throw new Error("Unsupported type for directive: "+typeof n+". Types allowed: object, boolean.\nOffending object: "+JSON.stringify(t))}(((e={})[t[0]]=t[1],e))})).join(" ")),l&&(m="("+function(t){var e=[];for(var n in t)e.push(n+": "+r(t[n]));return e.join(", ")}(h.__args)+")"),p=p+" "+m+(c&&l?" ":"")+g}if(o.push([p+(u||d||f?" {":""),e]),i(h,e+1,o,s),f&&h.__all_on.forEach((function(t){o.push(["..."+t,e+1])})),d)(h.__on instanceof Array?h.__on:[h.__on]).forEach((function(t){var r=t.__typeName;o.push(["... on "+r+" {",e+1]),i(t,e+2,o,s),o.push(["}",e+1])}));(u||d||f)&&o.push(["}",e])}else(!0===s.includeFalsyKeys||h)&&o.push([""+a,e])}))}Object.defineProperty(e,"__esModule",{value:!0}),e.configFields=["__args","__alias","__aliasFor","__variables","__directives","__on","__all_on","__typeName","__name"],e.jsonToGraphQLQuery=function(t,e){if(void 0===e&&(e={}),!t||"object"!=typeof t)throw new Error("query object not specified");if(0==Object.keys(t).length)throw new Error("query object has no data");e.ignoreFields instanceof Array||(e.ignoreFields=[]);var r=[];i(t,0,r,e);var n="";return r.forEach((function(t){var r=t[0],i=t[1];e.pretty?(n&&(n+="\n"),n+=function(t){return Array(4*t+1).join(" ")}(i)+r):(n&&(n+=" "),n+=r)})),n}})),Ku=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(Gu),e.EnumType=qu.EnumType,e.VariableType=Hu.VariableType})),Zu=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class r{}e._CodeOrName=r,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends r{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class i extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const t=this._items[0];return""===t||'""'===t}get str(){var t;return null!==(t=this._str)&&void 0!==t?t:this._str=this._items.reduce(((t,e)=>`${t}${e}`),"")}get names(){var t;return null!==(t=this._names)&&void 0!==t?t:this._names=this._items.reduce(((t,e)=>(e instanceof n&&(t[e.str]=(t[e.str]||0)+1),t)),{})}}function o(t,...e){const r=[t[0]];let n=0;for(;n<e.length;)h(r,e[n]),r.push(t[++n]);return new i(r)}e._Code=i,e.nil=new i(""),e._=o;const s=new i("+");function a(t,...e){const r=[l(t[0])];let n=0;for(;n<e.length;)r.push(s),h(r,e[n]),r.push(s,l(t[++n]));return function(t){let e=1;for(;e<t.length-1;){if(t[e]===s){const r=u(t[e-1],t[e+1]);if(void 0!==r){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}(r),new i(r)}function h(t,e){e instanceof i?t.push(...e._items):e instanceof n?t.push(e):t.push(function(t){return"number"==typeof t||"boolean"==typeof t||null===t?t:l(Array.isArray(t)?t.join(","):t)}(e))}function u(t,e){if('""'===e)return t;if('""'===t)return e;if("string"==typeof t){if(e instanceof n||'"'!==t[t.length-1])return;return"string"!=typeof e?`${t.slice(0,-1)}${e}"`:'"'===e[0]?t.slice(0,-1)+e.slice(1):void 0}return"string"!=typeof e||'"'!==e[0]||t instanceof n?void 0:`"${t}${e.slice(1)}`}function l(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=h,e.strConcat=function(t,e){return e.emptyStr()?t:t.emptyStr()?e:a`${t}${e}`},e.stringify=function(t){return new i(l(t))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new i(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new i(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(t){return new i(t.toString())}})),Ju=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;class r extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}}var n;!function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"}(n=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new Zu.Name("const"),let:new Zu.Name("let"),var:new Zu.Name("var")};class i{constructor({prefixes:t,parent:e}={}){this._names={},this._prefixes=t,this._parent=e}toName(t){return t instanceof Zu.Name?t:this.name(t)}name(t){return new Zu.Name(this._newName(t))}_newName(t){return`${t}${(this._names[t]||this._nameGroup(t)).index++}`}_nameGroup(t){var e,r;if((null===(r=null===(e=this._parent)||void 0===e?void 0:e._prefixes)||void 0===r?void 0:r.has(t))||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}}e.Scope=i;class o extends Zu.Name{constructor(t,e){super(e),this.prefix=t}setValue(t,{property:e,itemIndex:r}){this.value=t,this.scopePath=Zu._`.${new Zu.Name(e)}[${r}]`}}e.ValueScopeName=o;const s=Zu._`\n`;e.ValueScope=class extends i{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?s:Zu.nil}}get(){return this._scope}name(t){return new o(t,this._newName(t))}value(t,e){var r;if(void 0===e.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(t),{prefix:i}=n,o=null!==(r=e.key)&&void 0!==r?r:e.ref;let s=this._values[i];if(s){const t=s.get(o);if(t)return t}else s=this._values[i]=new Map;s.set(o,n);const a=this._scope[i]||(this._scope[i]=[]),h=a.length;return a[h]=e.ref,n.setValue(e,{property:i,itemIndex:h}),n}getValue(t,e){const r=this._values[t];if(r)return r.get(e)}scopeRefs(t,e=this._values){return this._reduceValues(e,(e=>{if(void 0===e.scopePath)throw new Error(`CodeGen: name "${e}" has no value`);return Zu._`${t}${e.scopePath}`}))}scopeCode(t=this._values,e,r){return this._reduceValues(t,(t=>{if(void 0===t.value)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),e,r)}_reduceValues(t,i,o={},s){let a=Zu.nil;for(const h in t){const u=t[h];if(!u)continue;const l=o[h]=o[h]||new Map;u.forEach((t=>{if(l.has(t))return;l.set(t,n.Started);let o=i(t);if(o){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;a=Zu._`${a}${r} ${t} = ${o};${this.opts._n}`}else{if(!(o=null==s?void 0:s(t)))throw new r(t);a=Zu._`${a}${o}${this.opts._n}`}l.set(t,n.Completed)}))}return a}}})),Qu=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var r=Zu;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var n=Ju;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new Zu._Code(">"),GTE:new Zu._Code(">="),LT:new Zu._Code("<"),LTE:new Zu._Code("<="),EQ:new Zu._Code("==="),NEQ:new Zu._Code("!=="),NOT:new Zu._Code("!"),OR:new Zu._Code("||"),AND:new Zu._Code("&&"),ADD:new Zu._Code("+")};class i{optimizeNodes(){return this}optimizeNames(t,e){return this}}class o extends i{constructor(t,e,r){super(),this.varKind=t,this.name=e,this.rhs=r}render({es5:t,_n:e}){const r=t?Ju.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+e}optimizeNames(t,e){if(t[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,t,e)),this}get names(){return this.rhs instanceof Zu._CodeOrName?this.rhs.names:{}}}class s extends i{constructor(t,e,r){super(),this.lhs=t,this.rhs=e,this.sideEffects=r}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,e){if(!(this.lhs instanceof Zu.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,t,e),this}get names(){return S(this.lhs instanceof Zu.Name?{}:{...this.lhs.names},this.rhs)}}class a extends s{constructor(t,e,r,n){super(t,r,n),this.op=e}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class h extends i{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}}class u extends i{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}}class l extends i{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class c extends i{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,e){return this.code=N(this.code,t,e),this}get names(){return this.code instanceof Zu._CodeOrName?this.code.names:{}}}class f extends i{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce(((e,r)=>e+r.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let e=t.length;for(;e--;){const r=t[e].optimizeNodes();Array.isArray(r)?t.splice(e,1,...r):r?t[e]=r:t.splice(e,1)}return t.length>0?this:void 0}optimizeNames(t,e){const{nodes:r}=this;let n=r.length;for(;n--;){const i=r[n];i.optimizeNames(t,e)||(I(t,i.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((t,e)=>x(t,e.names)),{})}}class d extends f{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class p extends f{}class m extends d{}m.kind="else";class g extends d{constructor(t,e){super(e),this.condition=t}render(t){let e=`if(${this.condition})`+super.render(t);return this.else&&(e+="else "+this.else.render(t)),e}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(!0===t)return this.nodes;let e=this.else;if(e){const t=e.optimizeNodes();e=this.else=Array.isArray(t)?new m(t):t}return e?!1===t?e instanceof g?e:e.nodes:this.nodes.length?this:new g(C(t),e instanceof g?[e]:e.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(t,e){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(t,e),super.optimizeNames(t,e)||this.else)return this.condition=N(this.condition,t,e),this}get names(){const t=super.names;return S(t,this.condition),this.else&&x(t,this.else.names),t}}g.kind="if";class y extends d{}y.kind="for";class v extends y{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iteration=N(this.iteration,t,e),this}get names(){return x(super.names,this.iteration.names)}}class w extends y{constructor(t,e,r,n){super(),this.varKind=t,this.name=e,this.from=r,this.to=n}render(t){const e=t.es5?Ju.varKinds.var:this.varKind,{name:r,from:n,to:i}=this;return`for(${e} ${r}=${n}; ${r}<${i}; ${r}++)`+super.render(t)}get names(){const t=S(super.names,this.from);return S(t,this.to)}}class b extends y{constructor(t,e,r,n){super(),this.loop=t,this.varKind=e,this.name=r,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iterable=N(this.iterable,t,e),this}get names(){return x(super.names,this.iterable.names)}}class _ extends d{constructor(t,e,r){super(),this.name=t,this.args=e,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}_.kind="func";class E extends f{render(t){return"return "+super.render(t)}}E.kind="return";class A extends d{render(t){let e="try"+super.render(t);return this.catch&&(e+=this.catch.render(t)),this.finally&&(e+=this.finally.render(t)),e}optimizeNodes(){var t,e;return super.optimizeNodes(),null===(t=this.catch)||void 0===t||t.optimizeNodes(),null===(e=this.finally)||void 0===e||e.optimizeNodes(),this}optimizeNames(t,e){var r,n;return super.optimizeNames(t,e),null===(r=this.catch)||void 0===r||r.optimizeNames(t,e),null===(n=this.finally)||void 0===n||n.optimizeNames(t,e),this}get names(){const t=super.names;return this.catch&&x(t,this.catch.names),this.finally&&x(t,this.finally.names),t}}class k extends d{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}k.kind="catch";class M extends d{render(t){return"finally"+super.render(t)}}M.kind="finally";function x(t,e){for(const r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function S(t,e){return e instanceof Zu._CodeOrName?x(t,e.names):t}function N(t,e,r){return t instanceof Zu.Name?i(t):(n=t)instanceof Zu._Code&&n._items.some((t=>t instanceof Zu.Name&&1===e[t.str]&&void 0!==r[t.str]))?new Zu._Code(t._items.reduce(((t,e)=>(e instanceof Zu.Name&&(e=i(e)),e instanceof Zu._Code?t.push(...e._items):t.push(e),t)),[])):t;var n;function i(t){const n=r[t.str];return void 0===n||1!==e[t.str]?t:(delete e[t.str],n)}}function I(t,e){for(const r in e)t[r]=(t[r]||0)-(e[r]||0)}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:Zu._`!${O(t)}`}e.CodeGen=class{constructor(t,e={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...e,_n:e.lines?"\n":""},this._extScope=t,this._scope=new Ju.Scope({parent:t}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,e){const r=this._extScope.value(t,e);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(t,e){return this._extScope.getValue(t,e)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,e,r,n){const i=this._scope.toName(e);return void 0!==r&&n&&(this._constants[i.str]=r),this._leafNode(new o(t,i,r)),i}const(t,e,r){return this._def(Ju.varKinds.const,t,e,r)}let(t,e,r){return this._def(Ju.varKinds.let,t,e,r)}var(t,e,r){return this._def(Ju.varKinds.var,t,e,r)}assign(t,e,r){return this._leafNode(new s(t,e,r))}add(t,r){return this._leafNode(new a(t,e.operators.ADD,r))}code(t){return"function"==typeof t?t():t!==Zu.nil&&this._leafNode(new c(t)),this}object(...t){const e=["{"];for(const[r,n]of t)e.length>1&&e.push(","),e.push(r),(r!==n||this.opts.es5)&&(e.push(":"),(0,Zu.addCodeArg)(e,n));return e.push("}"),new Zu._Code(e)}if(t,e,r){if(this._blockNode(new g(t)),e&&r)this.code(e).else().code(r).endIf();else if(e)this.code(e).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new g(t))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(g,m)}_for(t,e){return this._blockNode(t),e&&this.code(e).endFor(),this}for(t,e){return this._for(new v(t),e)}forRange(t,e,r,n,i=(this.opts.es5?Ju.varKinds.var:Ju.varKinds.let)){const o=this._scope.toName(t);return this._for(new w(i,o,e,r),(()=>n(o)))}forOf(t,e,r,n=Ju.varKinds.const){const i=this._scope.toName(t);if(this.opts.es5){const t=e instanceof Zu.Name?e:this.var("_arr",e);return this.forRange("_i",0,Zu._`${t}.length`,(e=>{this.var(i,Zu._`${t}[${e}]`),r(i)}))}return this._for(new b("of",n,i,e),(()=>r(i)))}forIn(t,e,r,n=(this.opts.es5?Ju.varKinds.var:Ju.varKinds.const)){if(this.opts.ownProperties)return this.forOf(t,Zu._`Object.keys(${e})`,r);const i=this._scope.toName(t);return this._for(new b("in",n,i,e),(()=>r(i)))}endFor(){return this._endBlockNode(y)}label(t){return this._leafNode(new h(t))}break(t){return this._leafNode(new u(t))}return(t){const e=new E;if(this._blockNode(e),this.code(t),1!==e.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(t,e,r){if(!e&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new A;if(this._blockNode(n),this.code(t),e){const t=this.name("e");this._currNode=n.catch=new k(t),e(t)}return r&&(this._currNode=n.finally=new M,this.code(r)),this._endBlockNode(k,M)}throw(t){return this._leafNode(new l(t))}block(t,e){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(e),this}endBlock(t){const e=this._blockStarts.pop();if(void 0===e)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-e;if(r<0||void 0!==t&&r!==t)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${t} expected`);return this._nodes.length=e,this}func(t,e=Zu.nil,r,n){return this._blockNode(new _(t,e,r)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,e){const r=this._currNode;if(r instanceof t||e&&r instanceof e)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${e?`${t.kind}/${e.kind}`:t.kind}"`)}_elseNode(t){const e=this._currNode;if(!(e instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=e.else=t,this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const e=this._nodes;e[e.length-1]=t}},e.not=C;const T=R(e.operators.AND);e.and=function(...t){return t.reduce(T)};const P=R(e.operators.OR);function R(t){return(e,r)=>e===Zu.nil?r:r===Zu.nil?e:Zu._`${O(e)} ${t} ${O(r)}`}function O(t){return t instanceof Zu.Name?t:Zu._`(${t})`}e.or=function(...t){return t.reduce(P)}})),Yu=o((function(t,e){function r(t,e=t.schema){const{opts:r,self:n}=t;if(!r.strictSchema)return;if("boolean"==typeof e)return;const i=n.RULES.keywords;for(const r in e)i[r]||c(t,`unknown keyword: "${r}"`)}function n(t,e){if("boolean"==typeof t)return!t;for(const r in t)if(e[r])return!0;return!1}function i(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function o(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{const h=void 0===s?o:s instanceof Qu.Name?(o instanceof Qu.Name?t(i,o,s):e(i,o,s),s):o instanceof Qu.Name?(e(i,s,o),o):r(o,s);return a!==Qu.Name||h instanceof Qu.Name?h:n(i,h)}}function a(t,e){if(!0===e)return t.var("props",!0);const r=t.var("props",Qu._`{}`);return void 0!==e&&h(t,r,e),r}function h(t,e,r){Object.keys(r).forEach((r=>t.assign(Qu._`${e}${(0,Qu.getProperty)(r)}`,!0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0,e.toHash=function(t){const e={};for(const r of t)e[r]=!0;return e},e.alwaysValidSchema=function(t,e){return"boolean"==typeof e?e:0===Object.keys(e).length||(r(t,e),!n(e,t.self.RULES.all))},e.checkUnknownRules=r,e.schemaHasRules=n,e.schemaHasRulesButRef=function(t,e){if("boolean"==typeof t)return!t;for(const r in t)if("$ref"!==r&&e.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return Qu._`${r}`}return Qu._`${t}${e}${(0,Qu.getProperty)(n)}`},e.unescapeFragment=function(t){return o(decodeURIComponent(t))},e.escapeFragment=function(t){return encodeURIComponent(i(t))},e.escapeJsonPointer=i,e.unescapeJsonPointer=o,e.eachItem=function(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)},e.mergeEvaluated={props:s({mergeNames:(t,e,r)=>t.if(Qu._`${r} !== true && ${e} !== undefined`,(()=>{t.if(Qu._`${e} === true`,(()=>t.assign(r,!0)),(()=>t.assign(r,Qu._`${r} || {}`).code(Qu._`Object.assign(${r}, ${e})`)))})),mergeToName:(t,e,r)=>t.if(Qu._`${r} !== true`,(()=>{!0===e?t.assign(r,!0):(t.assign(r,Qu._`${r} || {}`),h(t,r,e))})),mergeValues:(t,e)=>!0===t||{...t,...e},resultToName:a}),items:s({mergeNames:(t,e,r)=>t.if(Qu._`${r} !== true && ${e} !== undefined`,(()=>t.assign(r,Qu._`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`))),mergeToName:(t,e,r)=>t.if(Qu._`${r} !== true`,(()=>t.assign(r,!0===e||Qu._`${r} > ${e} ? ${r} : ${e}`))),mergeValues:(t,e)=>!0===t||Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})},e.evaluatedPropsToName=a,e.setEvaluated=h;const u={};var l;function c(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,!0===r)throw new Error(e);t.self.logger.warn(e)}}e.useFunc=function(t,e){return t.scopeValue("func",{ref:e,code:u[e.code]||(u[e.code]=new Zu._Code(e.code))})},function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"}(l=e.Type||(e.Type={})),e.getErrorPath=function(t,e,r){if(t instanceof Qu.Name){const n=e===l.Num;return r?n?Qu._`"[" + ${t} + "]"`:Qu._`"['" + ${t} + "']"`:n?Qu._`"/" + ${t}`:Qu._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Qu.getProperty)(t).toString():"/"+i(t)},e.checkStrictMode=c}));var Wu={data:new Qu.Name("data"),valCxt:new Qu.Name("valCxt"),instancePath:new Qu.Name("instancePath"),parentData:new Qu.Name("parentData"),parentDataProperty:new Qu.Name("parentDataProperty"),rootData:new Qu.Name("rootData"),dynamicAnchors:new Qu.Name("dynamicAnchors"),vErrors:new Qu.Name("vErrors"),errors:new Qu.Name("errors"),this:new Qu.Name("this"),self:new Qu.Name("self"),scope:new Qu.Name("scope"),json:new Qu.Name("json"),jsonPos:new Qu.Name("jsonPos"),jsonLen:new Qu.Name("jsonLen"),jsonPart:new Qu.Name("jsonPart")},Xu=Object.defineProperty({default:Wu},"__esModule",{value:!0}),tl=o((function(t,e){function r(t,e){const r=t.const("err",e);t.if(Qu._`${Xu.default.vErrors} === null`,(()=>t.assign(Xu.default.vErrors,Qu._`[${r}]`)),Qu._`${Xu.default.vErrors}.push(${r})`),t.code(Qu._`${Xu.default.errors}++`)}function n(t,e){const{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw(Qu._`new ${t.ValidationError}(${e})`):(r.assign(Qu._`${n}.errors`,e),r.return(!1))}Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0,e.keywordError={message:({keyword:t})=>Qu.str`must pass "${t}" keyword validation`},e.keyword$DataError={message:({keyword:t,schemaType:e})=>e?Qu.str`"${t}" keyword must be ${e} ($data)`:Qu.str`"${t}" keyword is invalid ($data)`},e.reportError=function(t,i=e.keywordError,s,a){const{it:h}=t,{gen:u,compositeRule:l,allErrors:c}=h,f=o(t,i,s);(null!=a?a:l||c)?r(u,f):n(h,Qu._`[${f}]`)},e.reportExtraError=function(t,i=e.keywordError,s){const{it:a}=t,{gen:h,compositeRule:u,allErrors:l}=a;r(h,o(t,i,s)),u||l||n(a,Xu.default.vErrors)},e.resetErrorsCount=function(t,e){t.assign(Xu.default.errors,e),t.if(Qu._`${Xu.default.vErrors} !== null`,(()=>t.if(e,(()=>t.assign(Qu._`${Xu.default.vErrors}.length`,e)),(()=>t.assign(Xu.default.vErrors,null)))))},e.extendErrors=function({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(void 0===i)throw new Error("ajv implementation error");const s=t.name("err");t.forRange("i",i,Xu.default.errors,(i=>{t.const(s,Qu._`${Xu.default.vErrors}[${i}]`),t.if(Qu._`${s}.instancePath === undefined`,(()=>t.assign(Qu._`${s}.instancePath`,(0,Qu.strConcat)(Xu.default.instancePath,o.errorPath)))),t.assign(Qu._`${s}.schemaPath`,Qu.str`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign(Qu._`${s}.schema`,r),t.assign(Qu._`${s}.data`,n))}))};const i={keyword:new Qu.Name("keyword"),schemaPath:new Qu.Name("schemaPath"),params:new Qu.Name("params"),propertyName:new Qu.Name("propertyName"),message:new Qu.Name("message"),schema:new Qu.Name("schema"),parentSchema:new Qu.Name("parentSchema")};function o(t,e,r){const{createErrors:n}=t.it;return!1===n?Qu._`{}`:function(t,e,r={}){const{gen:n,it:o}=t,h=[s(o,r),a(t,r)];return function(t,{params:e,message:r},n){const{keyword:o,data:s,schemaValue:a,it:h}=t,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:f}=h;n.push([i.keyword,o],[i.params,"function"==typeof e?e(t):e||Qu._`{}`]),u.messages&&n.push([i.message,"function"==typeof r?r(t):r]);u.verbose&&n.push([i.schema,a],[i.parentSchema,Qu._`${c}${f}`],[Xu.default.data,s]);l&&n.push([i.propertyName,l])}(t,e,h),n.object(...h)}(t,e,r)}function s({errorPath:t},{instancePath:e}){const r=e?Qu.str`${t}${(0,Yu.getErrorPath)(e,Yu.Type.Str)}`:t;return[Xu.default.instancePath,(0,Qu.strConcat)(Xu.default.instancePath,r)]}function a({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:Qu.str`${e}/${t}`;return r&&(o=Qu.str`${o}${(0,Yu.getErrorPath)(r,Yu.Type.Str)}`),[i.schemaPath,o]}})),el=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;const r={message:"boolean schema is false"};function n(t,e){const{gen:n,data:i}=t,o={gen:n,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,tl.reportError)(o,r,void 0,e)}e.topBoolOrEmptySchema=function(t){const{gen:e,schema:r,validateName:i}=t;!1===r?n(t,!1):"object"==typeof r&&!0===r.$async?e.return(Xu.default.data):(e.assign(Qu._`${i}.errors`,null),e.return(!0))},e.boolOrEmptySchema=function(t,e){const{gen:r,schema:i}=t;!1===i?(r.var(e,!1),n(t)):r.var(e,!0)}})),rl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(t){return"string"==typeof t&&r.has(t)},e.getRules=function(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}})),nl=o((function(t,e){function r(t,e){return e.rules.some((e=>n(t,e)))}function n(t,e){var r;return void 0!==t[e.keyword]||(null===(r=e.definition.implements)||void 0===r?void 0:r.some((e=>void 0!==t[e])))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:t,self:e},n){const i=e.RULES.types[n];return i&&!0!==i&&r(t,i)},e.shouldUseGroup=r,e.shouldUseRule=n})),il=o((function(t,e){var r;function n(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(rl.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0,function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"}(r=e.DataType||(e.DataType={})),e.getSchemaTypes=function(t){const e=n(t.type);if(e.includes("null")){if(!1===t.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&void 0!==t.nullable)throw new Error('"nullable" cannot be used without "type"');!0===t.nullable&&e.push("null")}return e},e.getJSONTypes=n,e.coerceAndCheckDataType=function(t,e){const{gen:n,data:o,opts:a}=t,u=function(t,e){return e?t.filter((t=>i.has(t)||"array"===e&&"array"===t)):[]}(e,a.coerceTypes),l=e.length>0&&!(0===u.length&&1===e.length&&(0,nl.schemaHasRulesForType)(t,e[0]));if(l){const l=s(e,o,a.strictNumbers,r.Wrong);n.if(l,(()=>{u.length?function(t,e,r){const{gen:n,data:o,opts:a}=t,u=n.let("dataType",Qu._`typeof ${o}`),l=n.let("coerced",Qu._`undefined`);"array"===a.coerceTypes&&n.if(Qu._`${u} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,(()=>n.assign(o,Qu._`${o}[0]`).assign(u,Qu._`typeof ${o}`).if(s(e,o,a.strictNumbers),(()=>n.assign(l,o)))));n.if(Qu._`${l} !== undefined`);for(const t of r)(i.has(t)||"array"===t&&"array"===a.coerceTypes)&&c(t);function c(t){switch(t){case"string":return void n.elseIf(Qu._`${u} == "number" || ${u} == "boolean"`).assign(l,Qu._`"" + ${o}`).elseIf(Qu._`${o} === null`).assign(l,Qu._`""`);case"number":return void n.elseIf(Qu._`${u} == "boolean" || ${o} === null
|
|
15
|
+
***************************************************************************** */function t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}function o(t){var e={exports:{}};return t(e,e.exports),e.exports}var s=o((function(t,e){var n="undefined"!=typeof self?self:r,i=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[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&&a.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 n&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?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 d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function m(t){var e=new FileReader,r=p(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:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(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"))},i&&(this.blob=function(){var t=d(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?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);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}f.prototype.append=function(t,e){t=u(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},f.prototype.delete=function(t){delete this.map[u(t)]},f.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},f.prototype.set=function(t,e){this.map[u(t)]=l(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),c(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),c(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),c(t)},n&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,n,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=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 f(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),v.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(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 f(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];_.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new _(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 A(t,r){return new Promise((function(n,o){var s=new w(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",h)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=f,t.Request=w,t.Response=_),e.Headers=f,e.Request=w,e.Response=_,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;(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})),a=n(s);let h=!1,u=!1;const l={debug:1,default:2,info:2,warning:3,error:4,off:5};let c=l.default,f=null;const d=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 p,m;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(p||(p={})),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"}(m||(m={}));const g="0123456789abcdef";class y{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==l[r]&&this.throwArgumentError("invalid log level name","logLevel",t),c>l[r]||console.log.apply(console,e)}debug(...t){this._log(y.levels.DEBUG,t)}info(...t){this._log(y.levels.INFO,t)}warn(...t){this._log(y.levels.WARNING,t)}makeError(t,e,r){if(u)return this.makeError("censored error",e,{});e||(e=y.errors.UNKNOWN_ERROR),r||(r={});const n=[];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+=g[e[t]>>4],r+=g[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case m.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 m.CALL_EXCEPTION:case m.INSUFFICIENT_FUNDS:case m.MISSING_NEW:case m.NONCE_EXPIRED:case m.REPLACEMENT_UNDERPRICED:case m.TRANSACTION_REPLACED:case m.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,y.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){d&&this.throwError("platform missing String.prototype.normalize",y.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:d})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,y.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,y.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,y.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",y.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",y.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",y.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return f||(f=new y("logger/5.6.0")),f}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),h){if(!t)return;this.globalLogger().throwError("error censorship permanent",y.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}u=!!t,h=!!e}static setLogLevel(t){const e=l[t.toLowerCase()];null!=e?c=e:y.globalLogger().warn("invalid log level - "+t)}static from(t){return new y(t)}}y.errors=m,y.levels=p;const v=new y("bytes/5.6.1");function w(t){return!!t.toHexString}function b(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return b(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function _(t){return S(t)&&!(t.length%2)||A(t)}function E(t){return"number"==typeof t&&t==t&&t%1==0}function A(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!E(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!E(r)||r<0||r>=256)return!1}return!0}function k(t,e){if(e||(e={}),"number"==typeof t){v.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),b(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),w(t)&&(t=t.toHexString()),S(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":v.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return b(new Uint8Array(n))}return A(t)?b(new Uint8Array(t)):v.throwArgumentError("invalid arrayify value","value",t)}function M(t){const e=t.map((t=>k(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),b(n)}function x(t){let e=k(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 S(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const N="0123456789abcdef";function I(t,e){if(e||(e={}),"number"==typeof t){v.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=N[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),w(t))return t.toHexString();if(S(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":v.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(A(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=N[(240&n)>>4]+N[15&n]}return e}return v.throwArgumentError("invalid hexlify value","value",t)}function C(t){if("string"!=typeof t)t=I(t);else if(!S(t)||t.length%2)return null;return(t.length-2)/2}function T(t,e,r){return"string"!=typeof t?t=I(t):(!S(t)||t.length%2)&&v.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function P(t){let e="0x";return t.forEach((t=>{e+=I(t).substring(2)})),e}function R(t){const e=function(t){"string"!=typeof t&&(t=I(t));S(t)||v.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)}(I(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function O(t,e){for("string"!=typeof t?t=I(t):S(t)||v.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&v.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function $(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(_(t)){let r=k(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64))):65===r.length?(e.r=I(r.slice(0,32)),e.s=I(r.slice(32,64)),e.v=r[64]):v.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:v.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=I(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=k(t)).length>e&&v.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),b(r)}(k(e._vs),32);e._vs=I(r);const n=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=n:e.recoveryParam!==n&&v.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const i=I(r);null==e.s?e.s=i:e.s!==i&&v.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?v.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&&v.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&S(e.r)?e.r=O(e.r,32):v.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&S(e.s)?e.s=O(e.s,32):v.throwArgumentError("signature missing or invalid s","signature",t);const r=k(e.s);r[0]>=128&&v.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=I(r);e._vs&&(S(e._vs)||v.throwArgumentError("signature invalid _vs","signature",t),e._vs=O(e._vs,32)),null==e._vs?e._vs=n:e._vs!==n&&v.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}var B="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},D=[],F=[],U="undefined"!=typeof Uint8Array?Uint8Array:Array,j=!1;function L(){j=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)D[e]=t[e],F[t.charCodeAt(e)]=e;F["-".charCodeAt(0)]=62,F["_".charCodeAt(0)]=63}function z(t,e,r){for(var n,i,o=[],s=e;s<r;s+=3)n=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(D[(i=n)>>18&63]+D[i>>12&63]+D[i>>6&63]+D[63&i]);return o.join("")}function q(t){var e;j||L();for(var r=t.length,n=r%3,i="",o=[],s=16383,a=0,h=r-n;a<h;a+=s)o.push(z(t,a,a+s>h?h:a+s));return 1===n?(e=t[r-1],i+=D[e>>2],i+=D[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=D[e>>10],i+=D[e>>4&63],i+=D[e<<2&63],i+="="),o.push(i),o.join("")}function V(t,e,r,n,i){var o,s,a=8*i-n-1,h=(1<<a)-1,u=h>>1,l=-7,c=r?i-1:0,f=r?-1:1,d=t[e+c];for(c+=f,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+t[e+c],c+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+c],c+=f,l-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)}function H(t,e,r,n,i,o){var s,a,h,u=8*o-i-1,l=(1<<u)-1,c=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(s++,h/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*h-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*m}var G={}.toString,K=Array.isArray||function(t){return"[object Array]"==G.call(t)};Y.TYPED_ARRAY_SUPPORT=void 0===B.TYPED_ARRAY_SUPPORT||B.TYPED_ARRAY_SUPPORT;var Z=J();function J(){return Y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Q(t,e){if(J()<e)throw new RangeError("Invalid typed array length");return Y.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Y.prototype:(null===t&&(t=new Y(e)),t.length=e),t}function Y(t,e,r){if(!(Y.TYPED_ARRAY_SUPPORT||this instanceof Y))return new Y(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 tt(this,t)}return W(this,t,e,r)}function W(t,e,r,n){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,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);Y.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Y.prototype:t=et(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!Y.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|it(e,r),i=(t=Q(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(nt(e)){var r=0|rt(e.length);return 0===(t=Q(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||(n=e.length)!=n?Q(t,0):et(t,e);if("Buffer"===e.type&&K(e.data))return et(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function X(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 tt(t,e){if(X(e),t=Q(t,e<0?0:0|rt(e)),!Y.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function et(t,e){var r=e.length<0?0:0|rt(e.length);t=Q(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function rt(t){if(t>=J())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+J().toString(16)+" bytes");return 0|t}function nt(t){return!(null==t||!t._isBuffer)}function it(t,e){if(nt(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Tt(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Pt(t).length;default:if(n)return Tt(t).length;e=(""+e).toLowerCase(),n=!0}}function ot(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return bt(this,e,r);case"utf8":case"utf-8":return gt(this,e,r);case"ascii":return vt(this,e,r);case"latin1":case"binary":return wt(this,e,r);case"base64":return mt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _t(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function st(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function at(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Y.from(e,n)),nt(e))return 0===e.length?-1:ht(t,e,r,n,i);if("number"==typeof e)return e&=255,Y.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ht(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ht(t,e,r,n,i){var o,s=1,a=t.length,h=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===h)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var c=!0,f=0;f<h;f++)if(u(t,o+f)!==u(e,f)){c=!1;break}if(c)return o}return-1}function ut(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function lt(t,e,r,n){return Rt(Tt(e,t.length-r),t,r,n)}function ct(t,e,r,n){return Rt(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function ft(t,e,r,n){return ct(t,e,r,n)}function dt(t,e,r,n){return Rt(Pt(e),t,r,n)}function pt(t,e,r,n){return Rt(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function mt(t,e,r){return 0===e&&r===t.length?q(t):q(t.slice(e,r))}function gt(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,h,u=t[i],l=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(o=t[i+1]))&&(h=(31&u)<<6|63&o)>127&&(l=h);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(h=(15&u)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=c}return function(t){var e=t.length;if(e<=yt)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=yt));return r}(n)}Y.poolSize=8192,Y._augment=function(t){return t.__proto__=Y.prototype,t},Y.from=function(t,e,r){return W(null,t,e,r)},Y.TYPED_ARRAY_SUPPORT&&(Y.prototype.__proto__=Uint8Array.prototype,Y.__proto__=Uint8Array),Y.alloc=function(t,e,r){return function(t,e,r,n){return X(e),e<=0?Q(t,e):void 0!==r?"string"==typeof n?Q(t,e).fill(r,n):Q(t,e).fill(r):Q(t,e)}(null,t,e,r)},Y.allocUnsafe=function(t){return tt(null,t)},Y.allocUnsafeSlow=function(t){return tt(null,t)},Y.isBuffer=Ot,Y.compare=function(t,e){if(!nt(t)||!nt(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},Y.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}},Y.concat=function(t,e){if(!K(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Y.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=Y.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!nt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},Y.byteLength=it,Y.prototype._isBuffer=!0,Y.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)st(this,e,e+1);return this},Y.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)st(this,e,e+3),st(this,e+1,e+2);return this},Y.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)st(this,e,e+7),st(this,e+1,e+6),st(this,e+2,e+5),st(this,e+3,e+4);return this},Y.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?gt(this,0,t):ot.apply(this,arguments)},Y.prototype.equals=function(t){if(!nt(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Y.compare(this,t)},Y.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+">"},Y.prototype.compare=function(t,e,r,n,i){if(!nt(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),h=this.slice(n,i),u=t.slice(e,r),l=0;l<a;++l)if(h[l]!==u[l]){o=h[l],s=u[l];break}return o<s?-1:s<o?1:0},Y.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},Y.prototype.indexOf=function(t,e,r){return at(this,t,e,r,!0)},Y.prototype.lastIndexOf=function(t,e,r){return at(this,t,e,r,!1)},Y.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=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===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return ut(this,t,e,r);case"utf8":case"utf-8":return lt(this,t,e,r);case"ascii":return ct(this,t,e,r);case"latin1":case"binary":return ft(this,t,e,r);case"base64":return dt(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var yt=4096;function vt(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function wt(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function bt(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Ct(t[o]);return i}function _t(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function Et(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 At(t,e,r,n,i,o){if(!nt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function kt(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Mt(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function xt(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function St(t,e,r,n,i){return i||xt(t,0,r,4),H(t,e,r,n,23,4),r+4}function Nt(t,e,r,n,i){return i||xt(t,0,r,8),H(t,e,r,n,52,8),r+8}Y.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),Y.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=Y.prototype;else{var i=e-t;r=new Y(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},Y.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},Y.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},Y.prototype.readUInt8=function(t,e){return e||Et(t,1,this.length),this[t]},Y.prototype.readUInt16LE=function(t,e){return e||Et(t,2,this.length),this[t]|this[t+1]<<8},Y.prototype.readUInt16BE=function(t,e){return e||Et(t,2,this.length),this[t]<<8|this[t+1]},Y.prototype.readUInt32LE=function(t,e){return e||Et(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Y.prototype.readUInt32BE=function(t,e){return e||Et(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Y.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},Y.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||Et(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Y.prototype.readInt8=function(t,e){return e||Et(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Y.prototype.readInt16LE=function(t,e){e||Et(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Y.prototype.readInt16BE=function(t,e){e||Et(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Y.prototype.readInt32LE=function(t,e){return e||Et(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Y.prototype.readInt32BE=function(t,e){return e||Et(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Y.prototype.readFloatLE=function(t,e){return e||Et(t,4,this.length),V(this,t,!0,23,4)},Y.prototype.readFloatBE=function(t,e){return e||Et(t,4,this.length),V(this,t,!1,23,4)},Y.prototype.readDoubleLE=function(t,e){return e||Et(t,8,this.length),V(this,t,!0,52,8)},Y.prototype.readDoubleBE=function(t,e){return e||Et(t,8,this.length),V(this,t,!1,52,8)},Y.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||At(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},Y.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||At(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Y.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,1,255,0),Y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Y.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,65535,0),Y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):kt(this,t,e,!0),e+2},Y.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,65535,0),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):kt(this,t,e,!1),e+2},Y.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,4294967295,0),Y.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Mt(this,t,e,!0),e+4},Y.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,4294967295,0),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mt(this,t,e,!1),e+4},Y.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);At(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Y.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);At(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Y.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,1,127,-128),Y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Y.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,32767,-32768),Y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):kt(this,t,e,!0),e+2},Y.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,2,32767,-32768),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):kt(this,t,e,!1),e+2},Y.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,2147483647,-2147483648),Y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Mt(this,t,e,!0),e+4},Y.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||At(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Mt(this,t,e,!1),e+4},Y.prototype.writeFloatLE=function(t,e,r){return St(this,t,e,!0,r)},Y.prototype.writeFloatBE=function(t,e,r){return St(this,t,e,!1,r)},Y.prototype.writeDoubleLE=function(t,e,r){return Nt(this,t,e,!0,r)},Y.prototype.writeDoubleBE=function(t,e,r){return Nt(this,t,e,!1,r)},Y.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===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(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Y.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},Y.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Y.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}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 s=nt(t)?t:Tt(new Y(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var It=/[^+\/0-9A-Za-z-_]/g;function Ct(t){return t<16?"0"+t.toString(16):t.toString(16)}function Tt(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Pt(t){return function(t){var e,r,n,i,o,s;j||L();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new U(3*a/4-o),n=o>0?a-4:a;var h=0;for(e=0,r=0;e<n;e+=4,r+=3)i=F[t.charCodeAt(e)]<<18|F[t.charCodeAt(e+1)]<<12|F[t.charCodeAt(e+2)]<<6|F[t.charCodeAt(e+3)],s[h++]=i>>16&255,s[h++]=i>>8&255,s[h++]=255&i;return 2===o?(i=F[t.charCodeAt(e)]<<2|F[t.charCodeAt(e+1)]>>4,s[h++]=255&i):1===o&&(i=F[t.charCodeAt(e)]<<10|F[t.charCodeAt(e+1)]<<4|F[t.charCodeAt(e+2)]>>2,s[h++]=i>>8&255,s[h++]=255&i),s}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(It,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Rt(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Ot(t){return null!=t&&(!!t._isBuffer||$t(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&$t(t.slice(0,0))}(t))}function $t(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var Bt=i(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:Z,Buffer:Y,SlowBuffer:function(t){return+t!=t&&(t=0),Y.alloc(+t)},isBuffer:Ot})),Dt=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Ft=Dt.BN;const Ut=new y("bignumber/5.6.2"),jt={},Lt=9007199254740991;let zt=!1;class qt{constructor(t,e){t!==jt&&Ut.throwError("cannot call constructor directly; use BigNumber.from",y.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Ht(Gt(this).fromTwos(t))}toTwos(t){return Ht(Gt(this).toTwos(t))}abs(){return"-"===this._hex[0]?qt.from(this._hex.substring(1)):this}add(t){return Ht(Gt(this).add(Gt(t)))}sub(t){return Ht(Gt(this).sub(Gt(t)))}div(t){return qt.from(t).isZero()&&Kt("division-by-zero","div"),Ht(Gt(this).div(Gt(t)))}mul(t){return Ht(Gt(this).mul(Gt(t)))}mod(t){const e=Gt(t);return e.isNeg()&&Kt("division-by-zero","mod"),Ht(Gt(this).umod(e))}pow(t){const e=Gt(t);return e.isNeg()&&Kt("negative-power","pow"),Ht(Gt(this).pow(e))}and(t){const e=Gt(t);return(this.isNegative()||e.isNeg())&&Kt("unbound-bitwise-result","and"),Ht(Gt(this).and(e))}or(t){const e=Gt(t);return(this.isNegative()||e.isNeg())&&Kt("unbound-bitwise-result","or"),Ht(Gt(this).or(e))}xor(t){const e=Gt(t);return(this.isNegative()||e.isNeg())&&Kt("unbound-bitwise-result","xor"),Ht(Gt(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Kt("negative-width","mask"),Ht(Gt(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Kt("negative-width","shl"),Ht(Gt(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Kt("negative-width","shr"),Ht(Gt(this).shrn(t))}eq(t){return Gt(this).eq(Gt(t))}lt(t){return Gt(this).lt(Gt(t))}lte(t){return Gt(this).lte(Gt(t))}gt(t){return Gt(this).gt(Gt(t))}gte(t){return Gt(this).gte(Gt(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Gt(this).isZero()}toNumber(){try{return Gt(this).toNumber()}catch(t){Kt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ut.throwError("this platform does not support BigInt",y.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?zt||(zt=!0,Ut.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ut.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",y.errors.UNEXPECTED_ARGUMENT,{}):Ut.throwError("BigNumber.toString does not accept parameters",y.errors.UNEXPECTED_ARGUMENT,{})),Gt(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof qt)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new qt(jt,Vt(t)):t.match(/^-?[0-9]+$/)?new qt(jt,Vt(new Ft(t))):Ut.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Kt("underflow","BigNumber.from",t),(t>=Lt||t<=-Lt)&&Kt("overflow","BigNumber.from",t),qt.from(String(t));const e=t;if("bigint"==typeof e)return qt.from(e.toString());if(A(e))return qt.from(I(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return qt.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(S(t)||"-"===t[0]&&S(t.substring(1))))return qt.from(t)}return Ut.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Vt(t){if("string"!=typeof t)return Vt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ut.throwArgumentError("invalid hex","value",t),"0x00"===(t=Vt(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 Ht(t){return qt.from(Vt(t))}function Gt(t){const e=qt.from(t).toHexString();return"-"===e[0]?new Ft("-"+e.substring(3),16):new Ft(e.substring(2),16)}function Kt(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ut.throwError(t,y.errors.NUMERIC_FAULT,n)}function Zt(){throw new Error("setTimeout has not been defined")}function Jt(){throw new Error("clearTimeout has not been defined")}var Qt=Zt,Yt=Jt;function Wt(t){if(Qt===setTimeout)return setTimeout(t,0);if((Qt===Zt||!Qt)&&setTimeout)return Qt=setTimeout,setTimeout(t,0);try{return Qt(t,0)}catch(e){try{return Qt.call(null,t,0)}catch(e){return Qt.call(this,t,0)}}}"function"==typeof B.setTimeout&&(Qt=setTimeout),"function"==typeof B.clearTimeout&&(Yt=clearTimeout);var Xt,te=[],ee=!1,re=-1;function ne(){ee&&Xt&&(ee=!1,Xt.length?te=Xt.concat(te):re=-1,te.length&&ie())}function ie(){if(!ee){var t=Wt(ne);ee=!0;for(var e=te.length;e;){for(Xt=te,te=[];++re<e;)Xt&&Xt[re].run();re=-1,e=te.length}Xt=null,ee=!1,function(t){if(Yt===clearTimeout)return clearTimeout(t);if((Yt===Jt||!Yt)&&clearTimeout)return Yt=clearTimeout,clearTimeout(t);try{Yt(t)}catch(e){try{return Yt.call(null,t)}catch(e){return Yt.call(this,t)}}}(t)}}function oe(t,e){this.fun=t,this.array=e}oe.prototype.run=function(){this.fun.apply(null,this.array)};function se(){}var ae=se,he=se,ue=se,le=se,ce=se,fe=se,de=se;var pe=B.performance||{},me=pe.now||pe.mozNow||pe.msNow||pe.oNow||pe.webkitNow||function(){return(new Date).getTime()};var ge=new Date;var ye={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];te.push(new oe(t,e)),1!==te.length||ee||Wt(ie)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ae,addListener:he,once:ue,off:le,removeListener:ce,removeAllListeners:fe,emit:de,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*me.call(pe),r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r-=t[0],(n-=t[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ge)/1e3}},ve=o((function(t){!function(){var e="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof ye&&ye.versions&&ye.versions.node?i=r:o&&(i=self);var s=!i.JS_SHA3_NO_COMMON_JS&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),u=[4,1024,262144,67108864],l=[0,8,16,24],c=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],f=[224,256,384,512],d=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],m={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var g=function(t,e,r){return function(n){return new T(t,e,t).update(n)[r]()}},y=function(t,e,r){return function(n,i){return new T(t,e,i).update(n)[r]()}},v=function(t,e,r){return function(e,n,i,o){return A["cshake"+t].update(e,n,i,o)[r]()}},w=function(t,e,r){return function(e,n,i,o){return A["kmac"+t].update(e,n,i,o)[r]()}},b=function(t,e,r,n){for(var i=0;i<p.length;++i){var o=p[i];t[o]=e(r,n,o)}return t},_=function(t,e){var r=g(t,e,"hex");return r.create=function(){return new T(t,e,t)},r.update=function(t){return r.create().update(t)},b(r,g,t,e)},E=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:_},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:_},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(t,e){var r=y(t,e,"hex");return r.create=function(r){return new T(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},b(r,y,t,e)}},{name:"cshake",padding:u,bits:d,createMethod:function(t,e){var r=m[t],n=v(t,0,"hex");return n.create=function(n,i,o){return i||o?new T(t,e,n).bytepad([i,o],r):A["shake"+t].create(n)},n.update=function(t,e,r,i){return n.create(e,r,i).update(t)},b(n,v,t,e)}},{name:"kmac",padding:u,bits:d,createMethod:function(t,e){var r=m[t],n=w(t,0,"hex");return n.create=function(n,i,o){return new P(t,e,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(t,e,r,i){return n.create(t,r,i).update(e)},b(n,w,t,e)}}],A={},k=[],M=0;M<E.length;++M)for(var x=E[M],S=x.bits,N=0;N<S.length;++N){var I=x.name+"_"+S[N];if(k.push(I),A[I]=x.createMethod(S[N],x.padding),"sha3"!==x.name){var C=x.name+S[N];k.push(C),A[C]=A[I]}}function T(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function P(t,e,r){T.call(this,t,e,r)}T.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,o,s=this.blocks,h=this.byteCount,u=t.length,c=this.blockCount,f=0,d=this.s;f<u;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<c+1;++i)s[i]=0;if(r)for(i=this.start;f<u&&i<h;++f)s[i>>2]|=t[f]<<l[3&i++];else for(i=this.start;f<u&&i<h;++f)(o=t.charCodeAt(f))<128?s[i>>2]|=o<<l[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<l[3&i++],s[i>>2]|=(128|63&o)<<l[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<l[3&i++],s[i>>2]|=(128|o>>6&63)<<l[3&i++],s[i>>2]|=(128|63&o)<<l[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++f)),s[i>>2]|=(240|o>>18)<<l[3&i++],s[i>>2]|=(128|o>>12&63)<<l[3&i++],s[i>>2]|=(128|o>>6&63)<<l[3&i++],s[i>>2]|=(128|63&o)<<l[3&i++]);if(this.lastByteIndex=i,i>=h){for(this.start=i-h,this.block=s[c],i=0;i<c;++i)d[i]^=s[i];R(d),this.reset=!0}else this.start=i}return this},T.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},T.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,o=t.length;if(r)i=o;else for(var s=0;s<t.length;++s){var h=t.charCodeAt(s);h<128?i+=1:h<2048?i+=2:h<55296||h>=57344?i+=3:(h=65536+((1023&h)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},T.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=e-r%e,o=[];return o.length=i,this.update(o),this},T.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];R(n)}},T.prototype.toString=T.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<e&&s<n;++o,++s)t=r[o],a+=h[t>>4&15]+h[15&t]+h[t>>12&15]+h[t>>8&15]+h[t>>20&15]+h[t>>16&15]+h[t>>28&15]+h[t>>24&15];s%e==0&&(R(r),o=0)}return i&&(t=r[o],a+=h[t>>4&15]+h[15&t],i>1&&(a+=h[t>>12&15]+h[t>>8&15]),i>2&&(a+=h[t>>20&15]+h[t>>16&15])),a},T.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var h=new Uint32Array(t);s<n;){for(o=0;o<e&&s<n;++o,++s)h[s]=r[o];s%e==0&&R(r)}return i&&(h[o]=r[o],t=t.slice(0,a)),t},T.prototype.buffer=T.prototype.arrayBuffer,T.prototype.digest=T.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,h=[];a<i;){for(s=0;s<r&&a<i;++s,++a)t=a<<2,e=n[s],h[t]=255&e,h[t+1]=e>>8&255,h[t+2]=e>>16&255,h[t+3]=e>>24&255;a%r==0&&R(n)}return o&&(t=a<<2,e=n[s],h[t]=255&e,o>1&&(h[t+1]=e>>8&255),o>2&&(h[t+2]=e>>16&255)),h},P.prototype=new T,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),T.prototype.finalize.call(this)};var R=function(t){var e,r,n,i,o,s,a,h,u,l,f,d,p,m,g,y,v,w,b,_,E,A,k,M,x,S,N,I,C,T,P,R,O,$,B,D,F,U,j,L,z,q,V,H,G,K,Z,J,Q,Y,W,X,tt,et,rt,nt,it,ot,st,at,ht,ut,lt;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],h=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(h<<1|u>>>31),r=o^(u<<1|h>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(l<<1|f>>>31),r=a^(f<<1|l>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=h^(d<<1|p>>>31),r=u^(p<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=l^(i<<1|o>>>31),r=f^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,m=t[0],g=t[1],K=t[11]<<4|t[10]>>>28,Z=t[10]<<4|t[11]>>>28,I=t[20]<<3|t[21]>>>29,C=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ht=t[30]<<9|t[31]>>>23,q=t[40]<<18|t[41]>>>14,V=t[41]<<18|t[40]>>>14,$=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,Q=t[23]<<10|t[22]>>>22,T=t[33]<<13|t[32]>>>19,P=t[32]<<13|t[33]>>>19,ut=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,D=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,Y=t[34]<<15|t[35]>>>17,W=t[35]<<15|t[34]>>>17,R=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,M=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,j=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,E=t[37]<<21|t[36]>>>11,X=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,S=t[18]<<20|t[19]>>>12,N=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,L=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,k=t[49]<<14|t[48]>>>18,t[0]=m^~y&w,t[1]=g^~v&b,t[10]=M^~S&I,t[11]=x^~N&C,t[20]=$^~D&U,t[21]=B^~F&j,t[30]=H^~K&J,t[31]=G^~Z&Q,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=y^~w&_,t[3]=v^~b&E,t[12]=S^~I&T,t[13]=N^~C&P,t[22]=D^~U&L,t[23]=F^~j&z,t[32]=K^~J&Y,t[33]=Z^~Q&W,t[42]=nt^~ot&at,t[43]=it^~st&ht,t[4]=w^~_&A,t[5]=b^~E&k,t[14]=I^~T&R,t[15]=C^~P&O,t[24]=U^~L&q,t[25]=j^~z&V,t[34]=J^~Y&X,t[35]=Q^~W&tt,t[44]=ot^~at&ut,t[45]=st^~ht<,t[6]=_^~A&m,t[7]=E^~k&g,t[16]=T^~R&M,t[17]=P^~O&x,t[26]=L^~q&$,t[27]=z^~V&B,t[36]=Y^~X&H,t[37]=W^~tt&G,t[46]=at^~ut&et,t[47]=ht^~lt&rt,t[8]=A^~m&y,t[9]=k^~g&v,t[18]=R^~M&S,t[19]=O^~x&N,t[28]=q^~$&D,t[29]=V^~B&F,t[38]=X^~H&K,t[39]=tt^~G&Z,t[48]=ut^~et&nt,t[49]=lt^~rt&it,t[0]^=c[n],t[1]^=c[n+1]};if(s)t.exports=A;else for(M=0;M<k.length;++M)i[k[M]]=A[k[M]]}()}));function we(t){return"0x"+ve.keccak_256(k(t))}const be=new y("rlp/5.6.1");function _e(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function Ee(t,e,r){let n=0;for(let i=0;i<r;i++)n=256*n+t[e+i];return n}function Ae(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(Ae(t))})),e.length<=55)return e.unshift(192+e.length),e;const r=_e(e.length);return r.unshift(247+r.length),r.concat(e)}_(t)||be.throwArgumentError("RLP object must be BytesLike","object",t);const e=Array.prototype.slice.call(k(t));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=_e(e.length);return r.unshift(183+r.length),r.concat(e)}function ke(t){return I(Ae(t))}function Me(t,e,r,n){const i=[];for(;r<e+1+n;){const o=xe(t,r);i.push(o.result),(r+=o.consumed)>e+1+n&&be.throwError("child data too short",y.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function xe(t,e){if(0===t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&be.throwError("data short segment too short",y.errors.BUFFER_OVERRUN,{});const n=Ee(t,e+1,r);return e+1+r+n>t.length&&be.throwError("data long segment too short",y.errors.BUFFER_OVERRUN,{}),Me(t,e,e+1+r,r+n)}if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{}),Me(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});const n=Ee(t,e+1,r);e+1+r+n>t.length&&be.throwError("data array too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:I(t.slice(e+1+r,e+1+r+n))}}if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&be.throwError("data too short",y.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:I(t.slice(e+1,e+1+r))}}return{consumed:1,result:I(t[e])}}function Se(t){const e=k(t),r=xe(e,0);return r.consumed!==e.length&&be.throwArgumentError("invalid rlp data","data",t),r.result}const Ne=new y("address/5.6.1");function Ie(t){S(t,20)||Ne.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=k(we(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Ce={};for(let t=0;t<10;t++)Ce[String(t)]=String(t);for(let t=0;t<26;t++)Ce[String.fromCharCode(65+t)]=String(10+t);const Te=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Pe(t){let e=null;if("string"!=typeof t&&Ne.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Ie(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ne.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Ce[t])).join("");for(;e.length>=Te;){let t=e.substring(0,Te);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&Ne.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Ft(r,36).toString(16);e.length<40;)e="0"+e;e=Ie("0x"+e)}else Ne.throwArgumentError("invalid address","address",t);var r;return e}function Re(t){try{return Pe(t),!0}catch(t){}return!1}function Oe(t){let e=null;try{e=Pe(t.from)}catch(e){Ne.throwArgumentError("missing from address","transaction",t)}return Pe(T(we(ke([e,x(k(qt.from(t.nonce).toHexString()))])),12))}const $e={Space:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"settings",type:"string"}]},Be={Proposal:[{name:"from",type:"address"},{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:"start",type:"uint64"},{name:"end",type:"uint64"},{name:"snapshot",type:"uint64"},{name:"plugins",type:"string"},{name:"app",type:"string"}]},De={UpdateProposal:[{name:"proposal",type:"string"},{name:"from",type:"address"},{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:"plugins",type:"string"}]},Fe={FlagProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"proposal",type:"string"},{name:"timestamp",type:"uint64"}]},Ue={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"string"}]},je={CancelProposal:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"},{name:"proposal",type:"bytes32"}]},Le={Vote:[{name:"from",type:"address"},{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"}]},ze={Vote:[{name:"from",type:"address"},{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"}]},qe={Vote:[{name:"from",type:"address"},{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"}]},Ve={Vote:[{name:"from",type:"address"},{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"}]},He={Vote:[{name:"from",type:"address"},{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"}]},Ge={Vote:[{name:"from",type:"address"},{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"}]},Ke={Follow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Ze={Unfollow:[{name:"from",type:"address"},{name:"network",type:"string"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Je={Subscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Qe={Unsubscribe:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]},Ye={Profile:[{name:"from",type:"address"},{name:"timestamp",type:"uint64"},{name:"profile",type:"string"}]},We={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"}]},Xe={Alias:[{name:"from",type:"address"},{name:"alias",type:"address"},{name:"timestamp",type:"uint64"}]},tr={DeleteSpace:[{name:"from",type:"address"},{name:"space",type:"string"},{name:"timestamp",type:"uint64"}]};var er={hub:"https://hub.snapshot.org",sequencer:"https://seq.snapshot.org"},rr={hub:"https://testnet.hub.snapshot.org",sequencer:"https://testnet.seq.snapshot.org"},nr={hub:"http://localhost:3000",sequencer:"http://localhost:3001"};const ir={name:"snapshot",version:"0.1.4"};class or{constructor(t=er.sequencer,e={}){t=(t=(t=t.replace(er.hub,er.sequencer)).replace(rr.hub,rr.sequencer)).replace(nr.hub,nr.sequencer),this.address=t,this.options=e}sign(t,r,n,i){return e(this,void 0,void 0,(function*(){var e;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,s=Pe(r);n.from=n.from?Pe(n.from).toLowerCase():s.toLowerCase(),n.timestamp||(n.timestamp=parseInt((Date.now()/1e3).toFixed()));const a=Object.assign({},ir);"undefined"!=typeof window&&(null===(e=window.ethereum)||void 0===e?void 0:e.isTrust)&&(a.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:a,types:i,message:n},u=yield o._signTypedData(a,h.types,n);return yield this.send({address:s.toLowerCase(),sig:u,data:h})}))}send(t){return e(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,n)=>{a(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(n).catch(n);throw e})).catch(n)}))}))}space(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,$e)}))}proposal(t,r,n){return e(this,void 0,void 0,(function*(){return n.discussion||(n.discussion=""),n.app||(n.app=""),yield this.sign(t,r,n,Be)}))}updateProposal(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,De)}))}flagProposal(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Fe)}))}cancelProposal(t,r,n){return e(this,void 0,void 0,(function*(){const e=n.proposal.startsWith("0x");return yield this.sign(t,r,n,e?je:Ue)}))}vote(t,r,n){return e(this,void 0,void 0,(function*(){const e="shutter"===(null==n?void 0:n.privacy);n.reason||(n.reason=""),n.app||(n.app=""),n.metadata||(n.metadata="{}");const i=n.proposal.startsWith("0x");let o=i?Ve:Le;return["approval","ranked-choice"].includes(n.type)&&(o=i?He:ze),!e&&["quadratic","weighted"].includes(n.type)&&(o=i?Ge:qe,n.choice=JSON.stringify(n.choice)),e&&(o=i?Ge:qe),delete n.privacy,delete n.type,yield this.sign(t,r,n,o)}))}follow(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Ke)}))}unfollow(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Ze)}))}subscribe(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Je)}))}unsubscribe(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Qe)}))}profile(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Ye)}))}statement(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,We)}))}alias(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,Xe)}))}deleteSpace(t,r,n){return e(this,void 0,void 0,(function*(){return yield this.sign(t,r,n,tr)}))}}var sr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:4e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxItems:500},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:24}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},ar={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0,maxLengthWithSpaceType:{default:1e4,turbo:2e4}},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1,maxItems:500},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},hr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:1e3},app:{type:"string",title:"app",maxLength:24}},required:["proposal","choice"],additionalProperties:!1}}},ur={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},lr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},cr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},fr={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}},dr={space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"uri",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1,maxLength:32},symbol:{type:"string",title:"symbol",minLength:1,maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64},strategies:{type:"array",minItems:1,maxItemsWithSpaceType:{default:8,turbo:10},uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",maxLength:12,title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"}]},delegationContract:{type:"string",format:"address",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"]},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:15552e3,errorMessage:{maximum:"Delay must be less than 180 days"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector"]}},treasuries:{type:"array",maxItems:10,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],pattern:"^0x[a-fA-F0-9]{40}$",minLength:42,maxLength:42},network:{type:"string",snapshotNetwork:!0,title:"Network",maxLength:12}},required:["name","address","network"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1}},required:["name","network","symbol","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:sr.definitions.Proposal,updateProposal:ar.definitions.UpdateProposal,vote:hr.definitions.Vote,profile:ur.definitions.Profile,statement:lr.definitions.Statement,zodiac:cr.definitions.Zodiac,alias:fr.definitions.Alias};var pr=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const mr=new y("properties/5.6.0");function gr(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function yr(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 vr(t){return pr(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 wr(t){const e={};for(const r in t)e[r]=t[r];return e}const br={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function _r(t){if(null==t||br[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 n=null;try{n=t[e[r]]}catch(t){continue}if(!_r(n))return!1}return!0}return mr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Er(t){if(_r(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>Ar(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&gr(e,r,Ar(n))}return e}return mr.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Ar(t){return Er(t)}class kr{constructor(t){for(const e in t)this[e]=Ar(t[e])}}const Mr="abi/5.6.4",xr=new y(Mr),Sr={};let Nr={calldata:!0,memory:!0,storage:!0},Ir={calldata:!0,memory:!0};function Cr(t,e){if("bytes"===t||"string"===t){if(Nr[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&Ir[e])return!0;return(Nr[e]||"payable"===e)&&xr.throwArgumentError("invalid modifier","name",e),!1}function Tr(t,e){for(let r in e)gr(t,r,e[r])}const Pr=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Rr=new RegExp(/^(.*)\[([0-9]*)\]$/);class Or{constructor(t,e){t!==Sr&&xr.throwError("use fromString",y.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Tr(this,e);let r=this.type.match(Rr);Tr(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Or.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=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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!==Pr.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===Pr.full?", ":",")+")"):e+=this.type,t!==Pr.sighash&&(!0===this.indexed&&(e+=" indexed"),t===Pr.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Or.fromString(t,e):Or.fromObject(t)}static fromObject(t){return Or.isParamType(t)?t:new Or(Sr,{name:t.name||null,type:Hr(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Or.fromObject):null})}static fromString(t,e){return r=function(t,e){let r=t;function n(e){xr.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(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}},s=o;for(let r=0;r<t.length;r++){let o=t[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||n(r),s.state.allowType=!1,s.type=Hr(s.type),s.components=[i(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),Cr(s.type,s.name)&&(s.name=""),s.type=Hr(s.type);let t=s;s=s.parent,s||n(r),delete t.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(e||n(r),s.indexed=!0,s.name=""),Cr(s.type,s.name)&&(s.name=""),s.type=Hr(s.type);let a=i(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=Hr(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(e||n(r),s.indexed&&n(r),s.indexed=!0,s.name=""):Cr(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||n(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||n(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:n(r)}}return s.parent&&xr.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===s.name?(e||n(r.length-7),s.indexed&&n(r.length-7),s.indexed=!0,s.name=""):Cr(s.type,s.name)&&(s.name=""),o.type=Hr(o.type),o}(t,!!e),Or.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(t){return!(null==t||!t._isParamType)}}function $r(t,e){return function(t){t=t.trim();let e=[],r="",n=0;for(let i=0;i<t.length;i++){let o=t[i];","===o&&0===n?(e.push(r),r=""):(r+=o,"("===o?n++:")"===o&&(n--,-1===n&&xr.throwArgumentError("unbalanced parenthesis","value",t)))}r&&e.push(r);return e}(t).map((t=>Or.fromString(t,e)))}class Br{constructor(t,e){t!==Sr&&xr.throwError("use a static from method",y.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Tr(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Br.isFragment(t)?t:"string"==typeof t?Br.fromString(t):Br.fromObject(t)}static fromObject(t){if(Br.isFragment(t))return t;switch(t.type){case"function":return zr.fromObject(t);case"event":return Dr.fromObject(t);case"constructor":return Lr.fromObject(t);case"error":return Vr.fromObject(t);case"fallback":case"receive":return null}return xr.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]?Dr.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?zr.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Lr.fromString(t.trim()):"error"===t.split(" ")[0]?Vr.fromString(t.substring(5).trim()):xr.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Dr extends Br{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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!==Pr.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ",t!==Pr.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Dr.fromString(t):Dr.fromObject(t)}static fromObject(t){if(Dr.isEventFragment(t))return t;"event"!==t.type&&xr.throwArgumentError("invalid event object","value",t);const e={name:Kr(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Or.fromObject):[],type:"event"};return new Dr(Sr,e)}static fromString(t){let e=t.match(Zr);e||xr.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:xr.warn("unknown modifier: "+t)}})),Dr.fromObject({name:e[1].trim(),anonymous:r,inputs:$r(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Fr(t,e){e.gas=null;let r=t.split("@");return 1!==r.length?(r.length>2&&xr.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||xr.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=qt.from(r[1]),r[0]):t}function Ur(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 jr(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&&xr.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&xr.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||xr.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&&xr.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&&xr.throwArgumentError("unable to determine stateMutability","value",t),e}class Lr extends Br{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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===Pr.sighash&&xr.throwError("cannot format a constructor for sighash",y.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Lr.fromString(t):Lr.fromObject(t)}static fromObject(t){if(Lr.isConstructorFragment(t))return t;"constructor"!==t.type&&xr.throwArgumentError("invalid constructor object","value",t);let e=jr(t);e.constant&&xr.throwArgumentError("constructor cannot be constant","value",t);const r={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Or.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?qt.from(t.gas):null};return new Lr(Sr,r)}static fromString(t){let e={type:"constructor"},r=(t=Fr(t,e)).match(Zr);return r&&"constructor"===r[1].trim()||xr.throwArgumentError("invalid constructor string","value",t),e.inputs=$r(r[2].trim(),!1),Ur(r[3].trim(),e),Lr.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class zr extends Lr{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.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!==Pr.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ",t!==Pr.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?zr.fromString(t):zr.fromObject(t)}static fromObject(t){if(zr.isFunctionFragment(t))return t;"function"!==t.type&&xr.throwArgumentError("invalid function object","value",t);let e=jr(t);const r={type:t.type,name:Kr(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Or.fromObject):[],outputs:t.outputs?t.outputs.map(Or.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?qt.from(t.gas):null};return new zr(Sr,r)}static fromString(t){let e={type:"function"},r=(t=Fr(t,e)).split(" returns ");r.length>2&&xr.throwArgumentError("invalid function string","value",t);let n=r[0].match(Zr);if(n||xr.throwArgumentError("invalid function signature","value",t),e.name=n[1].trim(),e.name&&Kr(e.name),e.inputs=$r(n[2],!1),Ur(n[3].trim(),e),r.length>1){let n=r[1].match(Zr);""==n[1].trim()&&""==n[3].trim()||xr.throwArgumentError("unexpected tokens","value",t),e.outputs=$r(n[2],!1)}else e.outputs=[];return zr.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function qr(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||xr.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Vr extends Br{format(t){if(t||(t=Pr.sighash),Pr[t]||xr.throwArgumentError("invalid format type","format",t),t===Pr.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Pr.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Pr.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Vr.fromString(t):Vr.fromObject(t)}static fromObject(t){if(Vr.isErrorFragment(t))return t;"error"!==t.type&&xr.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:Kr(t.name),inputs:t.inputs?t.inputs.map(Or.fromObject):[]};return qr(new Vr(Sr,e))}static fromString(t){let e={type:"error"},r=t.match(Zr);return r||xr.throwArgumentError("invalid error signature","value",t),e.name=r[1].trim(),e.name&&Kr(e.name),e.inputs=$r(r[2],!1),qr(Vr.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Hr(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const Gr=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Kr(t){return t&&t.match(Gr)||xr.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const Zr=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Jr=new y(Mr);class Qr{constructor(t,e,r,n){this.name=t,this.type=e,this.localName=r,this.dynamic=n}_throwError(t,e){Jr.throwArgumentError(t,this.localName,e)}}class Yr{constructor(t){gr(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return P(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(M(t._data))}writeBytes(t){let e=k(t);const r=e.length%this.wordSize;return r&&(e=M([e,this._padding.slice(r)])),this._writeData(e)}_getValue(t){let e=k(qt.from(t));return e.length>this.wordSize&&Jr.throwError("value out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=M([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 Wr{constructor(t,e,r,n){gr(this,"_data",k(t)),gr(this,"wordSize",e||32),gr(this,"_coerceFunc",r),gr(this,"allowLoose",n),this._offset=0}get data(){return I(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):Wr.coerce(t,e)}_peekBytes(t,e,r){let n=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+e<=this._data.length?n=e:Jr.throwError("data out-of-bounds",y.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(t){return new Wr(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 qt.from(this.readBytes(this.wordSize))}}class Xr extends Qr{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=Pe(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return Pe(O(t.readValue().toHexString(),20))}}class tn extends Qr{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const en=new y(Mr);function rn(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let t={};n=e.map((e=>{const n=e.localName;return n||en.throwError("cannot encode object for signature with missing names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]&&en.throwError("cannot encode object for signature with duplicate names",y.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),t[n]=!0,r[n]}))}else en.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&en.throwArgumentError("types/value length mismatch","tuple",r);let i=new Yr(t.wordSize),o=new Yr(t.wordSize),s=[];e.forEach(((t,e)=>{let r=n[e];if(t.dynamic){let e=o.length;t.encode(o,r);let n=i.writeUpdatableValue();s.push((t=>{n(t+e)}))}else t.encode(i,r)})),s.forEach((t=>{t(i.length)}));let a=t.appendWriter(i);return a+=t.appendWriter(o),a}function nn(t,e){let r=[],n=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let r=t.readValue(),o=n.subReader(r.toNumber());try{i=e.decode(o)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===y.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&r.push(i)}));const i=e.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});e.forEach(((t,e)=>{let n=t.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[e];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let t=0;t<r.length;t++){const e=r[t];e instanceof Error&&Object.defineProperty(r,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(r)}class on extends Qr{constructor(t,e,r){super("array",t.type+"["+(e>=0?e:"")+"]",r,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let r=this.length;-1===r&&(r=e.length,t.writeValue(e.length)),en.checkArgumentCount(e.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let t=0;t<e.length;t++)n.push(this.coder);return rn(t,n,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&en.throwError("insufficient data length",y.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let r=[];for(let t=0;t<e;t++)r.push(new tn(this.coder));return t.coerce(this.name,nn(t,r))}}class sn extends Qr{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class an extends Qr{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=k(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class hn extends an{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,I(super.decode(t)))}}class un extends Qr{constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let r=k(e);return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return t.coerce(this.name,I(t.readBytes(this.size)))}}class ln extends Qr{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}const cn=qt.from(-1),fn=qt.from(0),dn=qt.from(1),pn=qt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class mn extends Qr{constructor(t,e,r){const n=(e?"int":"uint")+8*t;super(n,n,r,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let r=qt.from(e),n=pn.mask(8*t.wordSize);if(this.signed){let t=n.mask(8*this.size-1);(r.gt(t)||r.lt(t.add(dn).mul(cn)))&&this._throwError("value out-of-bounds",e)}else(r.lt(fn)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(r)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}const gn=new y("strings/5.6.1");var yn,vn;function wn(t,e,r,n,i){if(t===vn.BAD_PREFIX||t===vn.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n<r.length&&r[n]>>6==2;n++)t++;return t}return t===vn.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(yn||(yn={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(vn||(vn={}));const bn=Object.freeze({error:function(t,e,r,n,i){return gn.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:wn,replace:function(t,e,r,n,i){return t===vn.OVERLONG?(n.push(i),0):(n.push(65533),wn(t,e,r))}});function _n(t,e){null==e&&(e=bn.error),t=k(t);const r=[];let n=0;for(;n<t.length;){const i=t[n++];if(i>>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?vn.UNEXPECTED_CONTINUE:vn.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e(vn.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=t[n];if(128!=(192&i)){n+=e(vn.MISSING_CONTINUE,n,t,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=e(vn.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e(vn.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e(vn.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function En(t,e=yn.current){e!=yn.current&&(gn.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return k(r)}function An(t){return t.map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function kn(t,e){return An(_n(t,e))}function Mn(t,e=yn.current){return _n(En(t,e))}function xn(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,n={};return t.split(",").forEach((t=>{let i=t.split(":");r+=parseInt(i[0],16),n[r]=e(i[1])})),n}function Sn(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:n,h:e}}))}function Nn(t,e){let r=0;for(let n=0;n<e.length;n++){let i=e[n];if(r+=i.l,t>=r&&t<=r+i.h&&(t-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(t-r))continue;return i}}return null}const In=Sn("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Cn="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),Tn=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Pn=xn("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Rn=xn("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),On=xn("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e})),$n=Sn("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function Bn(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Mn(t);var r;r=e.map((t=>{if(Cn.indexOf(t)>=0)return[];if(t>=65024&&t<=65039)return[];let e=function(t){let e=Nn(t,Tn);if(e)return[t+e.s];let r=Pn[t];if(r)return r;let n=Rn[t];return n?[t+n[0]]:On[t]||null}(t);return e||[t]})),e=r.reduce(((t,e)=>(e.forEach((e=>{t.push(e)})),t)),[]),e=Mn(An(e),yn.NFKC),e.forEach((t=>{if(Nn(t,$n))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),e.forEach((t=>{if(Nn(t,In))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=An(e);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");if(n.length>63)throw new Error("too long");return n}class Dn extends an{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,En(e))}decode(t){return kn(super.decode(t))}}class Fn extends Qr{constructor(t,e){let r=!1;const n=[];t.forEach((t=>{t.dynamic&&(r=!0),n.push(t.type)}));super("tuple","tuple("+n.join(",")+")",e,r),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const r=e.localName;return r&&(t[r]||(t[r]=0),t[r]++),t}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[n]))})),Object.freeze(t)}encode(t,e){return rn(t,this.coders,e)}decode(t){return t.coerce(this.name,nn(t,this.coders))}}const Un=new y(Mr),jn=new RegExp(/^bytes([0-9]*)$/),Ln=new RegExp(/^(u?int)([0-9]*)$/);const zn=new class{constructor(t){gr(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new Xr(t.name);case"bool":return new sn(t.name);case"string":return new Dn(t.name);case"bytes":return new hn(t.name);case"array":return new on(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Fn((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new ln(t.name)}let e=t.type.match(Ln);if(e){let r=parseInt(e[2]||"256");return(0===r||r>256||r%8!=0)&&Un.throwArgumentError("invalid "+e[1]+" bit length","param",t),new mn(r/8,"int"===e[1],t.name)}if(e=t.type.match(jn),e){let r=parseInt(e[1]);return(0===r||r>32)&&Un.throwArgumentError("invalid bytes length","param",t),new un(r,t.name)}return Un.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new Wr(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new Yr(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Or.from(t))));return new Fn(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Un.throwError("types/values length mismatch",y.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const r=t.map((t=>this._getCoder(Or.from(t)))),n=new Fn(r,"_"),i=this._getWriter();return n.encode(i,e),i.data}decode(t,e,r){const n=t.map((t=>this._getCoder(Or.from(t))));return new Fn(n,"_").decode(this._getReader(k(e),r))}};function qn(t){return we(En(t))}const Vn=new y(Mr);class Hn extends kr{}class Gn extends kr{}class Kn extends kr{}class Zn extends kr{static isIndexed(t){return!(!t||!t._isIndexed)}}const Jn={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Qn(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class Yn{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,gr(this,"fragments",e.map((t=>Br.from(t))).filter((t=>null!=t))),gr(this,"_abiCoder",yr(new.target,"getAbiCoder")()),gr(this,"functions",{}),gr(this,"errors",{}),gr(this,"events",{}),gr(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void Vn.warn("duplicate definition - constructor"):void gr(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let r=t.format();e[r]?Vn.warn("duplicate definition - "+r):e[r]=t})),this.deploy||gr(this,"deploy",Lr.from({payable:!1,type:"constructor"})),gr(this,"_isInterface",!0)}format(t){t||(t=Pr.full),t===Pr.sighash&&Vn.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===Pr.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return zn}static getAddress(t){return Pe(t)}static getSighash(t){return T(qn(t.format()),0,4)}static getEventTopic(t){return qn(t.format())}getFunction(t){if(S(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];Vn.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===r.length?Vn.throwArgumentError("no matching function","name",e):r.length>1&&Vn.throwArgumentError("multiple matching functions","name",e),this.functions[r[0]]}const e=this.functions[zr.fromString(t).format()];return e||Vn.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(S(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];Vn.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===r.length?Vn.throwArgumentError("no matching event","name",e):r.length>1&&Vn.throwArgumentError("multiple matching events","name",e),this.events[r[0]]}const e=this.events[Dr.fromString(t).format()];return e||Vn.throwArgumentError("no matching event","signature",t),e}getError(t){if(S(t)){const e=yr(this.constructor,"getSighash");for(const r in this.errors){if(t===e(this.errors[r]))return this.errors[r]}Vn.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),r=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===r.length?Vn.throwArgumentError("no matching error","name",e):r.length>1&&Vn.throwArgumentError("multiple matching errors","name",e),this.errors[r[0]]}const e=this.errors[zr.fromString(t).format()];return e||Vn.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return yr(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),yr(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const r=k(e);return I(r.slice(0,4))!==this.getSighash(t)&&Vn.throwArgumentError(`data signature does not match error ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),I(M([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const r=k(e);return I(r.slice(0,4))!==this.getSighash(t)&&Vn.throwArgumentError(`data signature does not match function ${t.name}.`,"data",I(r)),this._decodeParams(t.inputs,r.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(M([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let r=k(e),n=null,i="",o=null,s=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,r)}catch(t){}break;case 4:{const t=I(r.slice(0,4)),e=Jn[t];if(e)o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.signature,e.reason&&(n=o[0]),"Error"===s?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===s&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,r.slice(4)),s=e.name,a=e.format()}catch(t){}break}}return Vn.throwError("call revert exception"+i,y.errors.CALL_EXCEPTION,{method:t.format(),data:I(e),errorArgs:o,errorName:s,errorSignature:a,reason:n})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),I(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&Vn.throwError("too many arguments for "+t.format(),y.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let r=[];t.anonymous||r.push(this.getEventTopic(t));const n=(t,e)=>"string"===t.type?qn(e):"bytes"===t.type?we(I(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=qt.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),O(I(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?r.push(null):"array"===o.baseType||"tuple"===o.baseType?Vn.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?r.push(e.map((t=>n(o,t)))):r.push(n(o,e)):null!=e&&Vn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const r=[],n=[],i=[];return t.anonymous||r.push(this.getEventTopic(t)),e.length!==t.inputs.length&&Vn.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const s=e[o];if(t.indexed)if("string"===t.type)r.push(qn(s));else if("bytes"===t.type)r.push(we(s));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([t.type],[s]))}else n.push(t),i.push(s)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(t,e,r){if("string"==typeof t&&(t=this.getEvent(t)),null!=r&&!t.anonymous){let e=this.getEventTopic(t);S(r[0],32)&&r[0].toLowerCase()===e||Vn.throwError("fragment/topic mismatch",y.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(n.push(Or.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let s=null!=r?this._abiCoder.decode(n,M(r)):null,a=this._abiCoder.decode(i,e,!0),h=[],u=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==s)h[e]=new Zn({_isIndexed:!0,hash:null});else if(o[e])h[e]=new Zn({_isIndexed:!0,hash:s[l++]});else try{h[e]=s[l++]}catch(t){h[e]=t}else try{h[e]=a[u++]}catch(t){h[e]=t}if(t.name&&null==h[t.name]){const r=h[e];r instanceof Error?Object.defineProperty(h,t.name,{enumerable:!0,get:()=>{throw Qn(`property ${JSON.stringify(t.name)}`,r)}}):h[t.name]=r}}));for(let t=0;t<h.length;t++){const e=h[t];e instanceof Error&&Object.defineProperty(h,t,{enumerable:!0,get:()=>{throw Qn(`index ${t}`,e)}})}return Object.freeze(h)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new Gn({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:qt.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new Hn({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=I(t);let r=this.getError(e.substring(0,10).toLowerCase());return r?new Kn({args:this._abiCoder.decode(r.inputs,"0x"+e.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var Wn=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const Xn=new y("abstract-provider/5.6.1");class ti extends kr{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class ei{constructor(){Xn.checkAbstract(new.target,ei),gr(this,"_isProvider",!0)}getFeeData(){return Wn(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield vr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let r=null,n=null;return t&&t.baseFeePerGas&&(n=qt.from("1500000000"),r=t.baseFeePerGas.mul(2).add(n)),{maxFeePerGas:r,maxPriorityFeePerGas:n,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var ri=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const ni=new y("abstract-signer/5.6.2"),ii=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],oi=[y.errors.INSUFFICIENT_FUNDS,y.errors.NONCE_EXPIRED,y.errors.REPLACEMENT_UNDERPRICED];class si{constructor(){ni.checkAbstract(new.target,si),gr(this,"_isSigner",!0)}getBalance(t){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return ri(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield vr(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return ri(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield vr(this.checkTransaction(t));return yield this.provider.call(r,e)}))}sendTransaction(t){return ri(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),r=yield this.signTransaction(e);return yield this.provider.sendTransaction(r)}))}getChainId(){return ri(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return ri(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return ri(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===ii.indexOf(e)&&ni.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=wr(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&ni.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return ri(this,void 0,void 0,(function*(){const e=yield vr(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>ri(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&ni.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const r=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!r?0!==e.type&&1!==e.type||!r||ni.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):ni.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(r&&ni.throwError("network does not support EIP-1559",y.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):ni.throwError("failed to get consistent fee data",y.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(oi.indexOf(t.code)>=0)throw t;return ni.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",y.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&ni.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield vr(e)}))}_checkProvider(t){this.provider||ni.throwError("missing provider",y.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class ai extends si{constructor(t,e){super(),gr(this,"address",t),gr(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{ni.throwError(t,y.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new ai(this.address,t)}}var hi=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)})),ui=li;function li(t,e){if(!t)throw new Error(e||"Assertion failed")}function ci(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function fi(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function di(t){return 1===t.length?"0"+t:t}function pi(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}li.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var mi={inherits:o((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),toArray:function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):ci(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},toHex:function(t){for(var e="",r=0;r<t.length;r++)e+=di(t[r].toString(16));return e},htonl:fi,toHex32:function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=fi(i)),r+=pi(i.toString(16))}return r},zero2:di,zero8:pi,join32:function(t,e,r,n){var i=r-e;ui(i%4==0);for(var o=new Array(i/4),s=0,a=e;s<o.length;s++,a+=4){var h;h="big"===n?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],o[s]=h>>>0}return o},split32:function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},rotr32:function(t,e){return t>>>e|t<<32-e},rotl32:function(t,e){return t<<e|t>>>32-e},sum32:function(t,e){return t+e>>>0},sum32_3:function(t,e,r){return t+e+r>>>0},sum32_4:function(t,e,r,n){return t+e+r+n>>>0},sum32_5:function(t,e,r,n,i){return t+e+r+n+i>>>0},sum64:function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o<n?1:0)+r+i;t[e]=s>>>0,t[e+1]=o},sum64_hi:function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},sum64_lo:function(t,e,r,n){return e+n>>>0},sum64_4_hi:function(t,e,r,n,i,o,s,a){var h=0,u=e;return h+=(u=u+n>>>0)<e?1:0,h+=(u=u+o>>>0)<o?1:0,t+r+i+s+(h+=(u=u+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},sum64_5_hi:function(t,e,r,n,i,o,s,a,h,u){var l=0,c=e;return l+=(c=c+n>>>0)<e?1:0,l+=(c=c+o>>>0)<o?1:0,l+=(c=c+a>>>0)<a?1:0,t+r+i+s+h+(l+=(c=c+u>>>0)<u?1:0)>>>0},sum64_5_lo:function(t,e,r,n,i,o,s,a,h,u){return e+n+o+a+u>>>0},rotr64_hi:function(t,e,r){return(e<<32-r|t>>>r)>>>0},rotr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0},shr64_hi:function(t,e,r){return t>>>r},shr64_lo:function(t,e,r){return(t<<32-r|e>>>r)>>>0}};function gi(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var yi=gi;gi.prototype.update=function(t,e){if(t=mi.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=mi.join32(t,0,t.length-r,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this},gi.prototype.digest=function(t){return this.update(this._pad()),ui(null===this.pending),this._digest(t)},gi.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n};var vi={BlockHash:yi},wi=mi.rotr32;var bi=function(t,e,r,n){return 0===t?_i(e,r,n):1===t||3===t?Ai(e,r,n):2===t?Ei(e,r,n):void 0};function _i(t,e,r){return t&e^~t&r}function Ei(t,e,r){return t&e^t&r^e&r}function Ai(t,e,r){return t^e^r}var ki=function(t){return wi(t,2)^wi(t,13)^wi(t,22)};var Mi=function(t){return wi(t,6)^wi(t,11)^wi(t,25)};var xi=function(t){return wi(t,7)^wi(t,18)^t>>>3};var Si=function(t){return wi(t,17)^wi(t,19)^t>>>10},Ni={ft_1:bi,ch32:_i,maj32:Ei,p32:Ai,s0_256:ki,s1_256:Mi,g0_256:xi,g1_256:Si},Ii=mi.rotl32,Ci=mi.sum32,Ti=mi.sum32_5,Pi=Ni.ft_1,Ri=vi.BlockHash,Oi=[1518500249,1859775393,2400959708,3395469782];function $i(){if(!(this instanceof $i))return new $i;Ri.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}mi.inherits($i,Ri);var Bi=$i;$i.blockSize=512,$i.outSize=160,$i.hmacStrength=80,$i.padLength=64,$i.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=Ii(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4];for(n=0;n<r.length;n++){var u=~~(n/20),l=Ti(Ii(i,5),Pi(u,o,s,a),h,r[n],Oi[u]);h=a,a=s,s=Ii(o,30),o=i,i=l}this.h[0]=Ci(this.h[0],i),this.h[1]=Ci(this.h[1],o),this.h[2]=Ci(this.h[2],s),this.h[3]=Ci(this.h[3],a),this.h[4]=Ci(this.h[4],h)},$i.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")};var Di=mi.sum32,Fi=mi.sum32_4,Ui=mi.sum32_5,ji=Ni.ch32,Li=Ni.maj32,zi=Ni.s0_256,qi=Ni.s1_256,Vi=Ni.g0_256,Hi=Ni.g1_256,Gi=vi.BlockHash,Ki=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Zi(){if(!(this instanceof Zi))return new Zi;Gi.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Ki,this.W=new Array(64)}mi.inherits(Zi,Gi);var Ji=Zi;function Qi(){if(!(this instanceof Qi))return new Qi;Ji.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Zi.blockSize=512,Zi.outSize=256,Zi.hmacStrength=192,Zi.padLength=64,Zi.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=Fi(Hi(r[n-2]),r[n-7],Vi(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],h=this.h[4],u=this.h[5],l=this.h[6],c=this.h[7];for(ui(this.k.length===r.length),n=0;n<r.length;n++){var f=Ui(c,qi(h),ji(h,u,l),this.k[n],r[n]),d=Di(zi(i),Li(i,o,s));c=l,l=u,u=h,h=Di(a,f),a=s,s=o,o=i,i=Di(f,d)}this.h[0]=Di(this.h[0],i),this.h[1]=Di(this.h[1],o),this.h[2]=Di(this.h[2],s),this.h[3]=Di(this.h[3],a),this.h[4]=Di(this.h[4],h),this.h[5]=Di(this.h[5],u),this.h[6]=Di(this.h[6],l),this.h[7]=Di(this.h[7],c)},Zi.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")},mi.inherits(Qi,Ji);var Yi=Qi;Qi.blockSize=512,Qi.outSize=224,Qi.hmacStrength=192,Qi.padLength=64,Qi.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h.slice(0,7),"big"):mi.split32(this.h.slice(0,7),"big")};var Wi=mi.rotr64_hi,Xi=mi.rotr64_lo,to=mi.shr64_hi,eo=mi.shr64_lo,ro=mi.sum64,no=mi.sum64_hi,io=mi.sum64_lo,oo=mi.sum64_4_hi,so=mi.sum64_4_lo,ao=mi.sum64_5_hi,ho=mi.sum64_5_lo,uo=vi.BlockHash,lo=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function co(){if(!(this instanceof co))return new co;uo.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=lo,this.W=new Array(160)}mi.inherits(co,uo);var fo=co;function po(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function mo(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function go(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function yo(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function vo(t,e){var r=Wi(t,e,28)^Wi(e,t,2)^Wi(e,t,7);return r<0&&(r+=4294967296),r}function wo(t,e){var r=Xi(t,e,28)^Xi(e,t,2)^Xi(e,t,7);return r<0&&(r+=4294967296),r}function bo(t,e){var r=Wi(t,e,14)^Wi(t,e,18)^Wi(e,t,9);return r<0&&(r+=4294967296),r}function _o(t,e){var r=Xi(t,e,14)^Xi(t,e,18)^Xi(e,t,9);return r<0&&(r+=4294967296),r}function Eo(t,e){var r=Wi(t,e,1)^Wi(t,e,8)^to(t,e,7);return r<0&&(r+=4294967296),r}function Ao(t,e){var r=Xi(t,e,1)^Xi(t,e,8)^eo(t,e,7);return r<0&&(r+=4294967296),r}function ko(t,e){var r=Wi(t,e,19)^Wi(e,t,29)^to(t,e,6);return r<0&&(r+=4294967296),r}function Mo(t,e){var r=Xi(t,e,19)^Xi(e,t,29)^eo(t,e,6);return r<0&&(r+=4294967296),r}function xo(){if(!(this instanceof xo))return new xo;fo.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}co.blockSize=1024,co.outSize=512,co.hmacStrength=192,co.padLength=128,co.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=ko(r[n-4],r[n-3]),o=Mo(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],h=Eo(r[n-30],r[n-29]),u=Ao(r[n-30],r[n-29]),l=r[n-32],c=r[n-31];r[n]=oo(i,o,s,a,h,u,l,c),r[n+1]=so(i,o,s,a,h,u,l,c)}},co.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],h=this.h[5],u=this.h[6],l=this.h[7],c=this.h[8],f=this.h[9],d=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],v=this.h[15];ui(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var b=y,_=v,E=bo(c,f),A=_o(c,f),k=po(c,f,d,p,m),M=mo(c,f,d,p,m,g),x=this.k[w],S=this.k[w+1],N=r[w],I=r[w+1],C=ao(b,_,E,A,k,M,x,S,N,I),T=ho(b,_,E,A,k,M,x,S,N,I);b=vo(n,i),_=wo(n,i),E=go(n,i,o,s,a),A=yo(n,i,o,s,a,h);var P=no(b,_,E,A),R=io(b,_,E,A);y=m,v=g,m=d,g=p,d=c,p=f,c=no(u,l,C,T),f=io(l,l,C,T),u=a,l=h,a=o,h=s,o=n,s=i,n=no(C,T,P,R),i=io(C,T,P,R)}ro(this.h,0,n,i),ro(this.h,2,o,s),ro(this.h,4,a,h),ro(this.h,6,u,l),ro(this.h,8,c,f),ro(this.h,10,d,p),ro(this.h,12,m,g),ro(this.h,14,y,v)},co.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"big"):mi.split32(this.h,"big")},mi.inherits(xo,fo);var So=xo;xo.blockSize=1024,xo.outSize=384,xo.hmacStrength=192,xo.padLength=128,xo.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h.slice(0,12),"big"):mi.split32(this.h.slice(0,12),"big")};var No={sha1:Bi,sha224:Yi,sha256:Ji,sha384:So,sha512:fo},Io=mi.rotl32,Co=mi.sum32,To=mi.sum32_3,Po=mi.sum32_4,Ro=vi.BlockHash;function Oo(){if(!(this instanceof Oo))return new Oo;Ro.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}mi.inherits(Oo,Ro);var $o=Oo;function Bo(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function Do(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Fo(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}Oo.blockSize=512,Oo.outSize=160,Oo.hmacStrength=192,Oo.padLength=64,Oo.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],o=this.h[3],s=this.h[4],a=r,h=n,u=i,l=o,c=s,f=0;f<80;f++){var d=Co(Io(Po(r,Bo(f,n,i,o),t[Uo[f]+e],Do(f)),Lo[f]),s);r=s,s=o,o=Io(i,10),i=n,n=d,d=Co(Io(Po(a,Bo(79-f,h,u,l),t[jo[f]+e],Fo(f)),zo[f]),c),a=c,c=l,l=Io(u,10),u=h,h=d}d=To(this.h[1],i,l),this.h[1]=To(this.h[2],o,c),this.h[2]=To(this.h[3],s,a),this.h[3]=To(this.h[4],r,h),this.h[4]=To(this.h[0],n,u),this.h[0]=d},Oo.prototype._digest=function(t){return"hex"===t?mi.toHex32(this.h,"little"):mi.split32(this.h,"little")};var Uo=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],jo=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Lo=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],zo=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],qo={ripemd160:$o};function Vo(t,e,r){if(!(this instanceof Vo))return new Vo(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(mi.toArray(e,r))}var Ho=Vo;Vo.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),ui(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Vo.prototype.update=function(t,e){return this.inner.update(t,e),this},Vo.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};var Go=o((function(t,e){var r=e;r.utils=mi,r.common=vi,r.sha=No,r.ripemd=qo,r.hmac=Ho,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}));function Ko(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},t(r,r.exports),r.exports}var Zo=Jo;function Jo(t,e){if(!t)throw new Error(e||"Assertion failed")}Jo.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Qo=Ko((function(t,e){var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r<t.length;r++)e+=n(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n<t.length;n++)r[n]=0|t[n];return r}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(n=0;n<t.length;n++){var i=t.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}})),Yo=Ko((function(t,e){var r=e;r.assert=Zo,r.toArray=Qo.toArray,r.zero2=Qo.zero2,r.toHex=Qo.toHex,r.encode=Qo.encode,r.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,h=o.andln(i-1);o.isOdd()?(a=h>(i>>1)-1?(i>>1)-h:h,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,h=t.andln(3)+i&3,u=e.andln(3)+o&3;3===h&&(h=-1),3===u&&(u=-1),s=0==(1&h)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?h:-h,r[0].push(s),a=0==(1&u)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==h?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new hi(t,"hex","le")}})),Wo=Yo.getNAF,Xo=Yo.getJSF,ts=Yo.assert;function es(t,e){this.type=t,this.p=new hi(e.p,16),this.red=e.prime?hi.red(e.prime):hi.mont(this.p),this.zero=new hi(0).toRed(this.red),this.one=new hi(1).toRed(this.red),this.two=new hi(2).toRed(this.red),this.n=e.n&&new hi(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var rs=es;function ns(t,e){this.curve=t,this.type=e,this.precomputed=null}es.prototype.point=function(){throw new Error("Not implemented")},es.prototype.validate=function(){throw new Error("Not implemented")},es.prototype._fixedNafMul=function(t,e){ts(t.precomputed);var r=t._getDoubles(),n=Wo(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<n.length;o+=r.step){s=0;for(var h=o+r.step-1;h>=o;h--)s=(s<<1)+n[h];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),c=i;c>0;c--){for(o=0;o<a.length;o++)(s=a[o])===c?l=l.mixedAdd(r.points[o]):s===-c&&(l=l.mixedAdd(r.points[o].neg()));u=u.add(l)}return u.toP()},es.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Wo(e,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var h=0;a>=0&&0===o[a];a--)h++;if(a>=0&&h++,s=s.dblp(h),a<0)break;var u=o[a];ts(0!==u),s="affine"===t.type?u>0?s.mixedAdd(i[u-1>>1]):s.mixedAdd(i[-u-1>>1].neg()):u>0?s.add(i[u-1>>1]):s.add(i[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},es.prototype._wnafMulAdd=function(t,e,r,n,i){var o,s,a,h=this._wnafT1,u=this._wnafT2,l=this._wnafT3,c=0;for(o=0;o<n;o++){var f=(a=e[o])._getNAFPoints(t);h[o]=f.wnd,u[o]=f.points}for(o=n-1;o>=1;o-=2){var d=o-1,p=o;if(1===h[d]&&1===h[p]){var m=[e[d],null,null,e[p]];0===e[d].y.cmp(e[p].y)?(m[1]=e[d].add(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg())):0===e[d].y.cmp(e[p].y.redNeg())?(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].add(e[p].neg())):(m[1]=e[d].toJ().mixedAdd(e[p]),m[2]=e[d].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Xo(r[d],r[p]);for(c=Math.max(y[0].length,c),l[d]=new Array(c),l[p]=new Array(c),s=0;s<c;s++){var v=0|y[0][s],w=0|y[1][s];l[d][s]=g[3*(v+1)+(w+1)],l[p][s]=0,u[d]=m}}else l[d]=Wo(r[d],h[d],this._bitLength),l[p]=Wo(r[p],h[p],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[p].length,c)}var b=this.jpoint(null,null,null),_=this._wnafT4;for(o=c;o>=0;o--){for(var E=0;o>=0;){var A=!0;for(s=0;s<n;s++)_[s]=0|l[s][o],0!==_[s]&&(A=!1);if(!A)break;E++,o--}if(o>=0&&E++,b=b.dblp(E),o<0)break;for(s=0;s<n;s++){var k=_[s];0!==k&&(k>0?a=u[s][k-1>>1]:k<0&&(a=u[s][-k-1>>1].neg()),b="affine"===a.type?b.mixedAdd(a):b.add(a))}}for(o=0;o<n;o++)u[o]=null;return i?b:b.toP()},es.BasePoint=ns,ns.prototype.eq=function(){throw new Error("Not implemented")},ns.prototype.validate=function(){return this.curve.validate(this)},es.prototype.decodePoint=function(t,e){t=Yo.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?ts(t[t.length-1]%2==0):7===t[0]&&ts(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},ns.prototype.encodeCompressed=function(t){return this.encode(t,!0)},ns.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},ns.prototype.encode=function(t,e){return Yo.encode(this._encode(e),t)},ns.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},ns.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},ns.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)n=n.dbl();r.push(n)}return{step:t,points:r}},ns.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},ns.prototype._getBeta=function(){return null},ns.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var is=Ko((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),os=Yo.assert;function ss(t){rs.call(this,"short",t),this.a=new hi(t.a,16).toRed(this.red),this.b=new hi(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}is(ss,rs);var as=ss;function hs(t,e,r,n){rs.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new hi(e,16),this.y=new hi(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function us(t,e,r,n){rs.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new hi(0)):(this.x=new hi(e,16),this.y=new hi(r,16),this.z=new hi(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ss.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new hi(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new hi(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],os(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new hi(t.a,16),b:new hi(t.b,16)}})):this._getEndoBasis(r)}}},ss.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:hi.mont(t),r=new hi(2).toRed(e).redInvm(),n=r.redNeg(),i=new hi(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},ss.prototype._getEndoBasis=function(t){for(var e,r,n,i,o,s,a,h,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),c=t,f=this.n.clone(),d=new hi(1),p=new hi(0),m=new hi(0),g=new hi(1),y=0;0!==c.cmpn(0);){var v=f.div(c);h=f.sub(v.mul(c)),u=m.sub(v.mul(d));var w=g.sub(v.mul(p));if(!n&&h.cmp(l)<0)e=a.neg(),r=d,n=h.neg(),i=u;else if(n&&2==++y)break;a=h,f=c,c=h,m=d,d=u,g=p,p=w}o=h.neg(),s=u;var b=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(b)>=0&&(o=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},ss.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),h=i.mul(r.b),u=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:h.add(u).neg()}},ss.prototype.pointFromX=function(t,e){(t=new hi(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},ss.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},ss.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],h=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),h=h.neg(!0)),n[2*o]=a,n[2*o+1]=h,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var u=this._wnafMulAdd(1,n,i,2*o,r),l=0;l<2*o;l++)n[l]=null,i[l]=null;return u},is(hs,rs.BasePoint),ss.prototype.point=function(t,e,r){return new hs(this,t,e,r)},ss.prototype.pointFromJSON=function(t,e){return hs.fromJSON(this,t,e)},hs.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},hs.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},hs.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},hs.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},hs.prototype.isInfinity=function(){return this.inf},hs.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},hs.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},hs.prototype.getX=function(){return this.x.fromRed()},hs.prototype.getY=function(){return this.y.fromRed()},hs.prototype.mul=function(t){return t=new hi(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},hs.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},hs.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},hs.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},hs.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},hs.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},is(us,rs.BasePoint),ss.prototype.jpoint=function(t,e,r){return new us(this,t,e,r)},us.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},us.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},us.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),h=o.redSub(s);if(0===a.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=n.redMul(u),f=h.redSqr().redIAdd(l).redISub(c).redISub(c),d=h.redMul(c.redISub(f)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},us.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),u=h.redMul(s),l=r.redMul(h),c=a.redSqr().redIAdd(u).redISub(l).redISub(l),f=a.redMul(l.redISub(c)).redISub(i.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(c,f,d)},us.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,h=a.redSqr().redSqr(),u=s.redAdd(s);for(e=0;e<t;e++){var l=o.redSqr(),c=u.redSqr(),f=c.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(h)),p=o.redMul(c),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=d.redMul(g);y=y.redIAdd(y).redISub(f);var v=u.redMul(a);e+1<t&&(h=h.redMul(f)),o=m,a=v,u=y}return this.curve.jpoint(o,u.redMul(i),a)},us.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},us.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),h=a.redSqr().redISub(s).redISub(s),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=h,e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),c=this.y.redSqr(),f=c.redSqr(),d=this.x.redAdd(c).redSqr().redISub(l).redISub(f);d=d.redIAdd(d);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=f.redIAdd(f);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},us.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),h=a.redSqr().redISub(s).redISub(s);t=h;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=a.redMul(s.redISub(h)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),c=this.y.redSqr(),f=this.x.redMul(c),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var p=f.redIAdd(f),m=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(l);var g=c.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},us.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),h=e.redAdd(e),u=(h=h.redIAdd(h)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),c=u.redISub(l),f=s.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=a.redMul(c).redISub(f),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,d,p)},us.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),h=n.redIAdd(n);h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var u=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(h),l=e.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var c=this.x.redMul(a).redISub(l);c=(c=c.redIAdd(c)).redIAdd(c);var f=this.y.redMul(u.redMul(h.redISub(u)).redISub(s.redMul(a)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var d=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(c,f,d)},us.prototype.mul=function(t,e){return t=new hi(t,e),this.curve._wnafMul(this,t)},us.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},us.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},us.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},us.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ls=Ko((function(t,e){var r=e;r.base=rs,r.short=as,r.mont=null,r.edwards=null})),cs=Ko((function(t,e){var r,n=e,i=Yo.assert;function o(t){"short"===t.type?this.curve=new ls.short(t):"edwards"===t.type?this.curve=new ls.edwards(t):this.curve=new ls.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new o(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Go.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Go.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Go.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Go.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Go.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Go.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Go.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(t){r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Go.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function fs(t){if(!(this instanceof fs))return new fs(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Qo.toArray(t.entropy,t.entropyEnc||"hex"),r=Qo.toArray(t.nonce,t.nonceEnc||"hex"),n=Qo.toArray(t.pers,t.persEnc||"hex");Zo(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var ds=fs;fs.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},fs.prototype._hmac=function(){return new Go.hmac(this.hash,this.K)},fs.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},fs.prototype.reseed=function(t,e,r,n){"string"!=typeof e&&(n=r,r=e,e=null),t=Qo.toArray(t,e),r=Qo.toArray(r,n),Zo(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},fs.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=Qo.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(r),this._reseed++,Qo.encode(o,e)};var ps=Yo.assert;function ms(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var gs=ms;ms.fromPublic=function(t,e,r){return e instanceof ms?e:new ms(t,{pub:e,pubEnc:r})},ms.fromPrivate=function(t,e,r){return e instanceof ms?e:new ms(t,{priv:e,privEnc:r})},ms.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},ms.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},ms.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},ms.prototype._importPrivate=function(t,e){this.priv=new hi(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},ms.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?ps(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||ps(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},ms.prototype.derive=function(t){return t.validate()||ps(t.validate(),"public point not validated"),t.mul(this.priv).getX()},ms.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},ms.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},ms.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var ys=Yo.assert;function vs(t,e){if(t instanceof vs)return t;this._importDER(t,e)||(ys(t.r&&t.s,"Signature without r or s"),this.r=new hi(t.r,16),this.s=new hi(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var ws=vs;function bs(){this.place=0}function _s(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o<n;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function Es(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function As(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}vs.prototype._importDER=function(t,e){t=Yo.toArray(t,e);var r=new bs;if(48!==t[r.place++])return!1;var n=_s(t,r);if(!1===n)return!1;if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var i=_s(t,r);if(!1===i)return!1;var o=t.slice(r.place,i+r.place);if(r.place+=i,2!==t[r.place++])return!1;var s=_s(t,r);if(!1===s)return!1;if(t.length!==s+r.place)return!1;var a=t.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new hi(o),this.s=new hi(a),this.recoveryParam=null,!0},vs.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=Es(e),r=Es(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];As(n,e.length),(n=n.concat(e)).push(2),As(n,r.length);var i=n.concat(r),o=[48];return As(o,i.length),o=o.concat(i),Yo.encode(o,t)};var ks=function(){throw new Error("unsupported")},Ms=Yo.assert;function xs(t){if(!(this instanceof xs))return new xs(t);"string"==typeof t&&(Ms(Object.prototype.hasOwnProperty.call(cs,t),"Unknown curve "+t),t=cs[t]),t instanceof cs.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Ss=xs;xs.prototype.keyPair=function(t){return new gs(this,t)},xs.prototype.keyFromPrivate=function(t,e){return gs.fromPrivate(this,t,e)},xs.prototype.keyFromPublic=function(t,e){return gs.fromPublic(this,t,e)},xs.prototype.genKeyPair=function(t){t||(t={});for(var e=new ds({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||ks(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new hi(2));;){var i=new hi(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},xs.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},xs.prototype.sign=function(t,e,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new hi(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),s=t.toArray("be",i),a=new ds({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new hi(1)),u=0;;u++){var l=n.k?n.k(u):new hi(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var c=this.g.mul(l);if(!c.isInfinity()){var f=c.getX(),d=f.umod(this.n);if(0!==d.cmpn(0)){var p=l.invm(this.n).mul(d.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(c.getY().isOdd()?1:0)|(0!==f.cmp(d)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new ws({r:d,s:p,recoveryParam:m})}}}}}},xs.prototype.verify=function(t,e,r,n){t=this._truncateToN(new hi(t,16)),r=this.keyFromPublic(r,n);var i=(e=new ws(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,a=o.invm(this.n),h=a.mul(t).umod(this.n),u=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(h,r.getPublic(),u)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(h,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},xs.prototype.recoverPubKey=function(t,e,r,n){Ms((3&r)===r,"The recovery param is more than two bits"),e=new ws(e,n);var i=this.n,o=new hi(t),s=e.r,a=e.s,h=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var l=e.r.invm(i),c=i.sub(o).mul(l).umod(i),f=a.mul(l).umod(i);return this.g.mulAdd(c,s,f)},xs.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new ws(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Ns=Ko((function(t,e){var r=e;r.version="6.5.4",r.utils=Yo,r.rand=function(){throw new Error("unsupported")},r.curve=ls,r.curves=cs,r.ec=Ss,r.eddsa=null})).ec;const Is=new y("signing-key/5.6.2");let Cs=null;function Ts(){return Cs||(Cs=new Ns("secp256k1")),Cs}class Ps{constructor(t){gr(this,"curve","secp256k1"),gr(this,"privateKey",I(t)),32!==C(this.privateKey)&&Is.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=Ts().keyFromPrivate(k(this.privateKey));gr(this,"publicKey","0x"+e.getPublic(!1,"hex")),gr(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),gr(this,"_isSigningKey",!0)}_addPoint(t){const e=Ts().keyFromPublic(k(this.publicKey)),r=Ts().keyFromPublic(k(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=Ts().keyFromPrivate(k(this.privateKey)),r=k(t);32!==r.length&&Is.throwArgumentError("bad digest length","digest",t);const n=e.sign(r,{canonical:!0});return $({recoveryParam:n.recoveryParam,r:O("0x"+n.r.toString(16),32),s:O("0x"+n.s.toString(16),32)})}computeSharedSecret(t){const e=Ts().keyFromPrivate(k(this.privateKey)),r=Ts().keyFromPublic(k(Rs(t)));return O("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function Rs(t,e){const r=k(t);if(32===r.length){const t=new Ps(r);return e?"0x"+Ts().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?I(r):"0x"+Ts().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+Ts().keyFromPublic(r).getPublic(!0,"hex"):I(r):Is.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Os=new y("transactions/5.6.2");var $s;function Bs(t){return"0x"===t?null:Pe(t)}function Ds(t){return"0x"===t?fn:qt.from(t)}function Fs(t,e){return function(t){return Pe(T(we(T(Rs(t),1)),12))}(function(t,e){const r=$(e),n={r:k(r.r),s:k(r.s)};return"0x"+Ts().recoverPubKey(k(t),n,r.recoveryParam).encode("hex",!1)}(k(t),e))}function Us(t,e){const r=x(qt.from(t).toHexString());return r.length>32&&Os.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function js(t,e){return{address:Pe(t),storageKeys:(e||[]).map(((e,r)=>(32!==C(e)&&Os.throwArgumentError("invalid access list storageKey",`accessList[${t}:${r}]`,e),e.toLowerCase())))}}function Ls(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&Os.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),js(t[0],t[1])):js(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const r=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return js(e,Object.keys(r).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function zs(t){return Ls(t).map((t=>[t.address,t.storageKeys]))}function qs(t,e){if(null!=t.gasPrice){const e=qt.from(t.gasPrice),r=qt.from(t.maxFeePerGas||0);e.eq(r)||Os.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:r})}const r=[Us(t.chainId||0,"chainId"),Us(t.nonce||0,"nonce"),Us(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Us(t.maxFeePerGas||0,"maxFeePerGas"),Us(t.gasLimit||0,"gasLimit"),null!=t.to?Pe(t.to):"0x",Us(t.value||0,"value"),t.data||"0x",zs(t.accessList||[])];if(e){const t=$(e);r.push(Us(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return P(["0x02",ke(r)])}function Vs(t,e){const r=[Us(t.chainId||0,"chainId"),Us(t.nonce||0,"nonce"),Us(t.gasPrice||0,"gasPrice"),Us(t.gasLimit||0,"gasLimit"),null!=t.to?Pe(t.to):"0x",Us(t.value||0,"value"),t.data||"0x",zs(t.accessList||[])];if(e){const t=$(e);r.push(Us(t.recoveryParam,"recoveryParam")),r.push(x(t.r)),r.push(x(t.s))}return P(["0x01",ke(r)])}function Hs(t,e,r){try{const r=Ds(e[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");t.v=r}catch(t){Os.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=O(e[1],32),t.s=O(e[2],32);try{const e=we(r(t));t.from=Fs(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function Gs(t){const e=k(t);if(e[0]>127)return function(t){const e=Se(t);9!==e.length&&6!==e.length&&Os.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:Ds(e[0]).toNumber(),gasPrice:Ds(e[1]),gasLimit:Ds(e[2]),to:Bs(e[3]),value:Ds(e[4]),data:e[5],chainId:0};if(6===e.length)return r;try{r.v=qt.from(e[6]).toNumber()}catch(t){return r}if(r.r=O(e[7],32),r.s=O(e[8],32),qt.from(r.r).isZero()&&qt.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);0!==r.chainId&&(i.push(I(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=we(ke(i));try{r.from=Fs(o,{r:I(r.r),s:I(r.s),recoveryParam:n})}catch(t){}r.hash=we(t)}return r.type=null,r}(e);switch(e[0]){case 1:return function(t){const e=Se(t.slice(1));8!==e.length&&11!==e.length&&Os.throwArgumentError("invalid component count for transaction type: 1","payload",I(t));const r={type:1,chainId:Ds(e[0]).toNumber(),nonce:Ds(e[1]).toNumber(),gasPrice:Ds(e[2]),gasLimit:Ds(e[3]),to:Bs(e[4]),value:Ds(e[5]),data:e[6],accessList:Ls(e[7])};return 8===e.length||(r.hash=we(t),Hs(r,e.slice(8),Vs)),r}(e);case 2:return function(t){const e=Se(t.slice(1));9!==e.length&&12!==e.length&&Os.throwArgumentError("invalid component count for transaction type: 2","payload",I(t));const r=Ds(e[2]),n=Ds(e[3]),i={type:2,chainId:Ds(e[0]).toNumber(),nonce:Ds(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Ds(e[4]),to:Bs(e[5]),value:Ds(e[6]),data:e[7],accessList:Ls(e[8])};return 9===e.length||(i.hash=we(t),Hs(i,e.slice(9),qs)),i}(e)}return Os.throwError(`unsupported transaction type: ${e[0]}`,y.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}($s||($s={}));var Ks=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const Zs=new y("contracts/5.6.2");function Js(t,e){return Ks(this,void 0,void 0,(function*(){const r=yield e;"string"!=typeof r&&Zs.throwArgumentError("invalid address or ENS name","name",r);try{return Pe(r)}catch(t){}t||Zs.throwError("a provider or signer is needed to resolve ENS names",y.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return null==n&&Zs.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function Qs(t,e,r){return Ks(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>Qs(t,Array.isArray(e)?e[n]:e[r.name],r)))):"address"===r.type?yield Js(t,e):"tuple"===r.type?yield Qs(t,e,r.components):"array"===r.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>Qs(t,e,r.arrayChildren)))):Promise.reject(Zs.makeError("invalid value for array",y.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function Ys(t,e,r){return Ks(this,void 0,void 0,(function*(){let n={};r.length===e.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=wr(r.pop())),Zs.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=vr({override:Js(t.signer,n.from),signer:t.signer.getAddress()}).then((t=>Ks(this,void 0,void 0,(function*(){return Pe(t.signer)!==t.override&&Zs.throwError("Contract with a Signer cannot override from",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):n.from=t.signer.getAddress():n.from&&(n.from=Js(t.provider,n.from));const i=yield vr({args:Qs(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:vr(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=qt.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=qt.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=qt.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=qt.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=qt.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=Ls(a.accessList)),null==s.gasLimit&&null!=e.gas){let t=21e3;const r=k(o);for(let e=0;e<r.length;e++)t+=4,r[e]&&(t+=64);s.gasLimit=qt.from(e.gas).add(t)}if(a.value){const t=qt.from(a.value);t.isZero()||e.payable||Zs.throwError("non-payable method cannot override value",y.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),s.value=t}a.customData&&(s.customData=wr(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const h=Object.keys(n).filter((t=>null!=n[t]));return h.length&&Zs.throwError(`cannot override ${h.map((t=>JSON.stringify(t))).join(",")}`,y.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:h}),s}))}function Ws(t,e,r){const n=t.signer||t.provider;return function(...i){return Ks(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=wr(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const s=yield Ys(t,e,i),a=yield n.call(s,o);try{let n=t.interface.decodeFunctionResult(e,a);return r&&1===e.outputs.length&&(n=n[0]),n}catch(e){throw e.code===y.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=s),e}}))}}function Xs(t,e){return function(...r){return Ks(this,void 0,void 0,(function*(){t.signer||Zs.throwError("sending a transaction requires a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const n=yield Ys(t,e,r),i=yield t.signer.sendTransaction(n);return function(t,e){const r=e.wait.bind(e);e.wait=e=>r(e).then((e=>(e.events=e.logs.map((r=>{let n=Ar(r),i=null;try{i=t.interface.parseLog(r)}catch(t){}return i&&(n.args=i.args,n.decode=(e,r)=>t.interface.decodeEventLog(i.eventFragment,e,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>t.provider,n.getBlock=()=>t.provider.getBlock(e.blockHash),n.getTransaction=()=>t.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(e),n})),e)))}(t,i),i}))}}function ta(t,e,r){return e.constant?Ws(t,e,r):Xs(t,e)}function ea(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class ra{constructor(t,e){gr(this,"tag",t),gr(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((r=>!(!e&&r.listener===t)||(e=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const r=t.slice();return setTimeout((()=>{e.listener.apply(this,r)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class na extends ra{constructor(){super("error",null)}}class ia extends ra{constructor(t,e,r,n){const i={address:t};let o=e.getEventTopic(r);n?(o!==n[0]&&Zs.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(ea(i),i),gr(this,"address",t),gr(this,"interface",e),gr(this,"fragment",r)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],r=function(t,n){if(Array.isArray(n))for(let i in n){const o=t.slice();o.push(i);try{r(o,n[i])}catch(t){e.push({path:o,error:t})}}};return r([],t),e}(t.args);if(e.length)throw e[0].error;const r=(t.args||[]).slice();return r.push(t),r}}class oa extends ra{constructor(t,e){super("*",{address:t}),gr(this,"address",t),gr(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,r)=>this.interface.decodeEventLog(e.eventFragment,t,r),t.args=e.args}catch(t){}}}class sa extends class{constructor(t,e,r){gr(this,"interface",yr(new.target,"getInterface")(e)),null==r?(gr(this,"provider",null),gr(this,"signer",null)):si.isSigner(r)?(gr(this,"provider",r.provider||null),gr(this,"signer",r)):ei.isProvider(r)?(gr(this,"provider",r),gr(this,"signer",null)):Zs.throwArgumentError("invalid signer or provider","signerOrProvider",r),gr(this,"callStatic",{}),gr(this,"estimateGas",{}),gr(this,"functions",{}),gr(this,"populateTransaction",{}),gr(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const r=this.interface.events[e];gr(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,t)}))),t[r.name]||(t[r.name]=[]),t[r.name].push(e)})),Object.keys(t).forEach((e=>{const r=t[e];1===r.length?gr(this.filters,e,this.filters[r[0]]):Zs.warn(`Duplicate definition of ${e} (${r.join(", ")})`)}))}if(gr(this,"_runningEvents",{}),gr(this,"_wrappedEmits",{}),null==t&&Zs.throwArgumentError("invalid contract address or ENS name","addressOrName",t),gr(this,"address",t),this.provider)gr(this,"resolvedAddress",Js(this.provider,t));else try{gr(this,"resolvedAddress",Promise.resolve(Pe(t)))}catch(t){Zs.throwError("provider is required to use ENS name as contract address",y.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])Zs.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const r=e.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(t)}null==this[t]&&gr(this,t,ta(this,e,!0)),null==this.functions[t]&&gr(this.functions,t,ta(this,e,!1)),null==this.callStatic[t]&&gr(this.callStatic,t,Ws(this,e,!0)),null==this.populateTransaction[t]&&gr(this.populateTransaction,t,function(t,e){return function(...r){return Ys(t,e,r)}}(this,e)),null==this.estimateGas[t]&&gr(this.estimateGas,t,function(t,e){const r=t.signer||t.provider;return function(...n){return Ks(this,void 0,void 0,(function*(){r||Zs.throwError("estimate require a provider or signer",y.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Ys(t,e,n);return yield r.estimateGas(i)}))}}(this,e))}})),Object.keys(n).forEach((t=>{const e=n[t];if(e.length>1)return;t=t.substring(1);const r=e[0];try{null==this[t]&&gr(this,t,this[r])}catch(t){}null==this.functions[t]&&gr(this.functions,t,this.functions[r]),null==this.callStatic[t]&&gr(this.callStatic,t,this.callStatic[r]),null==this.populateTransaction[t]&&gr(this.populateTransaction,t,this.populateTransaction[r]),null==this.estimateGas[t]&&gr(this.estimateGas,t,this.estimateGas[r])}))}static getContractAddress(t){return Oe(t)}static getInterface(t){return Yn.isInterface(t)?t:new Yn(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,t).then((t=>("0x"===t&&Zs.throwError("contract not deployed",y.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||Zs.throwError("sending a transactions require a signer",y.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=wr(t||{});return["from","to"].forEach((function(t){null!=e[t]&&Zs.throwError("cannot override "+t,y.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new ai(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&gr(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return Zn.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new na);if("event"===t)return this._normalizeRunningEvent(new ra("event",null));if("*"===t)return this._normalizeRunningEvent(new oa(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new ia(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new ia(this.address,this.interface,r,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new ra(ea(e),e))}return this._normalizeRunningEvent(new oa(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,r){const n=Ar(e);return n.removeListener=()=>{r&&(t.removeListener(r),this._checkRunningEvents(t))},n.getBlock=()=>this.provider.getBlock(e.blockHash),n.getTransaction=()=>this.provider.getTransaction(e.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(n),n}_addEventListener(t,e,r){if(this.provider||Zs.throwError("events require a provider or a signer with a provider",y.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,r),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const r=r=>{let n=this._wrapEvent(t,r,e);if(null==n.decodeError)try{const e=t.getEmit(n);this.emit(t.filter,...e)}catch(t){n.decodeError=t.error}null!=t.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[t.tag]=r,null!=t.filter&&this.provider.on(t.filter,r)}}queryFilter(t,e,r){const n=this._getRunningEvent(t),i=wr(n.filter);return"string"==typeof e&&S(e,32)?(null!=r&&Zs.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(n,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const r=this._getRunningEvent(t),n=r.run(e)>0;return this._checkRunningEvents(r),n}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const r=this._getRunningEvent(t);return r.removeListener(e),this._checkRunningEvents(r),this}removeListener(t,e){return this.off(t,e)}}{}var aa=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));let ha=!1,ua=!1;const la={debug:1,default:2,info:2,warning:3,error:4,off:5};let ca=la.default,fa=null;const da=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 pa,ma;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(pa||(pa={})),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",t.ACTION_REJECTED="ACTION_REJECTED"}(ma||(ma={}));const ga="0123456789abcdef";class ya{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==la[r]&&this.throwArgumentError("invalid log level name","logLevel",t),ca>la[r]||console.log.apply(console,e)}debug(...t){this._log(ya.levels.DEBUG,t)}info(...t){this._log(ya.levels.INFO,t)}warn(...t){this._log(ya.levels.WARNING,t)}makeError(t,e,r){if(ua)return this.makeError("censored error",e,{});e||(e=ya.errors.UNKNOWN_ERROR),r||(r={});const n=[];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+=ga[e[t]>>4],r+=ga[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case ma.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 ma.CALL_EXCEPTION:case ma.INSUFFICIENT_FUNDS:case ma.MISSING_NEW:case ma.NONCE_EXPIRED:case ma.REPLACEMENT_UNDERPRICED:case ma.TRANSACTION_REPLACED:case ma.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,ya.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){da&&this.throwError("platform missing String.prototype.normalize",ya.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:da})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,ya.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,ya.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,ya.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,ya.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",ya.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",ya.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",ya.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return fa||(fa=new ya("logger/5.7.0")),fa}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",ya.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ha){if(!t)return;this.globalLogger().throwError("error censorship permanent",ya.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ua=!!t,ha=!!e}static setLogLevel(t){const e=la[t.toLowerCase()];null!=e?ca=e:ya.globalLogger().warn("invalid log level - "+t)}static from(t){return new ya(t)}}ya.errors=ma,ya.levels=pa;const va=new ya("bytes/5.7.0");function wa(t){return!!t.toHexString}function ba(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return ba(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function _a(t){return"number"==typeof t&&t==t&&t%1==0}function Ea(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!_a(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!_a(r)||r<0||r>=256)return!1}return!0}function Aa(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const ka="0123456789abcdef";function Ma(t,e){if(e||(e={}),"number"==typeof t){va.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=ka[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),wa(t))return t.toHexString();if(Aa(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":va.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ea(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=ka[(240&n)>>4]+ka[15&n]}return e}return va.throwArgumentError("invalid hexlify value","value",t)}function xa(t,e){for("string"!=typeof t?t=Ma(t):Aa(t)||va.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&va.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const Sa="bignumber/5.7.0";var Na=aa.BN;const Ia=new ya(Sa),Ca={},Ta=9007199254740991;let Pa=!1;class Ra{constructor(t,e){t!==Ca&&Ia.throwError("cannot call constructor directly; use BigNumber.from",ya.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return $a(Ba(this).fromTwos(t))}toTwos(t){return $a(Ba(this).toTwos(t))}abs(){return"-"===this._hex[0]?Ra.from(this._hex.substring(1)):this}add(t){return $a(Ba(this).add(Ba(t)))}sub(t){return $a(Ba(this).sub(Ba(t)))}div(t){return Ra.from(t).isZero()&&Da("division-by-zero","div"),$a(Ba(this).div(Ba(t)))}mul(t){return $a(Ba(this).mul(Ba(t)))}mod(t){const e=Ba(t);return e.isNeg()&&Da("division-by-zero","mod"),$a(Ba(this).umod(e))}pow(t){const e=Ba(t);return e.isNeg()&&Da("negative-power","pow"),$a(Ba(this).pow(e))}and(t){const e=Ba(t);return(this.isNegative()||e.isNeg())&&Da("unbound-bitwise-result","and"),$a(Ba(this).and(e))}or(t){const e=Ba(t);return(this.isNegative()||e.isNeg())&&Da("unbound-bitwise-result","or"),$a(Ba(this).or(e))}xor(t){const e=Ba(t);return(this.isNegative()||e.isNeg())&&Da("unbound-bitwise-result","xor"),$a(Ba(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Da("negative-width","mask"),$a(Ba(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Da("negative-width","shl"),$a(Ba(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Da("negative-width","shr"),$a(Ba(this).shrn(t))}eq(t){return Ba(this).eq(Ba(t))}lt(t){return Ba(this).lt(Ba(t))}lte(t){return Ba(this).lte(Ba(t))}gt(t){return Ba(this).gt(Ba(t))}gte(t){return Ba(this).gte(Ba(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Ba(this).isZero()}toNumber(){try{return Ba(this).toNumber()}catch(t){Da("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return Ia.throwError("this platform does not support BigInt",ya.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Pa||(Pa=!0,Ia.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ia.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ya.errors.UNEXPECTED_ARGUMENT,{}):Ia.throwError("BigNumber.toString does not accept parameters",ya.errors.UNEXPECTED_ARGUMENT,{})),Ba(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ra)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Ra(Ca,Oa(t)):t.match(/^-?[0-9]+$/)?new Ra(Ca,Oa(new Na(t))):Ia.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Da("underflow","BigNumber.from",t),(t>=Ta||t<=-Ta)&&Da("overflow","BigNumber.from",t),Ra.from(String(t));const e=t;if("bigint"==typeof e)return Ra.from(e.toString());if(Ea(e))return Ra.from(Ma(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Ra.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Aa(t)||"-"===t[0]&&Aa(t.substring(1))))return Ra.from(t)}return Ia.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Oa(t){if("string"!=typeof t)return Oa(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ia.throwArgumentError("invalid hex","value",t),"0x00"===(t=Oa(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 $a(t){return Ra.from(Oa(t))}function Ba(t){const e=Ra.from(t).toHexString();return"-"===e[0]?new Na("-"+e.substring(3),16):new Na(e.substring(2),16)}function Da(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),Ia.throwError(t,ya.errors.NUMERIC_FAULT,n)}const Fa=new ya(Sa),Ua={},ja=Ra.from(0),La=Ra.from(-1);function za(t,e,r,n){const i={fault:e,operation:r};return void 0!==n&&(i.value=n),Fa.throwError(t,ya.errors.NUMERIC_FAULT,i)}let qa="0";for(;qa.length<256;)qa+=qa;function Va(t){if("number"!=typeof t)try{t=Ra.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+qa.substring(0,t):Fa.throwArgumentError("invalid decimal size","decimals",t)}function Ha(t,e){null==e&&(e=0);const r=Va(e),n=(t=Ra.from(t)).lt(ja);n&&(t=t.mul(La));let i=t.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=t.div(r).toString();return t=1===r.length?o:o+"."+i,n&&(t="-"+t),t}function Ga(t,e){null==e&&(e=0);const r=Va(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||Fa.throwArgumentError("invalid decimal value","value",t);const n="-"===t.substring(0,1);n&&(t=t.substring(1)),"."===t&&Fa.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&Fa.throwArgumentError("too many decimal points","value",t);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&za("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Ra.from(o),h=Ra.from(s);let u=a.mul(r).add(h);return n&&(u=u.mul(La)),u}class Ka{constructor(t,e,r,n){t!==Ua&&Fa.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ya.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=n,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=Va(n),Object.freeze(this)}static from(t){if(t instanceof Ka)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,n=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Fa.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(t){const i=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&Fa.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&Fa.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Fa.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Ka(Ua,e,r,n)}}class Za{constructor(t,e,r,n){t!==Ua&&Fa.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ya.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Fa.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=Ga(this._value,this.format.decimals),r=Ga(t._value,t.format.decimals);return Za.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Za.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(Ja.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=Za.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(Ja.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Fa.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=Za.from("1"+qa.substring(0,t),this.format),n=Qa.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&Fa.throwArgumentError("invalid byte width","width",t);return xa(Ra.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return Za.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||function(t){return null!=t&&(Ra.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Aa(t)||"bigint"==typeof t||Ea(t))}(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),Za.fromString(Ha(t,e),Ka.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=Ka.from(e),n=Ga(t,r.decimals);!r.signed&&n.lt(ja)&&za("unsigned value cannot be negative","overflow","value",t);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=xa(i,r.width/8));const o=Ha(n,r.decimals);return new Za(Ua,i,o,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=Ka.from(e);if(function(t,e){if(e||(e={}),"number"==typeof t){va.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),ba(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wa(t)&&(t=t.toHexString()),Aa(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":va.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return ba(new Uint8Array(n))}return Ea(t)?ba(new Uint8Array(t)):va.throwArgumentError("invalid arrayify value","value",t)}(t).length>r.width/8)throw new Error("overflow");let n=Ra.from(t);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=Ha(n,r.decimals);return new Za(Ua,i,o,r)}static from(t,e){if("string"==typeof t)return Za.fromString(t,e);if(Ea(t))return Za.fromBytes(t,e);try{return Za.fromValue(t,0,e)}catch(t){if(t.code!==ya.errors.INVALID_ARGUMENT)throw t}return Fa.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const Ja=Za.from(1),Qa=Za.from("0.5"),Ya=new ya("units/5.7.0"),Wa=["wei","kwei","mwei","gwei","szabo","finney","ether"];let Xa=!1,th=!1;const eh={debug:1,default:2,info:2,warning:3,error:4,off:5};let rh=eh.default,nh=null;const ih=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 oh,sh;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(oh||(oh={})),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",t.ACTION_REJECTED="ACTION_REJECTED"}(sh||(sh={}));const ah="0123456789abcdef";class hh{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==eh[r]&&this.throwArgumentError("invalid log level name","logLevel",t),rh>eh[r]||console.log.apply(console,e)}debug(...t){this._log(hh.levels.DEBUG,t)}info(...t){this._log(hh.levels.INFO,t)}warn(...t){this._log(hh.levels.WARNING,t)}makeError(t,e,r){if(th)return this.makeError("censored error",e,{});e||(e=hh.errors.UNKNOWN_ERROR),r||(r={});const n=[];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+=ah[e[t]>>4],r+=ah[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const i=t;let o="";switch(e){case sh.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 sh.CALL_EXCEPTION:case sh.INSUFFICIENT_FUNDS:case sh.MISSING_NEW:case sh.NONCE_EXPIRED:case sh.REPLACEMENT_UNDERPRICED:case sh.TRANSACTION_REPLACED:case sh.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(t+=" ("+n.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(r).forEach((function(t){s[t]=r[t]})),s}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,hh.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){ih&&this.throwError("platform missing String.prototype.normalize",hh.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ih})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,hh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,hh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,hh.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,hh.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",hh.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",hh.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",hh.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return nh||(nh=new hh("logger/5.7.0")),nh}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",hh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Xa){if(!t)return;this.globalLogger().throwError("error censorship permanent",hh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}th=!!t,Xa=!!e}static setLogLevel(t){const e=eh[t.toLowerCase()];null!=e?rh=e:hh.globalLogger().warn("invalid log level - "+t)}static from(t){return new hh(t)}}hh.errors=sh,hh.levels=oh;const uh=new hh("bytes/5.7.0");function lh(t){return!!t.toHexString}function ch(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return ch(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function fh(t){return"number"==typeof t&&t==t&&t%1==0}function dh(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!fh(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!fh(r)||r<0||r>=256)return!1}return!0}function ph(t,e){if(e||(e={}),"number"==typeof t){uh.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),ch(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),lh(t)&&(t=t.toHexString()),gh(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":uh.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let t=0;t<r.length;t+=2)n.push(parseInt(r.substring(t,t+2),16));return ch(new Uint8Array(n))}return dh(t)?ch(new Uint8Array(t)):uh.throwArgumentError("invalid arrayify value","value",t)}function mh(t){const e=t.map((t=>ph(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),ch(n)}function gh(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const yh="0123456789abcdef";function vh(t,e){if(e||(e={}),"number"==typeof t){uh.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=yh[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),lh(t))return t.toHexString();if(gh(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":uh.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(dh(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=yh[(240&n)>>4]+yh[15&n]}return e}return uh.throwArgumentError("invalid hexlify value","value",t)}function wh(t){let e="0x";return t.forEach((t=>{e+=vh(t).substring(2)})),e}function bh(t,e){for("string"!=typeof t?t=vh(t):gh(t)||uh.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&uh.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function _h(t){return"0x"+ve.keccak_256(ph(t))}var Eh=o((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Bt.Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function h(t,e,n,i){for(var o=0,s=0,a=Math.min(t.length,n),h=e;h<a;h++){var u=t.charCodeAt(h)-48;o*=i,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<i,"Invalid character"),o+=s}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},i.prototype._initNumber=function(t,e,n){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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){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 i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)s=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,l=r;l<a;l+=n)u=h(t,l,l+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=h(t,l,t.length,e),l=0;l<s;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},i.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},i.prototype._move=function(t){u(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.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"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?c[6-h.length]+h+n:h+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=d[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);n=(p=p.idivn(l)).isZero()?m+n:c[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,h=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=h>>>26,c=67108863&h,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}i.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.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},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.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()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,r,n;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,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.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)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,h=r.words,u=0,l=0|s[0],c=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],y=8191&g,v=g>>>13,w=0|s[3],b=8191&w,_=w>>>13,E=0|s[4],A=8191&E,k=E>>>13,M=0|s[5],x=8191&M,S=M>>>13,N=0|s[6],I=8191&N,C=N>>>13,T=0|s[7],P=8191&T,R=T>>>13,O=0|s[8],$=8191&O,B=O>>>13,D=0|s[9],F=8191&D,U=D>>>13,j=0|a[0],L=8191&j,z=j>>>13,q=0|a[1],V=8191&q,H=q>>>13,G=0|a[2],K=8191&G,Z=G>>>13,J=0|a[3],Q=8191&J,Y=J>>>13,W=0|a[4],X=8191&W,tt=W>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ht=8191&at,ut=at>>>13,lt=0|a[8],ct=8191<,ft=lt>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(n=Math.imul(c,L))|0)+((8191&(i=(i=Math.imul(c,z))+Math.imul(f,L)|0))<<13)|0;u=((o=Math.imul(f,z))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,L),i=(i=Math.imul(p,z))+Math.imul(m,L)|0,o=Math.imul(m,z);var yt=(u+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,H)|0)+Math.imul(f,V)|0))<<13)|0;u=((o=o+Math.imul(f,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,L),i=(i=Math.imul(y,z))+Math.imul(v,L)|0,o=Math.imul(v,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,H)|0;var vt=(u+(n=n+Math.imul(c,K)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(f,K)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(b,L),i=(i=Math.imul(b,z))+Math.imul(_,L)|0,o=Math.imul(_,z),n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,H)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,Z)|0;var wt=(u+(n=n+Math.imul(c,Q)|0)|0)+((8191&(i=(i=i+Math.imul(c,Y)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(A,L),i=(i=Math.imul(A,z))+Math.imul(k,L)|0,o=Math.imul(k,z),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Y)|0;var bt=(u+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,L),i=(i=Math.imul(x,z))+Math.imul(S,L)|0,o=Math.imul(S,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(u+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,L),i=(i=Math.imul(I,z))+Math.imul(C,L)|0,o=Math.imul(C,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,H)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Et=(u+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(f,ot)|0))<<13)|0;u=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(P,L),i=(i=Math.imul(P,z))+Math.imul(R,L)|0,o=Math.imul(R,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,H)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,Z)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var At=(u+(n=n+Math.imul(c,ht)|0)|0)+((8191&(i=(i=i+Math.imul(c,ut)|0)+Math.imul(f,ht)|0))<<13)|0;u=((o=o+Math.imul(f,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul($,L),i=(i=Math.imul($,z))+Math.imul(B,L)|0,o=Math.imul(B,z),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,H)|0,n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,ft)|0)+Math.imul(f,ct)|0))<<13)|0;u=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,L),i=(i=Math.imul(F,z))+Math.imul(U,L)|0,o=Math.imul(U,z),n=n+Math.imul($,V)|0,i=(i=i+Math.imul($,H)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,H)|0,n=n+Math.imul(P,K)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,ut)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,ft)|0;var Mt=(u+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(f,pt)|0))<<13)|0;u=((o=o+Math.imul(f,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,H))+Math.imul(U,V)|0,o=Math.imul(U,H),n=n+Math.imul($,K)|0,i=(i=i+Math.imul($,Z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(S,rt)|0,o=o+Math.imul(S,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,ut)|0,n=n+Math.imul(y,ct)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,ft)|0;var xt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,Z))+Math.imul(U,K)|0,o=Math.imul(U,Z),n=n+Math.imul($,Q)|0,i=(i=i+Math.imul($,Y)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,st)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,Y))+Math.imul(U,Q)|0,o=Math.imul(U,Y),n=n+Math.imul($,X)|0,i=(i=i+Math.imul($,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(R,rt)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,ut)|0,n=n+Math.imul(A,ct)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,ft)|0;var Nt=(u+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,tt))+Math.imul(U,X)|0,o=Math.imul(U,tt),n=n+Math.imul($,rt)|0,i=(i=i+Math.imul($,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(R,ot)|0,o=o+Math.imul(R,st)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(C,ht)|0,o=o+Math.imul(C,ut)|0,n=n+Math.imul(x,ct)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(S,ct)|0,o=o+Math.imul(S,ft)|0;var It=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(U,rt)|0,o=Math.imul(U,nt),n=n+Math.imul($,ot)|0,i=(i=i+Math.imul($,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(R,ht)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,ct)|0,o=o+Math.imul(C,ft)|0;var Ct=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(S,pt)|0))<<13)|0;u=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,st))+Math.imul(U,ot)|0,o=Math.imul(U,st),n=n+Math.imul($,ht)|0,i=(i=i+Math.imul($,ut)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,ut)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(R,ct)|0,o=o+Math.imul(R,ft)|0;var Tt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,ut))+Math.imul(U,ht)|0,o=Math.imul(U,ut),n=n+Math.imul($,ct)|0,i=(i=i+Math.imul($,ft)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,ft)|0;var Pt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((o=o+Math.imul(R,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ct),i=(i=Math.imul(F,ft))+Math.imul(U,ct)|0,o=Math.imul(U,ft);var Rt=(u+(n=n+Math.imul($,pt)|0)|0)+((8191&(i=(i=i+Math.imul($,mt)|0)+Math.imul(B,pt)|0))<<13)|0;u=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var Ot=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(U,pt)|0))<<13)|0;return u=((o=Math.imul(U,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=wt,h[4]=bt,h[5]=_t,h[6]=Et,h[7]=At,h[8]=kt,h[9]=Mt,h[10]=xt,h[11]=St,h[12]=Nt,h[13]=It,h[14]=Ct,h[15]=Tt,h[16]=Pt,h[17]=Rt,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 n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,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]),f=67108863&c;a=67108863&(f=f+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var o=r.sqr();n<e.length;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,h=(0|this.words[e])-a<<n;this.words[e]=h|s,s=a>>>26-n}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,h=n;if(i-=s,i=Math.max(0,i),h){for(var u=0;u<s;u++)h.words[u]=this.words[u];h.length=s}if(0===s);else if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=i);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&a}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.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)},i.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},i.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()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o,s=t.length+n;this._expand(s);var a=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+a;var h=(0|t.words[i])*e;a=((o-=67108863&h)>>26)-(h/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),o=t,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,h=n.length-o.length;if("mod"!==e){(a=new i(null)).length=h+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,a&&(a.words[h]=1));for(var c=h-1;c>=0;c--){var f=67108864*(0|n.words[o.length+c])+(0|n.words[o.length+c-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,c);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(o=a.div.neg()),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(t)),{div:o,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,s,a},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),s=new i(0),a=new i(0),h=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),c=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(c)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(c)),a.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a),s.isub(h)):(n.isub(e),a.isub(o),h.isub(s))}return{a:a,b:h,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,s=new i(1),a=new i(0),h=n.clone();e.cmpn(1)>0&&n.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;)s.isOdd()&&s.iadd(h),s.iushrn(1);for(var c=0,f=1;0==(n.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(n.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(a)):(n.isub(e),a.isub(s))}return(o=0===e.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.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},i.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 n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new k(t)},i.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)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=i._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 M(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},n(b,w),b.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i<n;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,i=10;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[i-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 n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(_,w),n(E,w),n(A,w),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.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")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),f=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=s;0!==d.cmp(a);){for(var m=d,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(c,new i(1).iushln(p-g-1));f=f.redMul(y),c=y.redSqr(),d=d.redMul(c),p=g}return f},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var o=r[0],s=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),n=e.length-1;n>=0;n--){for(var u=e.words[n],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==s?(s<<=1,s|=c,(4===++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}h=26}return o},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new M(t)},n(M,k),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));var Ah=Eh.BN;const kh=new hh("bignumber/5.7.0"),Mh={},xh=9007199254740991;let Sh=!1;class Nh{constructor(t,e){t!==Mh&&kh.throwError("cannot call constructor directly; use BigNumber.from",hh.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Ch(Th(this).fromTwos(t))}toTwos(t){return Ch(Th(this).toTwos(t))}abs(){return"-"===this._hex[0]?Nh.from(this._hex.substring(1)):this}add(t){return Ch(Th(this).add(Th(t)))}sub(t){return Ch(Th(this).sub(Th(t)))}div(t){return Nh.from(t).isZero()&&Ph("division-by-zero","div"),Ch(Th(this).div(Th(t)))}mul(t){return Ch(Th(this).mul(Th(t)))}mod(t){const e=Th(t);return e.isNeg()&&Ph("division-by-zero","mod"),Ch(Th(this).umod(e))}pow(t){const e=Th(t);return e.isNeg()&&Ph("negative-power","pow"),Ch(Th(this).pow(e))}and(t){const e=Th(t);return(this.isNegative()||e.isNeg())&&Ph("unbound-bitwise-result","and"),Ch(Th(this).and(e))}or(t){const e=Th(t);return(this.isNegative()||e.isNeg())&&Ph("unbound-bitwise-result","or"),Ch(Th(this).or(e))}xor(t){const e=Th(t);return(this.isNegative()||e.isNeg())&&Ph("unbound-bitwise-result","xor"),Ch(Th(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Ph("negative-width","mask"),Ch(Th(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Ph("negative-width","shl"),Ch(Th(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Ph("negative-width","shr"),Ch(Th(this).shrn(t))}eq(t){return Th(this).eq(Th(t))}lt(t){return Th(this).lt(Th(t))}lte(t){return Th(this).lte(Th(t))}gt(t){return Th(this).gt(Th(t))}gte(t){return Th(this).gte(Th(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Th(this).isZero()}toNumber(){try{return Th(this).toNumber()}catch(t){Ph("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return kh.throwError("this platform does not support BigInt",hh.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Sh||(Sh=!0,kh.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?kh.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",hh.errors.UNEXPECTED_ARGUMENT,{}):kh.throwError("BigNumber.toString does not accept parameters",hh.errors.UNEXPECTED_ARGUMENT,{})),Th(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Nh)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Nh(Mh,Ih(t)):t.match(/^-?[0-9]+$/)?new Nh(Mh,Ih(new Ah(t))):kh.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Ph("underflow","BigNumber.from",t),(t>=xh||t<=-xh)&&Ph("overflow","BigNumber.from",t),Nh.from(String(t));const e=t;if("bigint"==typeof e)return Nh.from(e.toString());if(dh(e))return Nh.from(vh(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Nh.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(gh(t)||"-"===t[0]&&gh(t.substring(1))))return Nh.from(t)}return kh.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Ih(t){if("string"!=typeof t)return Ih(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&kh.throwArgumentError("invalid hex","value",t),"0x00"===(t=Ih(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 Ch(t){return Nh.from(Ih(t))}function Th(t){const e=Nh.from(t).toHexString();return"-"===e[0]?new Ah("-"+e.substring(3),16):new Ah(e.substring(2),16)}function Ph(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),kh.throwError(t,hh.errors.NUMERIC_FAULT,n)}const Rh=new hh("strings/5.7.0");var Oh,$h;function Bh(t,e,r,n,i){if(t===$h.BAD_PREFIX||t===$h.UNEXPECTED_CONTINUE){let t=0;for(let n=e+1;n<r.length&&r[n]>>6==2;n++)t++;return t}return t===$h.OVERRUN?r.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Oh||(Oh={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}($h||($h={}));const Dh=Object.freeze({error:function(t,e,r,n,i){return Rh.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:Bh,replace:function(t,e,r,n,i){return t===$h.OVERLONG?(n.push(i),0):(n.push(65533),Bh(t,e,r))}});function Fh(t,e){null==e&&(e=Dh.error),t=ph(t);const r=[];let n=0;for(;n<t.length;){const i=t[n++];if(i>>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=e(128==(192&i)?$h.UNEXPECTED_CONTINUE:$h.BAD_PREFIX,n-1,t,r);continue}o=3,s=65535}if(n-1+o>=t.length){n+=e($h.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=t[n];if(128!=(192&i)){n+=e($h.MISSING_CONTINUE,n,t,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=e($h.OUT_OF_RANGE,n-1-o,t,r,a):a>=55296&&a<=57343?n+=e($h.UTF16_SURROGATE,n-1-o,t,r,a):a<=s?n+=e($h.OVERLONG,n-1-o,t,r,a):r.push(a))}return r}function Uh(t,e=Oh.current){e!=Oh.current&&(Rh.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return ph(r)}function jh(t,e){return Fh(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}function Lh(t){return _h(Uh(t))}const zh="hash/5.7.0";function qh(t,e){null==e&&(e=1);const r=[],n=r.forEach,i=function(t,e){n.call(t,(function(t){e>0&&Array.isArray(t)?i(t,e-1):r.push(t)}))};return i(t,e),r}function Vh(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,o=[0,1];for(let t=1;t<n;t++)o.push(i+=r());let s=r(),a=e;e+=s;let h=0,u=0;function l(){return 0==h&&(u=u<<8|t[e++],h=8),u>>--h&1}const c=Math.pow(2,31),f=c>>>1,d=f>>1,p=c-1;let m=0;for(let t=0;t<31;t++)m=m<<1|l();let g=[],y=0,v=c;for(;;){let t=Math.floor(((m-y+1)*i-1)/v),e=0,r=n;for(;r-e>1;){let n=e+r>>>1;t<o[n]?r=n:e=n}if(0==e)break;g.push(e);let s=y+Math.floor(v*o[e]/i),a=y+Math.floor(v*o[e+1]/i)-1;for(;0==((s^a)&f);)m=m<<1&p|l(),s=s<<1&p,a=a<<1&p|1;for(;s&~a&d;)m=m&f|m<<1&p>>>1|l(),s=s<<1^f,a=(a^f)<<1|f|1;y=s,v=1+a-s}let w=n-4;return g.map((e=>{switch(e-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return e-1}}))}(t))}function Hh(t){return 1&t?~t>>1:t>>1}function Gh(t,e){let r=Array(t);for(let n=0,i=-1;n<t;n++)r[n]=i+=1+e();return r}function Kh(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=Hh(e());return r}function Zh(t,e){let r=Gh(t(),t),n=t(),i=Gh(n,t),o=function(t,e){let r=Array(t);for(let n=0;n<t;n++)r[n]=1+e();return r}(n,t);for(let t=0;t<n;t++)for(let e=0;e<o[t];e++)r.push(i[t]+e);return e?r.map((t=>e[t])):r}function Jh(t,e,r){let n=Array(t).fill(void 0).map((()=>[]));for(let i=0;i<e;i++)Kh(t,r).forEach(((t,e)=>n[e].push(t)));return n}function Qh(t,e){let r=1+e(),n=e(),i=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return qh(Jh(i.length,1+t,e).map(((t,e)=>{const o=t[0],s=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*n;return[o+e*r,s.map((t=>t+i))]}))})))}function Yh(t,e){return Jh(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const Wh=Vh(function(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return ph(e)}("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Xh=new Set(Zh(Wh)),tu=new Set(Zh(Wh)),eu=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(Qh(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Yh(r,t))}return function(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[n[0]]=n[1]}return e}(qh(e))}(Wh),ru=function(t){let e=Zh(t).sort(((t,e)=>t-e));return function r(){let n=[];for(;;){let i=Zh(t,e);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(Wh);function nu(t){return function(t,e=Oh.current){return Fh(Uh(t,e))}(t)}function iu(t){return t.filter((t=>65039!=t))}function ou(t){for(let e of t.split(".")){let t=nu(e);try{for(let e=t.lastIndexOf(95)-1;e>=0;e--)if(95!==t[e])throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&45===t[2]&&45===t[3])throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function su(t){return ou(function(t,e){let r=nu(t).reverse(),n=[];for(;r.length;){let t=au(r);if(t){n.push(...e(t));continue}let i=r.pop();if(Xh.has(i)){n.push(i);continue}if(tu.has(i))continue;let o=eu[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return ou(function(t){return t.normalize("NFC")}(String.fromCodePoint(...n)))}(t,iu))}function au(t,e){var r;let n,i,o=ru,s=[],a=t.length;for(e&&(e.length=0);a;){let h=t[--a];if(o=null===(r=o.branches.find((t=>t.set.has(h))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=h;else if(o.check&&h===i)break;s.push(h),o.fe0f&&(s.push(65039),a>0&&65039==t[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return n}const hu=new hh(zh),uu=new Uint8Array(32);function lu(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function cu(t){const e=Uh(su(t)),r=[];if(0===t.length)return r;let n=0;for(let t=0;t<e.length;t++){46===e[t]&&(r.push(lu(e.slice(n,t))),n=t+1)}if(n>=e.length)throw new Error("invalid ENS name; empty component");return r.push(lu(e.slice(n))),r}function fu(t){return cu(t).map((t=>jh(t))).join(".")}function du(t){"string"!=typeof t&&hu.throwArgumentError("invalid ENS name; not a string","name",t);let e=uu;const r=cu(t);for(;r.length;)e=_h(mh([e,_h(r.pop())]));return vh(e)}uu.fill(0);const pu=new hh("address/5.7.0");function mu(t){gh(t,20)||pu.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const n=ph(_h(r));for(let t=0;t<40;t+=2)n[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&n[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const gu={};for(let t=0;t<10;t++)gu[String(t)]=String(t);for(let t=0;t<26;t++)gu[String.fromCharCode(65+t)]=String(10+t);const yu=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function vu(t){let e=null;if("string"!=typeof t&&pu.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=mu(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&pu.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>gu[t])).join("");for(;e.length>=yu;){let t=e.substring(0,yu);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&pu.throwArgumentError("bad icap checksum","address",t),r=t.substring(4),e=new Ah(r,36).toString(16);e.length<40;)e="0"+e;e=mu("0x"+e)}else pu.throwArgumentError("invalid address","address",t);var r;return e}window&&window.__awaiter;const wu=new hh("properties/5.7.0");function bu(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function _u(t){const e={};for(const r in t)e[r]=t[r];return e}const Eu={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Au(t){if(null==t||Eu[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 n=null;try{n=t[e[r]]}catch(t){continue}if(!Au(n))return!1}return!0}return wu.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function ku(t){if(Au(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>Mu(t))));if("object"==typeof t){const e={};for(const r in t){const n=t[r];void 0!==n&&bu(e,r,Mu(n))}return e}return wu.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Mu(t){return ku(t)}var xu=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const Su=new hh(zh),Nu=new Uint8Array(32);Nu.fill(0);const Iu=Nh.from(-1),Cu=Nh.from(0),Tu=Nh.from(1),Pu=Nh.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Ru=bh(Tu.toHexString(),32),Ou=bh(Cu.toHexString(),32),$u={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Bu=["name","version","chainId","verifyingContract","salt"];function Du(t){return function(e){return"string"!=typeof e&&Su.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Fu={name:Du("name"),version:Du("version"),chainId:function(t){try{return Nh.from(t).toString()}catch(t){}return Su.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return vu(t).toLowerCase()}catch(t){}return Su.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=ph(t);if(32!==e.length)throw new Error("bad length");return vh(e)}catch(t){}return Su.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Uu(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&Su.throwArgumentError("invalid numeric width","type",t);const i=Pu.mask(r?n-1:n),o=r?i.add(Tu).mul(Iu):Cu;return function(e){const r=Nh.from(e);return(r.lt(o)||r.gt(i))&&Su.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),bh(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&Su.throwArgumentError("invalid bytes width","type",t),function(e){return ph(e).length!==r&&Su.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=ph(t),r=e.length%32;return r?wh([e,Nu.slice(r)]):vh(e)}(e)}}}switch(t){case"address":return function(t){return bh(vu(t),32)};case"bool":return function(t){return t?Ru:Ou};case"bytes":return function(t){return _h(t)};case"string":return function(t){return Lh(t)}}return null}function ju(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class Lu{constructor(t){bu(this,"types",Object.freeze(Mu(t))),bu(this,"_encoderCache",{}),bu(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&Su.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&Su.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);Uu(s)||(r[s]||Su.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?Su.throwArgumentError("missing primary type","types",t):i.length>1&&Su.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),bu(this,"primaryType",i[0]),function i(o,s){s[o]&&Su.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=ju(e,t[e])+r.map((e=>ju(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Uu(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&Su.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(_h)),_h(wh(i))}}const r=this.types[t];if(r){const e=Lh(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?_h(n):n}));return n.unshift(e),wh(n)}}return Su.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Su.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return _h(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(Uu(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&Su.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):Su.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Lu(t)}static getPrimaryType(t){return Lu.from(t).primaryType}static hashStruct(t,e,r){return Lu.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=$u[r];n||Su.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>Bu.indexOf(t.name)-Bu.indexOf(e.name))),Lu.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return wh(["0x1901",Lu.hashDomain(t),Lu.from(e).hash(r)])}static hash(t,e,r){return _h(Lu.encode(t,e,r))}static resolveNames(t,e,r,n){return xu(this,void 0,void 0,(function*(){t=_u(t);const i={};t.verifyingContract&&!gh(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Lu.from(e);o.visit(r,((t,e)=>("address"!==t||gh(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){Lu.hashDomain(t);const n={},i=[];Bu.forEach((e=>{const r=t[e];null!=r&&(n[e]=Fu[e](r),i.push({name:e,type:$u[e]}))}));const o=Lu.from(e),s=_u(e);return s.EIP712Domain?Su.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return vh(ph(e));if(t.match(/^u?int/))return Nh.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Su.throwArgumentError("invalid string","value",e),e}return Su.throwArgumentError("unsupported type","type",t)}))}}}var zu=function(t){this.value=t},qu=Object.defineProperty({EnumType:zu},"__esModule",{value:!0}),Vu=function(){function t(t){this.value=t}return t.prototype.toJSON=function(){return"$"+this.value},t}(),Hu=Object.defineProperty({VariableType:Vu},"__esModule",{value:!0}),Gu=o((function(t,e){function r(t){if(t instanceof qu.EnumType)return t.value;if(t instanceof Hu.VariableType)return"$"+t.value;if("object"!=typeof t||null===t)return JSON.stringify(t);if(Array.isArray(t))return"["+t.map((function(t){return r(t)})).join(", ")+"]";var e=Object.keys(t).map((function(e){return e+": "+r(t[e])})).join(", ");return"{"+e+"}"}function n(t,r){return-1==e.configFields.indexOf(t)&&-1==r.indexOf(t)}function i(t,e,o,s){Object.keys(t).filter((function(t){return n(t,s.ignoreFields)})).forEach((function(a){var h=t[a];if("object"==typeof h){if(Array.isArray(h)&&!(h=h.find((function(t){return t&&"object"==typeof t}))))return void o.push([""+a,e]);var u=Object.keys(h).filter((function(t){return n(t,s.ignoreFields)})).length>0,l="object"==typeof h.__args&&Object.keys(h.__args).length>0,c="object"==typeof h.__directives,f=h.__all_on instanceof Array,d="object"==typeof h.__on,p=""+a;if("string"==typeof h.__name&&(p=p+" "+h.__name),"string"==typeof h.__aliasFor&&(p=p+": "+h.__aliasFor),"object"==typeof h.__variables&&Object.keys(h.__variables).length>0)p=p+" ("+function(t){var e=[];for(var r in t)e.push("$"+r+": "+t[r]);return e.join(", ")}(h.__variables)+")";else if(l||c){var m="",g="";c&&(g=Object.entries(h.__directives).map((function(t){var e;return"@"+function(t){var e=Object.keys(t)[0],n=t[e];if("boolean"==typeof n||"object"==typeof n&&0===Object.keys(n).length)return e;if("object"==typeof n){var i=[];for(var o in n){var s=r(n[o]).replace(/"/g,"");i.push(o+": "+s)}return e+"("+i.join(", ")+")"}throw new Error("Unsupported type for directive: "+typeof n+". Types allowed: object, boolean.\nOffending object: "+JSON.stringify(t))}(((e={})[t[0]]=t[1],e))})).join(" ")),l&&(m="("+function(t){var e=[];for(var n in t)e.push(n+": "+r(t[n]));return e.join(", ")}(h.__args)+")"),p=p+" "+m+(c&&l?" ":"")+g}if(o.push([p+(u||d||f?" {":""),e]),i(h,e+1,o,s),f&&h.__all_on.forEach((function(t){o.push(["..."+t,e+1])})),d)(h.__on instanceof Array?h.__on:[h.__on]).forEach((function(t){var r=t.__typeName;o.push(["... on "+r+" {",e+1]),i(t,e+2,o,s),o.push(["}",e+1])}));(u||d||f)&&o.push(["}",e])}else(!0===s.includeFalsyKeys||h)&&o.push([""+a,e])}))}Object.defineProperty(e,"__esModule",{value:!0}),e.configFields=["__args","__alias","__aliasFor","__variables","__directives","__on","__all_on","__typeName","__name"],e.jsonToGraphQLQuery=function(t,e){if(void 0===e&&(e={}),!t||"object"!=typeof t)throw new Error("query object not specified");if(0==Object.keys(t).length)throw new Error("query object has no data");e.ignoreFields instanceof Array||(e.ignoreFields=[]);var r=[];i(t,0,r,e);var n="";return r.forEach((function(t){var r=t[0],i=t[1];e.pretty?(n&&(n+="\n"),n+=function(t){return Array(4*t+1).join(" ")}(i)+r):(n&&(n+=" "),n+=r)})),n}})),Ku=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(Gu),e.EnumType=qu.EnumType,e.VariableType=Hu.VariableType})),Zu=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class r{}e._CodeOrName=r,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends r{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class i extends r{constructor(t){super(),this._items="string"==typeof t?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const t=this._items[0];return""===t||'""'===t}get str(){var t;return null!==(t=this._str)&&void 0!==t?t:this._str=this._items.reduce(((t,e)=>`${t}${e}`),"")}get names(){var t;return null!==(t=this._names)&&void 0!==t?t:this._names=this._items.reduce(((t,e)=>(e instanceof n&&(t[e.str]=(t[e.str]||0)+1),t)),{})}}function o(t,...e){const r=[t[0]];let n=0;for(;n<e.length;)h(r,e[n]),r.push(t[++n]);return new i(r)}e._Code=i,e.nil=new i(""),e._=o;const s=new i("+");function a(t,...e){const r=[l(t[0])];let n=0;for(;n<e.length;)r.push(s),h(r,e[n]),r.push(s,l(t[++n]));return function(t){let e=1;for(;e<t.length-1;){if(t[e]===s){const r=u(t[e-1],t[e+1]);if(void 0!==r){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}(r),new i(r)}function h(t,e){e instanceof i?t.push(...e._items):e instanceof n?t.push(e):t.push(function(t){return"number"==typeof t||"boolean"==typeof t||null===t?t:l(Array.isArray(t)?t.join(","):t)}(e))}function u(t,e){if('""'===e)return t;if('""'===t)return e;if("string"==typeof t){if(e instanceof n||'"'!==t[t.length-1])return;return"string"!=typeof e?`${t.slice(0,-1)}${e}"`:'"'===e[0]?t.slice(0,-1)+e.slice(1):void 0}return"string"!=typeof e||'"'!==e[0]||t instanceof n?void 0:`"${t}${e.slice(1)}`}function l(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=h,e.strConcat=function(t,e){return e.emptyStr()?t:t.emptyStr()?e:a`${t}${e}`},e.stringify=function(t){return new i(l(t))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new i(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new i(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(t){return new i(t.toString())}})),Ju=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;class r extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}}var n;!function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"}(n=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new Zu.Name("const"),let:new Zu.Name("let"),var:new Zu.Name("var")};class i{constructor({prefixes:t,parent:e}={}){this._names={},this._prefixes=t,this._parent=e}toName(t){return t instanceof Zu.Name?t:this.name(t)}name(t){return new Zu.Name(this._newName(t))}_newName(t){return`${t}${(this._names[t]||this._nameGroup(t)).index++}`}_nameGroup(t){var e,r;if((null===(r=null===(e=this._parent)||void 0===e?void 0:e._prefixes)||void 0===r?void 0:r.has(t))||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}}e.Scope=i;class o extends Zu.Name{constructor(t,e){super(e),this.prefix=t}setValue(t,{property:e,itemIndex:r}){this.value=t,this.scopePath=Zu._`.${new Zu.Name(e)}[${r}]`}}e.ValueScopeName=o;const s=Zu._`\n`;e.ValueScope=class extends i{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?s:Zu.nil}}get(){return this._scope}name(t){return new o(t,this._newName(t))}value(t,e){var r;if(void 0===e.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(t),{prefix:i}=n,o=null!==(r=e.key)&&void 0!==r?r:e.ref;let s=this._values[i];if(s){const t=s.get(o);if(t)return t}else s=this._values[i]=new Map;s.set(o,n);const a=this._scope[i]||(this._scope[i]=[]),h=a.length;return a[h]=e.ref,n.setValue(e,{property:i,itemIndex:h}),n}getValue(t,e){const r=this._values[t];if(r)return r.get(e)}scopeRefs(t,e=this._values){return this._reduceValues(e,(e=>{if(void 0===e.scopePath)throw new Error(`CodeGen: name "${e}" has no value`);return Zu._`${t}${e.scopePath}`}))}scopeCode(t=this._values,e,r){return this._reduceValues(t,(t=>{if(void 0===t.value)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),e,r)}_reduceValues(t,i,o={},s){let a=Zu.nil;for(const h in t){const u=t[h];if(!u)continue;const l=o[h]=o[h]||new Map;u.forEach((t=>{if(l.has(t))return;l.set(t,n.Started);let o=i(t);if(o){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;a=Zu._`${a}${r} ${t} = ${o};${this.opts._n}`}else{if(!(o=null==s?void 0:s(t)))throw new r(t);a=Zu._`${a}${o}${this.opts._n}`}l.set(t,n.Completed)}))}return a}}})),Qu=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var r=Zu;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var n=Ju;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new Zu._Code(">"),GTE:new Zu._Code(">="),LT:new Zu._Code("<"),LTE:new Zu._Code("<="),EQ:new Zu._Code("==="),NEQ:new Zu._Code("!=="),NOT:new Zu._Code("!"),OR:new Zu._Code("||"),AND:new Zu._Code("&&"),ADD:new Zu._Code("+")};class i{optimizeNodes(){return this}optimizeNames(t,e){return this}}class o extends i{constructor(t,e,r){super(),this.varKind=t,this.name=e,this.rhs=r}render({es5:t,_n:e}){const r=t?Ju.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+e}optimizeNames(t,e){if(t[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,t,e)),this}get names(){return this.rhs instanceof Zu._CodeOrName?this.rhs.names:{}}}class s extends i{constructor(t,e,r){super(),this.lhs=t,this.rhs=e,this.sideEffects=r}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,e){if(!(this.lhs instanceof Zu.Name)||t[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,t,e),this}get names(){return S(this.lhs instanceof Zu.Name?{}:{...this.lhs.names},this.rhs)}}class a extends s{constructor(t,e,r,n){super(t,r,n),this.op=e}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class h extends i{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}}class u extends i{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}}class l extends i{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class c extends i{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,e){return this.code=N(this.code,t,e),this}get names(){return this.code instanceof Zu._CodeOrName?this.code.names:{}}}class f extends i{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce(((e,r)=>e+r.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let e=t.length;for(;e--;){const r=t[e].optimizeNodes();Array.isArray(r)?t.splice(e,1,...r):r?t[e]=r:t.splice(e,1)}return t.length>0?this:void 0}optimizeNames(t,e){const{nodes:r}=this;let n=r.length;for(;n--;){const i=r[n];i.optimizeNames(t,e)||(I(t,i.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce(((t,e)=>x(t,e.names)),{})}}class d extends f{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class p extends f{}class m extends d{}m.kind="else";class g extends d{constructor(t,e){super(e),this.condition=t}render(t){let e=`if(${this.condition})`+super.render(t);return this.else&&(e+="else "+this.else.render(t)),e}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(!0===t)return this.nodes;let e=this.else;if(e){const t=e.optimizeNodes();e=this.else=Array.isArray(t)?new m(t):t}return e?!1===t?e instanceof g?e:e.nodes:this.nodes.length?this:new g(C(t),e instanceof g?[e]:e.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(t,e){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(t,e),super.optimizeNames(t,e)||this.else)return this.condition=N(this.condition,t,e),this}get names(){const t=super.names;return S(t,this.condition),this.else&&x(t,this.else.names),t}}g.kind="if";class y extends d{}y.kind="for";class v extends y{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iteration=N(this.iteration,t,e),this}get names(){return x(super.names,this.iteration.names)}}class w extends y{constructor(t,e,r,n){super(),this.varKind=t,this.name=e,this.from=r,this.to=n}render(t){const e=t.es5?Ju.varKinds.var:this.varKind,{name:r,from:n,to:i}=this;return`for(${e} ${r}=${n}; ${r}<${i}; ${r}++)`+super.render(t)}get names(){const t=S(super.names,this.from);return S(t,this.to)}}class b extends y{constructor(t,e,r,n){super(),this.loop=t,this.varKind=e,this.name=r,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,e){if(super.optimizeNames(t,e))return this.iterable=N(this.iterable,t,e),this}get names(){return x(super.names,this.iterable.names)}}class _ extends d{constructor(t,e,r){super(),this.name=t,this.args=e,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}_.kind="func";class E extends f{render(t){return"return "+super.render(t)}}E.kind="return";class A extends d{render(t){let e="try"+super.render(t);return this.catch&&(e+=this.catch.render(t)),this.finally&&(e+=this.finally.render(t)),e}optimizeNodes(){var t,e;return super.optimizeNodes(),null===(t=this.catch)||void 0===t||t.optimizeNodes(),null===(e=this.finally)||void 0===e||e.optimizeNodes(),this}optimizeNames(t,e){var r,n;return super.optimizeNames(t,e),null===(r=this.catch)||void 0===r||r.optimizeNames(t,e),null===(n=this.finally)||void 0===n||n.optimizeNames(t,e),this}get names(){const t=super.names;return this.catch&&x(t,this.catch.names),this.finally&&x(t,this.finally.names),t}}class k extends d{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}k.kind="catch";class M extends d{render(t){return"finally"+super.render(t)}}M.kind="finally";function x(t,e){for(const r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function S(t,e){return e instanceof Zu._CodeOrName?x(t,e.names):t}function N(t,e,r){return t instanceof Zu.Name?i(t):(n=t)instanceof Zu._Code&&n._items.some((t=>t instanceof Zu.Name&&1===e[t.str]&&void 0!==r[t.str]))?new Zu._Code(t._items.reduce(((t,e)=>(e instanceof Zu.Name&&(e=i(e)),e instanceof Zu._Code?t.push(...e._items):t.push(e),t)),[])):t;var n;function i(t){const n=r[t.str];return void 0===n||1!==e[t.str]?t:(delete e[t.str],n)}}function I(t,e){for(const r in e)t[r]=(t[r]||0)-(e[r]||0)}function C(t){return"boolean"==typeof t||"number"==typeof t||null===t?!t:Zu._`!${O(t)}`}e.CodeGen=class{constructor(t,e={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...e,_n:e.lines?"\n":""},this._extScope=t,this._scope=new Ju.Scope({parent:t}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,e){const r=this._extScope.value(t,e);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(t,e){return this._extScope.getValue(t,e)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,e,r,n){const i=this._scope.toName(e);return void 0!==r&&n&&(this._constants[i.str]=r),this._leafNode(new o(t,i,r)),i}const(t,e,r){return this._def(Ju.varKinds.const,t,e,r)}let(t,e,r){return this._def(Ju.varKinds.let,t,e,r)}var(t,e,r){return this._def(Ju.varKinds.var,t,e,r)}assign(t,e,r){return this._leafNode(new s(t,e,r))}add(t,r){return this._leafNode(new a(t,e.operators.ADD,r))}code(t){return"function"==typeof t?t():t!==Zu.nil&&this._leafNode(new c(t)),this}object(...t){const e=["{"];for(const[r,n]of t)e.length>1&&e.push(","),e.push(r),(r!==n||this.opts.es5)&&(e.push(":"),(0,Zu.addCodeArg)(e,n));return e.push("}"),new Zu._Code(e)}if(t,e,r){if(this._blockNode(new g(t)),e&&r)this.code(e).else().code(r).endIf();else if(e)this.code(e).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new g(t))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(g,m)}_for(t,e){return this._blockNode(t),e&&this.code(e).endFor(),this}for(t,e){return this._for(new v(t),e)}forRange(t,e,r,n,i=(this.opts.es5?Ju.varKinds.var:Ju.varKinds.let)){const o=this._scope.toName(t);return this._for(new w(i,o,e,r),(()=>n(o)))}forOf(t,e,r,n=Ju.varKinds.const){const i=this._scope.toName(t);if(this.opts.es5){const t=e instanceof Zu.Name?e:this.var("_arr",e);return this.forRange("_i",0,Zu._`${t}.length`,(e=>{this.var(i,Zu._`${t}[${e}]`),r(i)}))}return this._for(new b("of",n,i,e),(()=>r(i)))}forIn(t,e,r,n=(this.opts.es5?Ju.varKinds.var:Ju.varKinds.const)){if(this.opts.ownProperties)return this.forOf(t,Zu._`Object.keys(${e})`,r);const i=this._scope.toName(t);return this._for(new b("in",n,i,e),(()=>r(i)))}endFor(){return this._endBlockNode(y)}label(t){return this._leafNode(new h(t))}break(t){return this._leafNode(new u(t))}return(t){const e=new E;if(this._blockNode(e),this.code(t),1!==e.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(t,e,r){if(!e&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new A;if(this._blockNode(n),this.code(t),e){const t=this.name("e");this._currNode=n.catch=new k(t),e(t)}return r&&(this._currNode=n.finally=new M,this.code(r)),this._endBlockNode(k,M)}throw(t){return this._leafNode(new l(t))}block(t,e){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(e),this}endBlock(t){const e=this._blockStarts.pop();if(void 0===e)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-e;if(r<0||void 0!==t&&r!==t)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${t} expected`);return this._nodes.length=e,this}func(t,e=Zu.nil,r,n){return this._blockNode(new _(t,e,r)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,e){const r=this._currNode;if(r instanceof t||e&&r instanceof e)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${e?`${t.kind}/${e.kind}`:t.kind}"`)}_elseNode(t){const e=this._currNode;if(!(e instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=e.else=t,this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const e=this._nodes;e[e.length-1]=t}},e.not=C;const T=R(e.operators.AND);e.and=function(...t){return t.reduce(T)};const P=R(e.operators.OR);function R(t){return(e,r)=>e===Zu.nil?r:r===Zu.nil?e:Zu._`${O(e)} ${t} ${O(r)}`}function O(t){return t instanceof Zu.Name?t:Zu._`(${t})`}e.or=function(...t){return t.reduce(P)}})),Yu=o((function(t,e){function r(t,e=t.schema){const{opts:r,self:n}=t;if(!r.strictSchema)return;if("boolean"==typeof e)return;const i=n.RULES.keywords;for(const r in e)i[r]||c(t,`unknown keyword: "${r}"`)}function n(t,e){if("boolean"==typeof t)return!t;for(const r in t)if(e[r])return!0;return!1}function i(t){return"number"==typeof t?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}function o(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{const h=void 0===s?o:s instanceof Qu.Name?(o instanceof Qu.Name?t(i,o,s):e(i,o,s),s):o instanceof Qu.Name?(e(i,s,o),o):r(o,s);return a!==Qu.Name||h instanceof Qu.Name?h:n(i,h)}}function a(t,e){if(!0===e)return t.var("props",!0);const r=t.var("props",Qu._`{}`);return void 0!==e&&h(t,r,e),r}function h(t,e,r){Object.keys(r).forEach((r=>t.assign(Qu._`${e}${(0,Qu.getProperty)(r)}`,!0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0,e.toHash=function(t){const e={};for(const r of t)e[r]=!0;return e},e.alwaysValidSchema=function(t,e){return"boolean"==typeof e?e:0===Object.keys(e).length||(r(t,e),!n(e,t.self.RULES.all))},e.checkUnknownRules=r,e.schemaHasRules=n,e.schemaHasRulesButRef=function(t,e){if("boolean"==typeof t)return!t;for(const r in t)if("$ref"!==r&&e.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return Qu._`${r}`}return Qu._`${t}${e}${(0,Qu.getProperty)(n)}`},e.unescapeFragment=function(t){return o(decodeURIComponent(t))},e.escapeFragment=function(t){return encodeURIComponent(i(t))},e.escapeJsonPointer=i,e.unescapeJsonPointer=o,e.eachItem=function(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)},e.mergeEvaluated={props:s({mergeNames:(t,e,r)=>t.if(Qu._`${r} !== true && ${e} !== undefined`,(()=>{t.if(Qu._`${e} === true`,(()=>t.assign(r,!0)),(()=>t.assign(r,Qu._`${r} || {}`).code(Qu._`Object.assign(${r}, ${e})`)))})),mergeToName:(t,e,r)=>t.if(Qu._`${r} !== true`,(()=>{!0===e?t.assign(r,!0):(t.assign(r,Qu._`${r} || {}`),h(t,r,e))})),mergeValues:(t,e)=>!0===t||{...t,...e},resultToName:a}),items:s({mergeNames:(t,e,r)=>t.if(Qu._`${r} !== true && ${e} !== undefined`,(()=>t.assign(r,Qu._`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`))),mergeToName:(t,e,r)=>t.if(Qu._`${r} !== true`,(()=>t.assign(r,!0===e||Qu._`${r} > ${e} ? ${r} : ${e}`))),mergeValues:(t,e)=>!0===t||Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})},e.evaluatedPropsToName=a,e.setEvaluated=h;const u={};var l;function c(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,!0===r)throw new Error(e);t.self.logger.warn(e)}}e.useFunc=function(t,e){return t.scopeValue("func",{ref:e,code:u[e.code]||(u[e.code]=new Zu._Code(e.code))})},function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"}(l=e.Type||(e.Type={})),e.getErrorPath=function(t,e,r){if(t instanceof Qu.Name){const n=e===l.Num;return r?n?Qu._`"[" + ${t} + "]"`:Qu._`"['" + ${t} + "']"`:n?Qu._`"/" + ${t}`:Qu._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Qu.getProperty)(t).toString():"/"+i(t)},e.checkStrictMode=c}));var Wu={data:new Qu.Name("data"),valCxt:new Qu.Name("valCxt"),instancePath:new Qu.Name("instancePath"),parentData:new Qu.Name("parentData"),parentDataProperty:new Qu.Name("parentDataProperty"),rootData:new Qu.Name("rootData"),dynamicAnchors:new Qu.Name("dynamicAnchors"),vErrors:new Qu.Name("vErrors"),errors:new Qu.Name("errors"),this:new Qu.Name("this"),self:new Qu.Name("self"),scope:new Qu.Name("scope"),json:new Qu.Name("json"),jsonPos:new Qu.Name("jsonPos"),jsonLen:new Qu.Name("jsonLen"),jsonPart:new Qu.Name("jsonPart")},Xu=Object.defineProperty({default:Wu},"__esModule",{value:!0}),tl=o((function(t,e){function r(t,e){const r=t.const("err",e);t.if(Qu._`${Xu.default.vErrors} === null`,(()=>t.assign(Xu.default.vErrors,Qu._`[${r}]`)),Qu._`${Xu.default.vErrors}.push(${r})`),t.code(Qu._`${Xu.default.errors}++`)}function n(t,e){const{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw(Qu._`new ${t.ValidationError}(${e})`):(r.assign(Qu._`${n}.errors`,e),r.return(!1))}Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0,e.keywordError={message:({keyword:t})=>Qu.str`must pass "${t}" keyword validation`},e.keyword$DataError={message:({keyword:t,schemaType:e})=>e?Qu.str`"${t}" keyword must be ${e} ($data)`:Qu.str`"${t}" keyword is invalid ($data)`},e.reportError=function(t,i=e.keywordError,s,a){const{it:h}=t,{gen:u,compositeRule:l,allErrors:c}=h,f=o(t,i,s);(null!=a?a:l||c)?r(u,f):n(h,Qu._`[${f}]`)},e.reportExtraError=function(t,i=e.keywordError,s){const{it:a}=t,{gen:h,compositeRule:u,allErrors:l}=a;r(h,o(t,i,s)),u||l||n(a,Xu.default.vErrors)},e.resetErrorsCount=function(t,e){t.assign(Xu.default.errors,e),t.if(Qu._`${Xu.default.vErrors} !== null`,(()=>t.if(e,(()=>t.assign(Qu._`${Xu.default.vErrors}.length`,e)),(()=>t.assign(Xu.default.vErrors,null)))))},e.extendErrors=function({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(void 0===i)throw new Error("ajv implementation error");const s=t.name("err");t.forRange("i",i,Xu.default.errors,(i=>{t.const(s,Qu._`${Xu.default.vErrors}[${i}]`),t.if(Qu._`${s}.instancePath === undefined`,(()=>t.assign(Qu._`${s}.instancePath`,(0,Qu.strConcat)(Xu.default.instancePath,o.errorPath)))),t.assign(Qu._`${s}.schemaPath`,Qu.str`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign(Qu._`${s}.schema`,r),t.assign(Qu._`${s}.data`,n))}))};const i={keyword:new Qu.Name("keyword"),schemaPath:new Qu.Name("schemaPath"),params:new Qu.Name("params"),propertyName:new Qu.Name("propertyName"),message:new Qu.Name("message"),schema:new Qu.Name("schema"),parentSchema:new Qu.Name("parentSchema")};function o(t,e,r){const{createErrors:n}=t.it;return!1===n?Qu._`{}`:function(t,e,r={}){const{gen:n,it:o}=t,h=[s(o,r),a(t,r)];return function(t,{params:e,message:r},n){const{keyword:o,data:s,schemaValue:a,it:h}=t,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:f}=h;n.push([i.keyword,o],[i.params,"function"==typeof e?e(t):e||Qu._`{}`]),u.messages&&n.push([i.message,"function"==typeof r?r(t):r]);u.verbose&&n.push([i.schema,a],[i.parentSchema,Qu._`${c}${f}`],[Xu.default.data,s]);l&&n.push([i.propertyName,l])}(t,e,h),n.object(...h)}(t,e,r)}function s({errorPath:t},{instancePath:e}){const r=e?Qu.str`${t}${(0,Yu.getErrorPath)(e,Yu.Type.Str)}`:t;return[Xu.default.instancePath,(0,Qu.strConcat)(Xu.default.instancePath,r)]}function a({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:Qu.str`${e}/${t}`;return r&&(o=Qu.str`${o}${(0,Yu.getErrorPath)(r,Yu.Type.Str)}`),[i.schemaPath,o]}})),el=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;const r={message:"boolean schema is false"};function n(t,e){const{gen:n,data:i}=t,o={gen:n,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,tl.reportError)(o,r,void 0,e)}e.topBoolOrEmptySchema=function(t){const{gen:e,schema:r,validateName:i}=t;!1===r?n(t,!1):"object"==typeof r&&!0===r.$async?e.return(Xu.default.data):(e.assign(Qu._`${i}.errors`,null),e.return(!0))},e.boolOrEmptySchema=function(t,e){const{gen:r,schema:i}=t;!1===i?(r.var(e,!1),n(t)):r.var(e,!0)}})),rl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;const r=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(t){return"string"==typeof t&&r.has(t)},e.getRules=function(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}})),nl=o((function(t,e){function r(t,e){return e.rules.some((e=>n(t,e)))}function n(t,e){var r;return void 0!==t[e.keyword]||(null===(r=e.definition.implements)||void 0===r?void 0:r.some((e=>void 0!==t[e])))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:t,self:e},n){const i=e.RULES.types[n];return i&&!0!==i&&r(t,i)},e.shouldUseGroup=r,e.shouldUseRule=n})),il=o((function(t,e){var r;function n(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(rl.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0,function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"}(r=e.DataType||(e.DataType={})),e.getSchemaTypes=function(t){const e=n(t.type);if(e.includes("null")){if(!1===t.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&void 0!==t.nullable)throw new Error('"nullable" cannot be used without "type"');!0===t.nullable&&e.push("null")}return e},e.getJSONTypes=n,e.coerceAndCheckDataType=function(t,e){const{gen:n,data:o,opts:a}=t,u=function(t,e){return e?t.filter((t=>i.has(t)||"array"===e&&"array"===t)):[]}(e,a.coerceTypes),l=e.length>0&&!(0===u.length&&1===e.length&&(0,nl.schemaHasRulesForType)(t,e[0]));if(l){const l=s(e,o,a.strictNumbers,r.Wrong);n.if(l,(()=>{u.length?function(t,e,r){const{gen:n,data:o,opts:a}=t,u=n.let("dataType",Qu._`typeof ${o}`),l=n.let("coerced",Qu._`undefined`);"array"===a.coerceTypes&&n.if(Qu._`${u} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,(()=>n.assign(o,Qu._`${o}[0]`).assign(u,Qu._`typeof ${o}`).if(s(e,o,a.strictNumbers),(()=>n.assign(l,o)))));n.if(Qu._`${l} !== undefined`);for(const t of r)(i.has(t)||"array"===t&&"array"===a.coerceTypes)&&c(t);function c(t){switch(t){case"string":return void n.elseIf(Qu._`${u} == "number" || ${u} == "boolean"`).assign(l,Qu._`"" + ${o}`).elseIf(Qu._`${o} === null`).assign(l,Qu._`""`);case"number":return void n.elseIf(Qu._`${u} == "boolean" || ${o} === null
|
|
16
16
|
|| (${u} == "string" && ${o} && ${o} == +${o})`).assign(l,Qu._`+${o}`);case"integer":return void n.elseIf(Qu._`${u} === "boolean" || ${o} === null
|
|
17
17
|
|| (${u} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(l,Qu._`+${o}`);case"boolean":return void n.elseIf(Qu._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(l,!1).elseIf(Qu._`${o} === "true" || ${o} === 1`).assign(l,!0);case"null":return n.elseIf(Qu._`${o} === "" || ${o} === 0 || ${o} === false`),void n.assign(l,null);case"array":n.elseIf(Qu._`${u} === "string" || ${u} === "number"
|
|
18
18
|
|| ${u} === "boolean" || ${o} === null`).assign(l,Qu._`[${o}]`)}}n.else(),h(t),n.endIf(),n.if(Qu._`${l} !== undefined`,(()=>{n.assign(o,l),function({gen:t,parentData:e,parentDataProperty:r},n){t.if(Qu._`${e} !== undefined`,(()=>t.assign(Qu._`${e}[${r}]`,n)))}(t,l)}))}(t,e,u):h(t)}))}return l};const i=new Set(["string","number","integer","boolean","null"]);function o(t,e,n,i=r.Correct){const o=i===r.Correct?Qu.operators.EQ:Qu.operators.NEQ;let s;switch(t){case"null":return Qu._`${e} ${o} null`;case"array":s=Qu._`Array.isArray(${e})`;break;case"object":s=Qu._`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=a(Qu._`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=a();break;default:return Qu._`typeof ${e} ${o} ${t}`}return i===r.Correct?s:(0,Qu.not)(s);function a(t=Qu.nil){return(0,Qu.and)(Qu._`typeof ${e} == "number"`,t,n?Qu._`isFinite(${e})`:Qu.nil)}}function s(t,e,r,n){if(1===t.length)return o(t[0],e,r,n);let i;const s=(0,Yu.toHash)(t);if(s.array&&s.object){const t=Qu._`typeof ${e} != "object"`;i=s.null?t:Qu._`!${e} || ${t}`,delete s.null,delete s.array,delete s.object}else i=Qu.nil;s.number&&delete s.integer;for(const t in s)i=(0,Qu.and)(i,o(t,e,r,n));return i}e.checkDataType=o,e.checkDataTypes=s;const a={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>"string"==typeof t?Qu._`{type: ${t}}`:Qu._`{type: ${e}}`};function h(t){const e=function(t){const{gen:e,data:r,schema:n}=t,i=(0,Yu.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}(t);(0,tl.reportError)(e,a)}e.reportTypeError=h})),ol=o((function(t,e){function r(t,e,r){const{gen:n,compositeRule:i,data:o,opts:s}=t;if(void 0===r)return;const a=Qu._`${o}${(0,Qu.getProperty)(e)}`;if(i)return void(0,Yu.checkStrictMode)(t,`default is ignored for: ${a}`);let h=Qu._`${a} === undefined`;"empty"===s.useDefaults&&(h=Qu._`${h} || ${a} === null || ${a} === ""`),n.if(h,Qu._`${a} = ${(0,Qu.stringify)(r)}`)}Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0,e.assignDefaults=function(t,e){const{properties:n,items:i}=t.schema;if("object"===e&&n)for(const e in n)r(t,e,n[e].default);else"array"===e&&Array.isArray(i)&&i.forEach(((e,n)=>r(t,n,e.default)))}})),sl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;const r=Yu;function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Qu._`Object.prototype.hasOwnProperty`})}function i(t,e,r){return Qu._`${n(t)}.call(${e}, ${r})`}function o(t,e,r,n){const o=Qu._`${e}${(0,Qu.getProperty)(r)} === undefined`;return n?(0,Qu.or)(o,(0,Qu.not)(i(t,e,r))):o}function s(t){return t?Object.keys(t).filter((t=>"__proto__"!==t)):[]}e.checkReportMissingProp=function(t,e){const{gen:r,data:n,it:i}=t;r.if(o(r,n,e,i.opts.ownProperties),(()=>{t.setParams({missingProperty:Qu._`${e}`},!0),t.error()}))},e.checkMissingProp=function({gen:t,data:e,it:{opts:r}},n,i){return(0,Qu.or)(...n.map((n=>(0,Qu.and)(o(t,e,n,r.ownProperties),Qu._`${i} = ${n}`))))},e.reportMissingProp=function(t,e){t.setParams({missingProperty:e},!0),t.error()},e.hasPropFunc=n,e.isOwnProperty=i,e.propertyInData=function(t,e,r,n){const o=Qu._`${e}${(0,Qu.getProperty)(r)} !== undefined`;return n?Qu._`${o} && ${i(t,e,r)}`:o},e.noPropertyInData=o,e.allSchemaProperties=s,e.schemaProperties=function(t,e){return s(e).filter((r=>!(0,Yu.alwaysValidSchema)(t,e[r])))},e.callValidateCode=function({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,h,u){const l=u?Qu._`${t}, ${e}, ${n}${i}`:e,c=[[Xu.default.instancePath,(0,Qu.strConcat)(Xu.default.instancePath,o)],[Xu.default.parentData,s.parentData],[Xu.default.parentDataProperty,s.parentDataProperty],[Xu.default.rootData,Xu.default.rootData]];s.opts.dynamicRef&&c.push([Xu.default.dynamicAnchors,Xu.default.dynamicAnchors]);const f=Qu._`${l}, ${r.object(...c)}`;return h!==Qu.nil?Qu._`${a}.call(${h}, ${f})`:Qu._`${a}(${f})`};const a=Qu._`new RegExp`;e.usePattern=function({gen:t,it:{opts:e}},n){const i=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(n,i);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:Qu._`${"new RegExp"===o.code?a:(0,r.useFunc)(t,o)}(${n}, ${i})`})},e.validateArray=function(t){const{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){const t=e.let("valid",!0);return s((()=>e.assign(t,!1))),t}return e.var(o,!0),s((()=>e.break())),o;function s(i){const s=e.const("len",Qu._`${r}.length`);e.forRange("i",0,s,(r=>{t.subschema({keyword:n,dataProp:r,dataPropType:Yu.Type.Num},o),e.if((0,Qu.not)(o),i)}))}},e.validateUnion=function(t){const{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some((t=>(0,Yu.alwaysValidSchema)(i,t)))&&!i.opts.unevaluated)return;const o=e.let("valid",!1),s=e.name("_valid");e.block((()=>r.forEach(((r,i)=>{const a=t.subschema({keyword:n,schemaProp:i,compositeRule:!0},s);e.assign(o,Qu._`${o} || ${s}`);t.mergeValidEvaluated(a,s)||e.if((0,Qu.not)(o))})))),t.result(o,(()=>t.reset()),(()=>t.error(!0)))}})),al=o((function(t,e){function r(t){const{gen:e,data:r,it:n}=t;e.if(n.parentData,(()=>e.assign(r,Qu._`${n.parentData}[${n.parentDataProperty}]`)))}function n(t,e,r){if(void 0===r)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,Qu.stringify)(r)})}Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0,e.macroKeywordCode=function(t,e){const{gen:r,keyword:i,schema:o,parentSchema:s,it:a}=t,h=e.macro.call(a.self,o,s,a),u=n(r,i,h);!1!==a.opts.validateSchema&&a.self.validateSchema(h,!0);const l=r.name("valid");t.subschema({schema:h,schemaPath:Qu.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,(()=>t.error(!0)))},e.funcKeywordCode=function(t,e){var i;const{gen:o,keyword:s,schema:a,parentSchema:h,$data:u,it:l}=t;!function({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}(l,e);const c=!u&&e.compile?e.compile.call(l.self,a,h,l):e.validate,f=n(o,s,c),d=o.let("valid");function p(r=(e.async?Qu._`await `:Qu.nil)){const n=l.opts.passContext?Xu.default.this:Xu.default.self,i=!("compile"in e&&!u||!1===e.schema);o.assign(d,Qu._`${r}${(0,sl.callValidateCode)(t,f,n,i)}`,e.modifying)}function m(t){var r;o.if((0,Qu.not)(null!==(r=e.valid)&&void 0!==r?r:d),t)}t.block$data(d,(function(){if(!1===e.errors)p(),e.modifying&&r(t),m((()=>t.error()));else{const n=e.async?function(){const t=o.let("ruleErrs",null);return o.try((()=>p(Qu._`await `)),(e=>o.assign(d,!1).if(Qu._`${e} instanceof ${l.ValidationError}`,(()=>o.assign(t,Qu._`${e}.errors`)),(()=>o.throw(e))))),t}():function(){const t=Qu._`${f}.errors`;return o.assign(t,null),p(Qu.nil),t}();e.modifying&&r(t),m((()=>function(t,e){const{gen:r}=t;r.if(Qu._`Array.isArray(${e})`,(()=>{r.assign(Xu.default.vErrors,Qu._`${Xu.default.vErrors} === null ? ${e} : ${Xu.default.vErrors}.concat(${e})`).assign(Xu.default.errors,Qu._`${Xu.default.vErrors}.length`),(0,tl.extendErrors)(t)}),(()=>t.error()))}(t,n)))}})),t.ok(null!==(i=e.valid)&&void 0!==i?i:d)},e.validSchemaType=function(t,e,r=!1){return!e.length||e.some((e=>"array"===e?Array.isArray(t):"object"===e?t&&"object"==typeof t&&!Array.isArray(t):typeof t==e||r&&void 0===t))},e.validateKeywordUsage=function({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");const s=i.dependencies;if(null==s?void 0:s.some((e=>!Object.prototype.hasOwnProperty.call(t,e))))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema){if(!i.validateSchema(t[o])){const t=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if("log"!==e.validateSchema)throw new Error(t);r.logger.error(t)}}}})),hl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0,e.getSubschema=function(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(void 0!==e&&void 0!==n)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==e){const n=t.schema[e];return void 0===r?{schema:n,schemaPath:Qu._`${t.schemaPath}${(0,Qu.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:n[r],schemaPath:Qu._`${t.schemaPath}${(0,Qu.getProperty)(e)}${(0,Qu.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Yu.escapeFragment)(r)}`}}if(void 0!==n){if(void 0===i||void 0===o||void 0===s)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(void 0!==i&&void 0!==r)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=e;if(void 0!==r){const{errorPath:i,dataPathArr:o,opts:s}=e;h(a.let("data",Qu._`${e.data}${(0,Qu.getProperty)(r)}`,!0)),t.errorPath=Qu.str`${i}${(0,Yu.getErrorPath)(r,n,s.jsPropertySyntax)}`,t.parentDataProperty=Qu._`${r}`,t.dataPathArr=[...o,t.parentDataProperty]}if(void 0!==i){h(i instanceof Qu.Name?i:a.let("data",i,!0)),void 0!==s&&(t.propertyName=s)}function h(r){t.data=r,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,r]}o&&(t.dataTypes=o)},e.extendSubschemaMode=function(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){void 0!==n&&(t.compositeRule=n),void 0!==i&&(t.createErrors=i),void 0!==o&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}})),ul=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if((n=e.length)!=r.length)return!1;for(i=n;0!=i--;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((n=(o=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!=i--;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!=e&&r!=r},ll=o((function(t){var e=t.exports=function(t,e,n){"function"==typeof e&&(n=e,e={}),r(e,"function"==typeof(n=e.cb||n)?n:n.pre||function(){},n.post||function(){},t,"",t)};function r(t,n,i,o,s,a,h,u,l,c){if(o&&"object"==typeof o&&!Array.isArray(o)){for(var f in n(o,s,a,h,u,l,c),o){var d=o[f];if(Array.isArray(d)){if(f in e.arrayKeywords)for(var p=0;p<d.length;p++)r(t,n,i,d[p],s+"/"+f+"/"+p,a,s,f,o,p)}else if(f in e.propsKeywords){if(d&&"object"==typeof d)for(var m in d)r(t,n,i,d[m],s+"/"+f+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),a,s,f,o,m)}else(f in e.keywords||t.allKeys&&!(f in e.skipKeywords))&&r(t,n,i,d,s+"/"+f,a,s,f,o)}i(o,s,a,h,u,l,c)}}e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}})),cl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;const r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(t,e=!0){return"boolean"==typeof t||(!0===e?!i(t):!!e&&o(t)<=e)};const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(t){for(const e in t){if(n.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(i))return!0;if("object"==typeof r&&i(r))return!0}return!1}function o(t){let e=0;for(const n in t){if("$ref"===n)return 1/0;if(e++,!r.has(n)&&("object"==typeof t[n]&&(0,Yu.eachItem)(t[n],(t=>e+=o(t))),e===1/0))return 1/0}return e}function s(t,e="",r){!1!==r&&(e=u(e));const n=t.parse(e);return a(t,n)}function a(t,e){return t.serialize(e).split("#")[0]+"#"}e.getFullPath=s,e._getFullPath=a;const h=/#\/?$/;function u(t){return t?t.replace(h,""):""}e.normalizeId=u,e.resolveUrl=function(t,e,r){return r=u(r),t.resolve(e,r)};const l=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(t,e){if("boolean"==typeof t)return{};const{schemaId:r,uriResolver:n}=this.opts,i=u(t[r]||e),o={"":i},a=s(n,i,!1),h={},c=new Set;return ll(t,{allKeys:!0},((t,e,n,i)=>{if(void 0===i)return;const s=a+e;let p=o[i];function m(e){const r=this.opts.uriResolver.resolve;if(e=u(p?r(p,e):e),c.has(e))throw d(e);c.add(e);let n=this.refs[e];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?f(t,n.schema,e):e!==u(s)&&("#"===e[0]?(f(t,h[e],e),h[e]=t):this.refs[e]=s),e}function g(t){if("string"==typeof t){if(!l.test(t))throw new Error(`invalid anchor "${t}"`);m.call(this,`#${t}`)}}"string"==typeof t[r]&&(p=m.call(this,t[r])),g.call(this,t.$anchor),g.call(this,t.$dynamicAnchor),o[e]=p})),h;function f(t,e,r){if(void 0!==e&&!ul(t,e))throw d(r)}function d(t){return new Error(`reference "${t}" resolves to more than one schema`)}}})),fl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;const r=il;function n({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,Qu._`${Xu.default.data}, ${Xu.default.valCxt}`,n.$async,(()=>{t.code(Qu._`"use strict"; ${i(r,o)}`),function(t,e){t.if(Xu.default.valCxt,(()=>{t.var(Xu.default.instancePath,Qu._`${Xu.default.valCxt}.${Xu.default.instancePath}`),t.var(Xu.default.parentData,Qu._`${Xu.default.valCxt}.${Xu.default.parentData}`),t.var(Xu.default.parentDataProperty,Qu._`${Xu.default.valCxt}.${Xu.default.parentDataProperty}`),t.var(Xu.default.rootData,Qu._`${Xu.default.valCxt}.${Xu.default.rootData}`),e.dynamicRef&&t.var(Xu.default.dynamicAnchors,Qu._`${Xu.default.valCxt}.${Xu.default.dynamicAnchors}`)}),(()=>{t.var(Xu.default.instancePath,Qu._`""`),t.var(Xu.default.parentData,Qu._`undefined`),t.var(Xu.default.parentDataProperty,Qu._`undefined`),t.var(Xu.default.rootData,Xu.default.data),e.dynamicRef&&t.var(Xu.default.dynamicAnchors,Qu._`{}`)}))}(t,o),t.code(s)})):t.func(e,Qu._`${Xu.default.data}, ${function(t){return Qu._`{${Xu.default.instancePath}="", ${Xu.default.parentData}, ${Xu.default.parentDataProperty}, ${Xu.default.rootData}=${Xu.default.data}${t.dynamicRef?Qu._`, ${Xu.default.dynamicAnchors}={}`:Qu.nil}}={}`}(o)}`,n.$async,(()=>t.code(i(r,o)).code(s)))}function i(t,e){const r="object"==typeof t&&t[e.schemaId];return r&&(e.code.source||e.code.process)?Qu._`/*# sourceURL=${r} */`:Qu.nil}function o(t,e){a(t)&&(h(t),s(t))?function(t,e){const{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&l(t);(function(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,cl.resolveUrl)(t.opts.uriResolver,t.baseId,e))})(t),function(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}(t);const o=n.const("_errs",Xu.default.errors);u(t,o),n.var(e,Qu._`${o} === ${Xu.default.errors}`)}(t,e):(0,el.boolOrEmptySchema)(t,e)}function s({schema:t,self:e}){if("boolean"==typeof t)return!t;for(const r in t)if(e.RULES.all[r])return!0;return!1}function a(t){return"boolean"!=typeof t.schema}function h(t){(0,Yu.checkUnknownRules)(t),function(t){const{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Yu.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(t)}function u(t,e){if(t.opts.jtd)return c(t,[],!1,e);const r=(0,il.getSchemaTypes)(t.schema);c(t,r,!(0,il.coerceAndCheckDataType)(t,r),e)}function l({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){const o=r.$comment;if(!0===i.$comment)t.code(Qu._`${Xu.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){const r=Qu.str`${n}/$comment`,i=t.scopeValue("root",{ref:e.root});t.code(Qu._`${Xu.default.self}.opts.$comment(${o}, ${r}, ${i}.schema)`)}}function c(t,e,n,i){const{gen:o,schema:s,data:a,allErrors:h,opts:u,self:l}=t,{RULES:c}=l;function g(l){(0,nl.shouldUseGroup)(s,l)&&(l.type?(o.if((0,r.checkDataType)(l.type,a,u.strictNumbers)),f(t,l),1===e.length&&e[0]===l.type&&n&&(o.else(),(0,r.reportTypeError)(t)),o.endIf()):f(t,l),h||o.if(Qu._`${Xu.default.errors} === ${i||0}`))}!s.$ref||!u.ignoreKeywordsWithRef&&(0,Yu.schemaHasRulesButRef)(s,c)?(u.jtd||function(t,e){if(t.schemaEnv.meta||!t.opts.strictTypes)return;(function(t,e){if(!e.length)return;if(!t.dataTypes.length)return void(t.dataTypes=e);e.forEach((e=>{p(t.dataTypes,e)||m(t,`type "${e}" not allowed by context "${t.dataTypes.join(",")}"`)})),t.dataTypes=t.dataTypes.filter((t=>p(e,t)))})(t,e),t.opts.allowUnionTypes||function(t,e){e.length>1&&(2!==e.length||!e.includes("null"))&&m(t,"use allowUnionTypes to allow union type keyword")}(t,e);!function(t,e){const r=t.self.RULES.all;for(const n in r){const i=r[n];if("object"==typeof i&&(0,nl.shouldUseRule)(t.schema,i)){const{type:r}=i.definition;r.length&&!r.some((t=>d(e,t)))&&m(t,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(t,t.dataTypes)}(t,e),o.block((()=>{for(const t of c.rules)g(t);g(c.post)}))):o.block((()=>y(t,"$ref",c.all.$ref.definition)))}function f(t,e){const{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,ol.assignDefaults)(t,e.type),r.block((()=>{for(const r of e.rules)(0,nl.shouldUseRule)(n,r)&&y(t,r.keyword,r.definition,e.type)}))}function d(t,e){return t.includes(e)||"number"===e&&t.includes("integer")}function p(t,e){return t.includes(e)||"integer"===e&&t.includes("number")}function m(t,e){e+=` at "${t.schemaEnv.baseId+t.errSchemaPath}" (strictTypes)`,(0,Yu.checkStrictMode)(t,e,t.opts.strictTypes)}e.validateFunctionCode=function(t){a(t)&&(h(t),s(t))?function(t){const{schema:e,opts:r,gen:i}=t;n(t,(()=>{r.$comment&&e.$comment&&l(t),function(t){const{schema:e,opts:r}=t;void 0!==e.default&&r.useDefaults&&r.strictSchema&&(0,Yu.checkStrictMode)(t,"default is ignored in the schema root")}(t),i.let(Xu.default.vErrors,null),i.let(Xu.default.errors,0),r.unevaluated&&function(t){const{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",Qu._`${r}.evaluated`),e.if(Qu._`${t.evaluated}.dynamicProps`,(()=>e.assign(Qu._`${t.evaluated}.props`,Qu._`undefined`))),e.if(Qu._`${t.evaluated}.dynamicItems`,(()=>e.assign(Qu._`${t.evaluated}.items`,Qu._`undefined`)))}(t),u(t),function(t){const{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if(Qu._`${Xu.default.errors} === 0`,(()=>e.return(Xu.default.data)),(()=>e.throw(Qu._`new ${i}(${Xu.default.vErrors})`))):(e.assign(Qu._`${n}.errors`,Xu.default.vErrors),o.unevaluated&&function({gen:t,evaluated:e,props:r,items:n}){r instanceof Qu.Name&&t.assign(Qu._`${e}.props`,r);n instanceof Qu.Name&&t.assign(Qu._`${e}.items`,n)}(t),e.return(Qu._`${Xu.default.errors} === 0`))}(t)}))}(t):n(t,(()=>(0,el.topBoolOrEmptySchema)(t)))};class g{constructor(t,e,r){if((0,al.validateKeywordUsage)(t,e,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=e.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Yu.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=e.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=e,this.$data)this.schemaCode=t.gen.const("vSchema",b(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,al.validSchemaType)(this.schema,e.schemaType,e.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(e.schemaType)}`);("code"in e?e.trackErrors:!1!==e.errors)&&(this.errsCount=t.gen.const("_errs",Xu.default.errors))}result(t,e,r){this.failResult((0,Qu.not)(t),e,r)}failResult(t,e,r){this.gen.if(t),r?r():this.error(),e?(this.gen.else(),e(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,e){this.failResult((0,Qu.not)(t),void 0,e)}fail(t){if(void 0===t)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:e}=this;this.fail(Qu._`${e} !== undefined && (${(0,Qu.or)(this.invalid$data(),t)})`)}error(t,e,r){if(e)return this.setParams(e),this._error(t,r),void this.setParams({});this._error(t,r)}_error(t,e){(t?tl.reportExtraError:tl.reportError)(this,this.def.error,e)}$dataError(){(0,tl.reportError)(this,this.def.$dataError||tl.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,tl.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,e){e?Object.assign(this.params,t):this.params=t}block$data(t,e,r=Qu.nil){this.gen.block((()=>{this.check$data(t,r),e()}))}check$data(t=Qu.nil,e=Qu.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:i,def:o}=this;r.if((0,Qu.or)(Qu._`${n} === undefined`,e)),t!==Qu.nil&&r.assign(t,!0),(i.length||o.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==Qu.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:e,schemaType:n,def:i,it:o}=this;return(0,Qu.or)(function(){if(n.length){if(!(e instanceof Qu.Name))throw new Error("ajv implementation error");const t=Array.isArray(n)?n:[n];return Qu._`${(0,r.checkDataTypes)(t,e,o.opts.strictNumbers,r.DataType.Wrong)}`}return Qu.nil}(),function(){if(i.validateSchema){const r=t.scopeValue("validate$data",{ref:i.validateSchema});return Qu._`!${r}(${e})`}return Qu.nil}())}subschema(t,e){const r=(0,hl.getSubschema)(this.it,t);(0,hl.extendSubschemaData)(r,this.it,t),(0,hl.extendSubschemaMode)(r,t);const n={...this.it,...r,items:void 0,props:void 0};return o(n,e),n}mergeEvaluated(t,e){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==t.props&&(r.props=Yu.mergeEvaluated.props(n,t.props,r.props,e)),!0!==r.items&&void 0!==t.items&&(r.items=Yu.mergeEvaluated.items(n,t.items,r.items,e)))}mergeValidEvaluated(t,e){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(e,(()=>this.mergeEvaluated(t,Qu.Name))),!0}}function y(t,e,r,n){const i=new g(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,al.funcKeywordCode)(i,r):"macro"in r?(0,al.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,al.funcKeywordCode)(i,r)}e.KeywordCxt=g;const v=/^\/(?:[^~]|~0|~1)*$/,w=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function b(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(""===t)return Xu.default.rootData;if("/"===t[0]){if(!v.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=Xu.default.rootData}else{const s=w.exec(t);if(!s)throw new Error(`Invalid JSON-pointer: ${t}`);const a=+s[1];if(i=s[2],"#"===i){if(a>=e)throw new Error(h("property/index",a));return n[e-a]}if(a>e)throw new Error(h("data",a));if(o=r[e-a],!i)return o}let s=o;const a=i.split("/");for(const t of a)t&&(o=Qu._`${o}${(0,Qu.getProperty)((0,Yu.unescapeJsonPointer)(t))}`,s=Qu._`${s} && ${o}`);return s;function h(t,r){return`Cannot access ${t} ${r} levels up, current level is ${e}`}}e.getData=b}));class dl extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}var pl=dl,ml=Object.defineProperty({default:pl},"__esModule",{value:!0});class gl extends Error{constructor(t,e,r,n){super(n||`can't resolve reference ${r} from id ${e}`),this.missingRef=(0,cl.resolveUrl)(t,e,r),this.missingSchema=(0,cl.normalizeId)((0,cl.getFullPath)(t,this.missingRef))}}var yl=gl,vl=Object.defineProperty({default:yl},"__esModule",{value:!0}),wl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;class r{constructor(t){var e;let r;this.refs={},this.dynamicAnchors={},"object"==typeof t.schema&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=null!==(e=t.baseId)&&void 0!==e?e:(0,cl.normalizeId)(null==r?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function n(t){const e=o.call(this,t);if(e)return e;const r=(0,cl.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,a=new Qu.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s});let h;t.$async&&(h=a.scopeValue("Error",{ref:ml.default,code:Qu._`require("ajv/dist/runtime/validation_error").default`}));const u=a.scopeName("validate");t.validateName=u;const l={gen:a,allErrors:this.opts.allErrors,data:Xu.default.data,parentData:Xu.default.parentData,parentDataProperty:Xu.default.parentDataProperty,dataNames:[Xu.default.data],dataPathArr:[Qu.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",!0===this.opts.code.source?{ref:t.schema,code:(0,Qu.stringify)(t.schema)}:{ref:t.schema}),validateName:u,ValidationError:h,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Qu.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:Qu._`""`,opts:this.opts,self:this};let c;try{this._compilations.add(t),(0,fl.validateFunctionCode)(l),a.optimize(this.opts.code.optimize);const e=a.toString();c=`${a.scopeRefs(Xu.default.scope)}return ${e}`,this.opts.code.process&&(c=this.opts.code.process(c,t));const r=new Function(`${Xu.default.self}`,`${Xu.default.scope}`,c)(this,this.scope.get());if(this.scope.value(u,{ref:r}),r.errors=null,r.schema=t.schema,r.schemaEnv=t,t.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:u,validateCode:e,scopeValues:a._values}),this.opts.unevaluated){const{props:t,items:e}=l;r.evaluated={props:t instanceof Qu.Name?void 0:t,items:e instanceof Qu.Name?void 0:e,dynamicProps:t instanceof Qu.Name,dynamicItems:e instanceof Qu.Name},r.source&&(r.source.evaluated=(0,Qu.stringify)(r.evaluated))}return t.validate=r,t}catch(e){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),e}finally{this._compilations.delete(t)}}function i(t){return(0,cl.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:n.call(this,t)}function o(t){for(const n of this._compilations)if(r=t,(e=n).schema===r.schema&&e.root===r.root&&e.baseId===r.baseId)return n;var e,r}function s(t,e){let r;for(;"string"==typeof(r=this.refs[e]);)e=r;return r||this.schemas[e]||a.call(this,t,e)}function a(t,e){const i=this.opts.uriResolver.parse(e),o=(0,cl._getFullPath)(this.opts.uriResolver,i);let s=(0,cl.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===s)return u.call(this,i,t);const h=(0,cl.normalizeId)(o),l=this.refs[h]||this.schemas[h];if("string"==typeof l){const e=a.call(this,t,l);if("object"!=typeof(null==e?void 0:e.schema))return;return u.call(this,i,e)}if("object"==typeof(null==l?void 0:l.schema)){if(l.validate||n.call(this,l),h===(0,cl.normalizeId)(e)){const{schema:e}=l,{schemaId:n}=this.opts,i=e[n];return i&&(s=(0,cl.resolveUrl)(this.opts.uriResolver,s,i)),new r({schema:e,schemaId:n,root:t,baseId:s})}return u.call(this,i,l)}}e.SchemaEnv=r,e.compileSchema=n,e.resolveRef=function(t,e,n){var o;n=(0,cl.resolveUrl)(this.opts.uriResolver,e,n);const a=t.refs[n];if(a)return a;let h=s.call(this,t,n);if(void 0===h){const i=null===(o=t.localRefs)||void 0===o?void 0:o[n],{schemaId:s}=this.opts;i&&(h=new r({schema:i,schemaId:s,root:t,baseId:e}))}return void 0!==h?t.refs[n]=i.call(this,h):void 0},e.getCompilingSchema=o,e.resolveSchema=a;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function u(t,{baseId:e,schema:n,root:i}){var o;if("/"!==(null===(o=t.fragment)||void 0===o?void 0:o[0]))return;for(const r of t.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const t=n[(0,Yu.unescapeFragment)(r)];if(void 0===t)return;const i="object"==typeof(n=t)&&n[this.opts.schemaId];!h.has(r)&&i&&(e=(0,cl.resolveUrl)(this.opts.uriResolver,e,i))}let s;if("boolean"!=typeof n&&n.$ref&&!(0,Yu.schemaHasRulesButRef)(n,this.RULES)){const t=(0,cl.resolveUrl)(this.opts.uriResolver,e,n.$ref);s=a.call(this,i,t)}const{schemaId:u}=this.opts;return s=s||new r({schema:n,schemaId:u,root:i,baseId:e}),s.schema!==s.root.schema?s:void 0}})),bl={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},_l=o((function(t,e){!function(t){function e(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length>1){e[0]=e[0].slice(0,-1);for(var n=e.length-1,i=1;i<n;++i)e[i]=e[i].slice(1,-1);return e[n]=e[n].slice(1),e.join("")}return e[0]}function r(t){return"(?:"+t+")"}function n(t){return void 0===t?"undefined":null===t?"null":Object.prototype.toString.call(t).split(" ").pop().split("]").shift().toLowerCase()}function i(t){return t.toUpperCase()}function o(t){return null!=t?t instanceof Array?t:"number"!=typeof t.length||t.split||t.setInterval||t.call?[t]:Array.prototype.slice.call(t):[]}function s(t,e){var r=t;if(e)for(var n in e)r[n]=e[n];return r}function a(t){var n="[A-Za-z]",i="[0-9]",o=e(i,"[A-Fa-f]"),s=r(r("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+r("%[89A-Fa-f]"+o+"%"+o+o)+"|"+r("%"+o+o)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",h=e("[\\:\\/\\?\\#\\[\\]\\@]",a),u=t?"[\\uE000-\\uF8FF]":"[]",l=e(n,i,"[\\-\\.\\_\\~]",t?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),c=(r(n+e(n,i,"[\\+\\-\\.]")+"*"),r(r(s+"|"+e(l,a,"[\\:]"))+"*"),r(r("25[0-5]")+"|"+r("2[0-4]"+i)+"|"+r("1"+i+i)+"|"+r("0?[1-9]"+i)+"|0?0?"+i)),f=r(c+"\\."+c+"\\."+c+"\\."+c),d=r(o+"{1,4}"),p=r(r(d+"\\:"+d)+"|"+f),m=r(r(d+"\\:")+"{6}"+p),g=r("\\:\\:"+r(d+"\\:")+"{5}"+p),y=r(r(d)+"?\\:\\:"+r(d+"\\:")+"{4}"+p),v=r(r(r(d+"\\:")+"{0,1}"+d)+"?\\:\\:"+r(d+"\\:")+"{3}"+p),w=r(r(r(d+"\\:")+"{0,2}"+d)+"?\\:\\:"+r(d+"\\:")+"{2}"+p),b=r(r(r(d+"\\:")+"{0,3}"+d)+"?\\:\\:"+d+"\\:"+p),_=r(r(r(d+"\\:")+"{0,4}"+d)+"?\\:\\:"+p),E=r(r(r(d+"\\:")+"{0,5}"+d)+"?\\:\\:"+d),A=r(r(r(d+"\\:")+"{0,6}"+d)+"?\\:\\:"),k=r([m,g,y,v,w,b,_,E,A].join("|")),M=r(r(l+"|"+s)+"+"),x=(r("[vV]"+o+"+\\."+e(l,a,"[\\:]")+"+"),r(r(s+"|"+e(l,a))+"*"),r(s+"|"+e(l,a,"[\\:\\@]")));return r(r(s+"|"+e(l,a,"[\\@]"))+"+"),r(r(x+"|"+e("[\\/\\?]",u))+"*"),{NOT_SCHEME:new RegExp(e("[^]",n,i,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",l,a),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",l,a),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",l,a),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",l,a),"g"),NOT_QUERY:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]",u),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",l,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",l,a),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",l,h),"g"),PCT_ENCODED:new RegExp(s,"g"),IPV4ADDRESS:new RegExp("^("+f+")$"),IPV6ADDRESS:new RegExp("^\\[?("+k+")"+r(r("\\%25|\\%(?!"+o+"{2})")+"("+M+")")+"?\\]?$")}}var h=a(!1),u=a(!0),l=function(){function t(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},f=2147483647,d=36,p=1,m=26,g=38,y=700,v=72,w=128,b="-",_=/^xn--/,E=/[^\0-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,k={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=d-p,x=Math.floor,S=String.fromCharCode;function N(t){throw new RangeError(k[t])}function I(t,e){for(var r=[],n=t.length;n--;)r[n]=e(t[n]);return r}function C(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+I((t=t.replace(A,".")).split("."),e).join(".")}function T(t){for(var e=[],r=0,n=t.length;r<n;){var i=t.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){var o=t.charCodeAt(r++);56320==(64512&o)?e.push(((1023&i)<<10)+(1023&o)+65536):(e.push(i),r--)}else e.push(i)}return e}var P=function(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:d},R=function(t,e){return t+22+75*(t<26)-((0!=e)<<5)},O=function(t,e,r){var n=0;for(t=r?x(t/y):t>>1,t+=x(t/e);t>M*m>>1;n+=d)t=x(t/M);return x(n+(M+1)*t/(t+g))},$=function(t){var e=[],r=t.length,n=0,i=w,o=v,s=t.lastIndexOf(b);s<0&&(s=0);for(var a=0;a<s;++a)t.charCodeAt(a)>=128&&N("not-basic"),e.push(t.charCodeAt(a));for(var h=s>0?s+1:0;h<r;){for(var u=n,l=1,c=d;;c+=d){h>=r&&N("invalid-input");var g=P(t.charCodeAt(h++));(g>=d||g>x((f-n)/l))&&N("overflow"),n+=g*l;var y=c<=o?p:c>=o+m?m:c-o;if(g<y)break;var _=d-y;l>x(f/_)&&N("overflow"),l*=_}var E=e.length+1;o=O(n-u,E,0==u),x(n/E)>f-i&&N("overflow"),i+=x(n/E),n%=E,e.splice(n++,0,i)}return String.fromCodePoint.apply(String,e)},B=function(t){var e=[],r=(t=T(t)).length,n=w,i=0,o=v,s=!0,a=!1,h=void 0;try{for(var u,l=t[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c=u.value;c<128&&e.push(S(c))}}catch(t){a=!0,h=t}finally{try{!s&&l.return&&l.return()}finally{if(a)throw h}}var g=e.length,y=g;for(g&&e.push(b);y<r;){var _=f,E=!0,A=!1,k=void 0;try{for(var M,I=t[Symbol.iterator]();!(E=(M=I.next()).done);E=!0){var C=M.value;C>=n&&C<_&&(_=C)}}catch(t){A=!0,k=t}finally{try{!E&&I.return&&I.return()}finally{if(A)throw k}}var P=y+1;_-n>x((f-i)/P)&&N("overflow"),i+=(_-n)*P,n=_;var $=!0,B=!1,D=void 0;try{for(var F,U=t[Symbol.iterator]();!($=(F=U.next()).done);$=!0){var j=F.value;if(j<n&&++i>f&&N("overflow"),j==n){for(var L=i,z=d;;z+=d){var q=z<=o?p:z>=o+m?m:z-o;if(L<q)break;var V=L-q,H=d-q;e.push(S(R(q+V%H,0))),L=x(V/H)}e.push(S(R(L,0))),o=O(i,P,y==g),i=0,++y}}}catch(t){B=!0,D=t}finally{try{!$&&U.return&&U.return()}finally{if(B)throw D}}++i,++n}return e.join("")},D=function(t){return C(t,(function(t){return _.test(t)?$(t.slice(4).toLowerCase()):t}))},F=function(t){return C(t,(function(t){return E.test(t)?"xn--"+B(t):t}))},U={version:"2.1.0",ucs2:{decode:T,encode:function(t){return String.fromCodePoint.apply(String,c(t))}},decode:$,encode:B,toASCII:F,toUnicode:D},j={};function L(t){var e=t.charCodeAt(0);return e<16?"%0"+e.toString(16).toUpperCase():e<128?"%"+e.toString(16).toUpperCase():e<2048?"%"+(e>>6|192).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase():"%"+(e>>12|224).toString(16).toUpperCase()+"%"+(e>>6&63|128).toString(16).toUpperCase()+"%"+(63&e|128).toString(16).toUpperCase()}function z(t){for(var e="",r=0,n=t.length;r<n;){var i=parseInt(t.substr(r+1,2),16);if(i<128)e+=String.fromCharCode(i),r+=3;else if(i>=194&&i<224){if(n-r>=6){var o=parseInt(t.substr(r+4,2),16);e+=String.fromCharCode((31&i)<<6|63&o)}else e+=t.substr(r,6);r+=6}else if(i>=224){if(n-r>=9){var s=parseInt(t.substr(r+4,2),16),a=parseInt(t.substr(r+7,2),16);e+=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}else e+=t.substr(r,9);r+=9}else e+=t.substr(r,3),r+=3}return e}function q(t,e){function r(t){var r=z(t);return r.match(e.UNRESERVED)?r:t}return t.scheme&&(t.scheme=String(t.scheme).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_SCHEME,"")),void 0!==t.userinfo&&(t.userinfo=String(t.userinfo).replace(e.PCT_ENCODED,r).replace(e.NOT_USERINFO,L).replace(e.PCT_ENCODED,i)),void 0!==t.host&&(t.host=String(t.host).replace(e.PCT_ENCODED,r).toLowerCase().replace(e.NOT_HOST,L).replace(e.PCT_ENCODED,i)),void 0!==t.path&&(t.path=String(t.path).replace(e.PCT_ENCODED,r).replace(t.scheme?e.NOT_PATH:e.NOT_PATH_NOSCHEME,L).replace(e.PCT_ENCODED,i)),void 0!==t.query&&(t.query=String(t.query).replace(e.PCT_ENCODED,r).replace(e.NOT_QUERY,L).replace(e.PCT_ENCODED,i)),void 0!==t.fragment&&(t.fragment=String(t.fragment).replace(e.PCT_ENCODED,r).replace(e.NOT_FRAGMENT,L).replace(e.PCT_ENCODED,i)),t}function V(t){return t.replace(/^0*(.*)/,"$1")||"0"}function H(t,e){var r=t.match(e.IPV4ADDRESS)||[],n=l(r,2)[1];return n?n.split(".").map(V).join("."):t}function G(t,e){var r=t.match(e.IPV6ADDRESS)||[],n=l(r,3),i=n[1],o=n[2];if(i){for(var s=i.toLowerCase().split("::").reverse(),a=l(s,2),h=a[0],u=a[1],c=u?u.split(":").map(V):[],f=h.split(":").map(V),d=e.IPV4ADDRESS.test(f[f.length-1]),p=d?7:8,m=f.length-p,g=Array(p),y=0;y<p;++y)g[y]=c[y]||f[m+y]||"";d&&(g[p-1]=H(g[p-1],e));var v=g.reduce((function(t,e,r){if(!e||"0"===e){var n=t[t.length-1];n&&n.index+n.length===r?n.length++:t.push({index:r,length:1})}return t}),[]),w=v.sort((function(t,e){return e.length-t.length}))[0],b=void 0;if(w&&w.length>1){var _=g.slice(0,w.index),E=g.slice(w.index+w.length);b=_.join(":")+"::"+E.join(":")}else b=g.join(":");return o&&(b+="%"+o),b}return t}var K=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Z=void 0==="".match(/(){0}/)[1];function J(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==e.iri?u:h;"suffix"===e.reference&&(t=(e.scheme?e.scheme+":":"")+"//"+t);var i=t.match(K);if(i){Z?(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5])):(r.scheme=i[1]||void 0,r.userinfo=-1!==t.indexOf("@")?i[3]:void 0,r.host=-1!==t.indexOf("//")?i[4]:void 0,r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=-1!==t.indexOf("?")?i[7]:void 0,r.fragment=-1!==t.indexOf("#")?i[8]:void 0,isNaN(r.port)&&(r.port=t.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),r.host&&(r.host=G(H(r.host,n),n)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",e.reference&&"suffix"!==e.reference&&e.reference!==r.reference&&(r.error=r.error||"URI is not a "+e.reference+" reference.");var o=j[(e.scheme||r.scheme||"").toLowerCase()];if(e.unicodeSupport||o&&o.unicodeSupport)q(r,n);else{if(r.host&&(e.domainHost||o&&o.domainHost))try{r.host=U.toASCII(r.host.replace(n.PCT_ENCODED,z).toLowerCase())}catch(t){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+t}q(r,h)}o&&o.parse&&o.parse(r,e)}else r.error=r.error||"URI can not be parsed.";return r}function Q(t,e){var r=!1!==e.iri?u:h,n=[];return void 0!==t.userinfo&&(n.push(t.userinfo),n.push("@")),void 0!==t.host&&n.push(G(H(String(t.host),r),r).replace(r.IPV6ADDRESS,(function(t,e,r){return"["+e+(r?"%25"+r:"")+"]"}))),"number"!=typeof t.port&&"string"!=typeof t.port||(n.push(":"),n.push(String(t.port))),n.length?n.join(""):void 0}var Y=/^\.\.?\//,W=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,tt=/^\/?(?:.|\n)*?(?=\/|$)/;function et(t){for(var e=[];t.length;)if(t.match(Y))t=t.replace(Y,"");else if(t.match(W))t=t.replace(W,"/");else if(t.match(X))t=t.replace(X,"/"),e.pop();else if("."===t||".."===t)t="";else{var r=t.match(tt);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];t=t.slice(n.length),e.push(n)}return e.join("")}function rt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.iri?u:h,n=[],i=j[(e.scheme||t.scheme||"").toLowerCase()];if(i&&i.serialize&&i.serialize(t,e),t.host)if(r.IPV6ADDRESS.test(t.host));else if(e.domainHost||i&&i.domainHost)try{t.host=e.iri?U.toUnicode(t.host):U.toASCII(t.host.replace(r.PCT_ENCODED,z).toLowerCase())}catch(r){t.error=t.error||"Host's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+r}q(t,r),"suffix"!==e.reference&&t.scheme&&(n.push(t.scheme),n.push(":"));var o=Q(t,e);if(void 0!==o&&("suffix"!==e.reference&&n.push("//"),n.push(o),t.path&&"/"!==t.path.charAt(0)&&n.push("/")),void 0!==t.path){var s=t.path;e.absolutePath||i&&i.absolutePath||(s=et(s)),void 0===o&&(s=s.replace(/^\/\//,"/%2F")),n.push(s)}return void 0!==t.query&&(n.push("?"),n.push(t.query)),void 0!==t.fragment&&(n.push("#"),n.push(t.fragment)),n.join("")}function nt(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(t=J(rt(t,r),r),e=J(rt(e,r),r)),!(r=r||{}).tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=et(e.path||""),n.query=e.query):(void 0!==e.userinfo||void 0!==e.host||void 0!==e.port?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=et(e.path||""),n.query=e.query):(e.path?("/"===e.path.charAt(0)?n.path=et(e.path):(void 0===t.userinfo&&void 0===t.host&&void 0===t.port||t.path?t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path:n.path="/"+e.path,n.path=et(n.path)),n.query=e.query):(n.path=t.path,void 0!==e.query?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function it(t,e,r){var n=s({scheme:"null"},r);return rt(nt(J(t,n),J(e,n),n,!0),n)}function ot(t,e){return"string"==typeof t?t=rt(J(t,e),e):"object"===n(t)&&(t=J(rt(t,e),e)),t}function st(t,e,r){return"string"==typeof t?t=rt(J(t,r),r):"object"===n(t)&&(t=rt(t,r)),"string"==typeof e?e=rt(J(e,r),r):"object"===n(e)&&(e=rt(e,r)),t===e}function at(t,e){return t&&t.toString().replace(e&&e.iri?u.ESCAPE:h.ESCAPE,L)}function ht(t,e){return t&&t.toString().replace(e&&e.iri?u.PCT_ENCODED:h.PCT_ENCODED,z)}var ut={scheme:"http",domainHost:!0,parse:function(t,e){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t},serialize:function(t,e){var r="https"===String(t.scheme).toLowerCase();return t.port!==(r?443:80)&&""!==t.port||(t.port=void 0),t.path||(t.path="/"),t}},lt={scheme:"https",domainHost:ut.domainHost,parse:ut.parse,serialize:ut.serialize};function ct(t){return"boolean"==typeof t.secure?t.secure:"wss"===String(t.scheme).toLowerCase()}var ft={scheme:"ws",domainHost:!0,parse:function(t,e){var r=t;return r.secure=ct(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(t,e){if(t.port!==(ct(t)?443:80)&&""!==t.port||(t.port=void 0),"boolean"==typeof t.secure&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){var r=t.resourceName.split("?"),n=l(r,2),i=n[0],o=n[1];t.path=i&&"/"!==i?i:void 0,t.query=o,t.resourceName=void 0}return t.fragment=void 0,t}},dt={scheme:"wss",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize},pt={},mt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",gt="[0-9A-Fa-f]",yt=r(r("%[EFef]"+gt+"%"+gt+gt+"%"+gt+gt)+"|"+r("%[89A-Fa-f]"+gt+"%"+gt+gt)+"|"+r("%"+gt+gt)),vt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",wt=e("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),bt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",_t=new RegExp(mt,"g"),Et=new RegExp(yt,"g"),At=new RegExp(e("[^]",vt,"[\\.]",'[\\"]',wt),"g"),kt=new RegExp(e("[^]",mt,bt),"g"),Mt=kt;function xt(t){var e=z(t);return e.match(_t)?e:t}var St={scheme:"mailto",parse:function(t,e){var r=t,n=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var i=!1,o={},s=r.query.split("&"),a=0,h=s.length;a<h;++a){var u=s[a].split("=");switch(u[0]){case"to":for(var l=u[1].split(","),c=0,f=l.length;c<f;++c)n.push(l[c]);break;case"subject":r.subject=ht(u[1],e);break;case"body":r.body=ht(u[1],e);break;default:i=!0,o[ht(u[0],e)]=ht(u[1],e)}}i&&(r.headers=o)}r.query=void 0;for(var d=0,p=n.length;d<p;++d){var m=n[d].split("@");if(m[0]=ht(m[0]),e.unicodeSupport)m[1]=ht(m[1],e).toLowerCase();else try{m[1]=U.toASCII(ht(m[1],e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+t}n[d]=m.join("@")}return r},serialize:function(t,e){var r=t,n=o(t.to);if(n){for(var s=0,a=n.length;s<a;++s){var h=String(n[s]),u=h.lastIndexOf("@"),l=h.slice(0,u).replace(Et,xt).replace(Et,i).replace(At,L),c=h.slice(u+1);try{c=e.iri?U.toUnicode(c):U.toASCII(ht(c,e).toLowerCase())}catch(t){r.error=r.error||"Email address's domain name can not be converted to "+(e.iri?"Unicode":"ASCII")+" via punycode: "+t}n[s]=l+"@"+c}r.path=n.join(",")}var f=t.headers=t.headers||{};t.subject&&(f.subject=t.subject),t.body&&(f.body=t.body);var d=[];for(var p in f)f[p]!==pt[p]&&d.push(p.replace(Et,xt).replace(Et,i).replace(kt,L)+"="+f[p].replace(Et,xt).replace(Et,i).replace(Mt,L));return d.length&&(r.query=d.join("&")),r}},Nt=/^([^\:]+)\:(.*)/,It={scheme:"urn",parse:function(t,e){var r=t.path&&t.path.match(Nt),n=t;if(r){var i=e.scheme||n.scheme||"urn",o=r[1].toLowerCase(),s=r[2],a=i+":"+(e.nid||o),h=j[a];n.nid=o,n.nss=s,n.path=void 0,h&&(n=h.parse(n,e))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(t,e){var r=e.scheme||t.scheme||"urn",n=t.nid,i=r+":"+(e.nid||n),o=j[i];o&&(t=o.serialize(t,e));var s=t,a=t.nss;return s.path=(n||e.nid)+":"+a,s}},Ct=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Tt={scheme:"urn:uuid",parse:function(t,e){var r=t;return r.uuid=r.nss,r.nss=void 0,e.tolerant||r.uuid&&r.uuid.match(Ct)||(r.error=r.error||"UUID is not valid."),r},serialize:function(t,e){var r=t;return r.nss=(t.uuid||"").toLowerCase(),r}};j[ut.scheme]=ut,j[lt.scheme]=lt,j[ft.scheme]=ft,j[dt.scheme]=dt,j[St.scheme]=St,j[It.scheme]=It,j[Tt.scheme]=Tt,t.SCHEMES=j,t.pctEncChar=L,t.pctDecChars=z,t.parse=J,t.removeDotSegments=et,t.serialize=rt,t.resolveComponents=nt,t.resolve=it,t.normalize=ot,t.equal=st,t.escapeComponent=at,t.unescapeComponent=ht,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));_l.code='require("ajv/dist/runtime/uri").default';var El=_l,Al=Object.defineProperty({default:El},"__esModule",{value:!0}),kl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0,Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return fl.KeywordCxt}}),Object.defineProperty(e,"_",{enumerable:!0,get:function(){return Qu._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return Qu.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return Qu.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return Qu.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return Qu.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return Qu.CodeGen}});const r=Qu,n=(t,e)=>new RegExp(t,e);n.code="new RegExp";const i=["removeAdditional","useDefaults","coerceTypes"],o=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),s={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},a={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function h(t){var e,r,i,o,s,a,h,u,l,c,f,d,p,m,g,y,v,w,b,_,E,A,k,M,x;const S=t.strict,N=null===(e=t.code)||void 0===e?void 0:e.optimize,I=!0===N||void 0===N?1:N||0,C=null!==(i=null===(r=t.code)||void 0===r?void 0:r.regExp)&&void 0!==i?i:n,T=null!==(o=t.uriResolver)&&void 0!==o?o:Al.default;return{strictSchema:null===(a=null!==(s=t.strictSchema)&&void 0!==s?s:S)||void 0===a||a,strictNumbers:null===(u=null!==(h=t.strictNumbers)&&void 0!==h?h:S)||void 0===u||u,strictTypes:null!==(c=null!==(l=t.strictTypes)&&void 0!==l?l:S)&&void 0!==c?c:"log",strictTuples:null!==(d=null!==(f=t.strictTuples)&&void 0!==f?f:S)&&void 0!==d?d:"log",strictRequired:null!==(m=null!==(p=t.strictRequired)&&void 0!==p?p:S)&&void 0!==m&&m,code:t.code?{...t.code,optimize:I,regExp:C}:{optimize:I,regExp:C},loopRequired:null!==(g=t.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(y=t.loopEnum)&&void 0!==y?y:200,meta:null===(v=t.meta)||void 0===v||v,messages:null===(w=t.messages)||void 0===w||w,inlineRefs:null===(b=t.inlineRefs)||void 0===b||b,schemaId:null!==(_=t.schemaId)&&void 0!==_?_:"$id",addUsedSchema:null===(E=t.addUsedSchema)||void 0===E||E,validateSchema:null===(A=t.validateSchema)||void 0===A||A,validateFormats:null===(k=t.validateFormats)||void 0===k||k,unicodeRegExp:null===(M=t.unicodeRegExp)||void 0===M||M,int32range:null===(x=t.int32range)||void 0===x||x,uriResolver:T}}class u{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...h(t)};const{es5:e,lines:n}=this.opts.code;this.scope=new r.ValueScope({scope:{},prefixes:o,es5:e,lines:n}),this.logger=function(t){if(!1===t)return g;if(void 0===t)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}(t.logger);const i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,rl.getRules)(),l.call(this,s,t,"NOT SUPPORTED"),l.call(this,a,t,"DEPRECATED","warn"),this._metaOpts=m.call(this),t.formats&&d.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&p.call(this,t.keywords),"object"==typeof t.meta&&this.addMetaSchema(t.meta),f.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:e,schemaId:r}=this.opts;let n=bl;"id"===r&&(n={...bl},n.id=n.$id,delete n.$id),e&&t&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:t,schemaId:e}=this.opts;return this.opts.defaultMeta="object"==typeof t?t[e]||t:void 0}validate(t,e){let r;if("string"==typeof t){if(r=this.getSchema(t),!r)throw new Error(`no schema with key or ref "${t}"`)}else r=this.compile(t);const n=r(e);return"$async"in r||(this.errors=r.errors),n}compile(t,e){const r=this._addSchema(t,e);return r.validate||this._compileSchemaEnv(r)}compileAsync(t,e){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,t,e);async function n(t,e){await i.call(this,t.$schema);const r=this._addSchema(t,e);return r.validate||o.call(this,r)}async function i(t){t&&!this.getSchema(t)&&await n.call(this,{$ref:t},!0)}async function o(t){try{return this._compileSchemaEnv(t)}catch(e){if(!(e instanceof vl.default))throw e;return s.call(this,e),await a.call(this,e.missingSchema),o.call(this,t)}}function s({missingSchema:t,missingRef:e}){if(this.refs[t])throw new Error(`AnySchema ${t} is loaded but ${e} cannot be resolved`)}async function a(t){const r=await h.call(this,t);this.refs[t]||await i.call(this,r.$schema),this.refs[t]||this.addSchema(r,t,e)}async function h(t){const e=this._loading[t];if(e)return e;try{return await(this._loading[t]=r(t))}finally{delete this._loading[t]}}}addSchema(t,e,r,n=this.opts.validateSchema){if(Array.isArray(t)){for(const e of t)this.addSchema(e,void 0,r,n);return this}let i;if("object"==typeof t){const{schemaId:e}=this.opts;if(i=t[e],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${e} must be string`)}return e=(0,cl.normalizeId)(e||i),this._checkUnique(e),this.schemas[e]=this._addSchema(t,r,e,n,!0),this}addMetaSchema(t,e,r=this.opts.validateSchema){return this.addSchema(t,e,!0,r),this}validateSchema(t,e){if("boolean"==typeof t)return!0;let r;if(r=t.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,t);if(!n&&e){const t="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(t);this.logger.error(t)}return n}getSchema(t){let e;for(;"string"==typeof(e=c.call(this,t));)t=e;if(void 0===e){const{schemaId:r}=this.opts,n=new wl.SchemaEnv({schema:{},schemaId:r});if(e=wl.resolveSchema.call(this,n,t),!e)return;this.refs[t]=e}return e.validate||this._compileSchemaEnv(e)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const e=c.call(this,t);return"object"==typeof e&&this._cache.delete(e.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{const e=t;this._cache.delete(e);let r=t[this.opts.schemaId];return r&&(r=(0,cl.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const e of t)this.addKeyword(e);return this}addKeyword(t,e){let r;if("string"==typeof t)r=t,"object"==typeof e&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),e.keyword=r);else{if("object"!=typeof t||void 0!==e)throw new Error("invalid addKeywords parameters");if(r=(e=t).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(v.call(this,r,e),!e)return(0,Yu.eachItem)(r,(t=>w.call(this,t))),this;_.call(this,e);const n={...e,type:(0,il.getJSONTypes)(e.type),schemaType:(0,il.getJSONTypes)(e.schemaType)};return(0,Yu.eachItem)(r,0===n.type.length?t=>w.call(this,t,n):t=>n.type.forEach((e=>w.call(this,t,n,e)))),this}getKeyword(t){const e=this.RULES.all[t];return"object"==typeof e?e.definition:!!e}removeKeyword(t){const{RULES:e}=this;delete e.keywords[t],delete e.all[t];for(const r of e.rules){const e=r.rules.findIndex((e=>e.keyword===t));e>=0&&r.rules.splice(e,1)}return this}addFormat(t,e){return"string"==typeof e&&(e=new RegExp(e)),this.formats[t]=e,this}errorsText(t=this.errors,{separator:e=", ",dataVar:r="data"}={}){return t&&0!==t.length?t.map((t=>`${r}${t.instancePath} ${t.message}`)).reduce(((t,r)=>t+e+r)):"No errors"}$dataMetaSchema(t,e){const r=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const n of e){const e=n.split("/").slice(1);let i=t;for(const t of e)i=i[t];for(const t in r){const e=r[t];if("object"!=typeof e)continue;const{$data:n}=e.definition,o=i[t];n&&o&&(i[t]=A(o))}}return t}_removeAllSchemas(t,e){for(const r in t){const n=t[r];e&&!e.test(r)||("string"==typeof n?delete t[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[r]))}}_addSchema(t,e,r,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o;const{schemaId:s}=this.opts;if("object"==typeof t)o=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof t)throw new Error("schema must be object or boolean")}let a=this._cache.get(t);if(void 0!==a)return a;r=(0,cl.normalizeId)(o||r);const h=cl.getSchemaRefs.call(this,t,r);return a=new wl.SchemaEnv({schema:t,schemaId:s,meta:e,baseId:r,localRefs:h}),this._cache.set(a.schema,a),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=a),n&&this.validateSchema(t,!0),a}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):wl.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const e=this.opts;this.opts=this._metaOpts;try{wl.compileSchema.call(this,t)}finally{this.opts=e}}}function l(t,e,r,n="error"){for(const i in t){const o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function c(t){return t=(0,cl.normalizeId)(t),this.schemas[t]||this.refs[t]}function f(){const t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(const e in t)this.addSchema(t[e],e)}function d(){for(const t in this.opts.formats){const e=this.opts.formats[t];e&&this.addFormat(t,e)}}function p(t){if(Array.isArray(t))this.addVocabulary(t);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const e in t){const r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}}function m(){const t={...this.opts};for(const e of i)delete t[e];return t}e.default=u,u.ValidationError=ml.default,u.MissingRefError=vl.default;const g={log(){},warn(){},error(){}};const y=/^[a-z_$][a-z0-9_$:-]*$/i;function v(t,e){const{RULES:r}=this;if((0,Yu.eachItem)(t,(t=>{if(r.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!y.test(t))throw new Error(`Keyword ${t} has invalid name`)})),e&&e.$data&&!("code"in e)&&!("validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function w(t,e,r){var n;const i=null==e?void 0:e.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let s=i?o.post:o.rules.find((({type:t})=>t===r));if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;const a={keyword:t,definition:{...e,type:(0,il.getJSONTypes)(e.type),schemaType:(0,il.getJSONTypes)(e.schemaType)}};e.before?b.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,null===(n=e.implements)||void 0===n||n.forEach((t=>this.addKeyword(t)))}function b(t,e,r){const n=t.rules.findIndex((t=>t.keyword===r));n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function _(t){let{metaSchema:e}=t;void 0!==e&&(t.$data&&this.opts.$data&&(e=A(e)),t.validateSchema=this.compile(e,!0))}const E={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function A(t){return{anyOf:[t,E]}}}));var Ml={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}},xl=Object.defineProperty({default:Ml},"__esModule",{value:!0}),Sl=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;const r={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:o}=t,{baseId:s,schemaEnv:a,validateName:h,opts:u,self:l}=o,{root:c}=a;if(("#"===r||"#/"===r)&&s===c.baseId)return function(){if(a===c)return i(t,h,a,a.$async);const r=e.scopeValue("root",{ref:c});return i(t,Qu._`${r}.validate`,c,c.$async)}();const f=wl.resolveRef.call(l,c,s,r);if(void 0===f)throw new vl.default(o.opts.uriResolver,s,r);return f instanceof wl.SchemaEnv?function(e){const r=n(t,e);i(t,r,e,e.$async)}(f):function(n){const i=e.scopeValue("schema",!0===u.code.source?{ref:n,code:(0,Qu.stringify)(n)}:{ref:n}),o=e.name("valid"),s=t.subschema({schema:n,dataTypes:[],schemaPath:Qu.nil,topSchemaRef:i,errSchemaPath:r},o);t.mergeEvaluated(s),t.ok(o)}(f)}};function n(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):Qu._`${r.scopeValue("wrapper",{ref:e})}.validate`}function i(t,e,r,n){const{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:h}=o,u=h.passContext?Xu.default.this:Qu.nil;function l(t){const e=Qu._`${t}.errors`;i.assign(Xu.default.vErrors,Qu._`${Xu.default.vErrors} === null ? ${e} : ${Xu.default.vErrors}.concat(${e})`),i.assign(Xu.default.errors,Qu._`${Xu.default.vErrors}.length`)}function c(t){var e;if(!o.opts.unevaluated)return;const n=null===(e=null==r?void 0:r.validate)||void 0===e?void 0:e.evaluated;if(!0!==o.props)if(n&&!n.dynamicProps)void 0!==n.props&&(o.props=Yu.mergeEvaluated.props(i,n.props,o.props));else{const e=i.var("props",Qu._`${t}.evaluated.props`);o.props=Yu.mergeEvaluated.props(i,e,o.props,Qu.Name)}if(!0!==o.items)if(n&&!n.dynamicItems)void 0!==n.items&&(o.items=Yu.mergeEvaluated.items(i,n.items,o.items));else{const e=i.var("items",Qu._`${t}.evaluated.items`);o.items=Yu.mergeEvaluated.items(i,e,o.items,Qu.Name)}}n?function(){if(!a.$async)throw new Error("async schema referenced by sync schema");const r=i.let("valid");i.try((()=>{i.code(Qu._`await ${(0,sl.callValidateCode)(t,e,u)}`),c(e),s||i.assign(r,!0)}),(t=>{i.if(Qu._`!(${t} instanceof ${o.ValidationError})`,(()=>i.throw(t))),l(t),s||i.assign(r,!1)})),t.ok(r)}():t.result((0,sl.callValidateCode)(t,e,u),(()=>c(e)),(()=>l(e)))}e.getValidate=n,e.callRef=i,e.default=r}));var Nl=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",xl.default,Sl.default],Il=Object.defineProperty({default:Nl},"__esModule",{value:!0});const Cl=Qu.operators,Tl={maximum:{okStr:"<=",ok:Cl.LTE,fail:Cl.GT},minimum:{okStr:">=",ok:Cl.GTE,fail:Cl.LT},exclusiveMaximum:{okStr:"<",ok:Cl.LT,fail:Cl.GTE},exclusiveMinimum:{okStr:">",ok:Cl.GT,fail:Cl.LTE}},Pl={message:({keyword:t,schemaCode:e})=>Qu.str`must be ${Tl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>Qu._`{comparison: ${Tl[t].okStr}, limit: ${e}}`},Rl={keyword:Object.keys(Tl),type:"number",schemaType:"number",$data:!0,error:Pl,code(t){const{keyword:e,data:r,schemaCode:n}=t;t.fail$data(Qu._`${r} ${Tl[e].fail} ${n} || isNaN(${r})`)}};var Ol=Rl,$l=Object.defineProperty({default:Ol},"__esModule",{value:!0});const Bl={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>Qu.str`must be multiple of ${t}`,params:({schemaCode:t})=>Qu._`{multipleOf: ${t}}`},code(t){const{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?Qu._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:Qu._`${s} !== parseInt(${s})`;t.fail$data(Qu._`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};var Dl=Bl,Fl=Object.defineProperty({default:Dl},"__esModule",{value:!0});function Ul(t){const e=t.length;let r,n=0,i=0;for(;i<e;)n++,r=t.charCodeAt(i++),r>=55296&&r<=56319&&i<e&&(r=t.charCodeAt(i),56320==(64512&r)&&i++);return n}var jl=Ul;Ul.code='require("ajv/dist/runtime/ucs2length").default';var Ll=Object.defineProperty({default:jl},"__esModule",{value:!0});const zl={message({keyword:t,schemaCode:e}){const r="maxLength"===t?"more":"fewer";return Qu.str`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>Qu._`{limit: ${t}}`},ql={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zl,code(t){const{keyword:e,data:r,schemaCode:n,it:i}=t,o="maxLength"===e?Qu.operators.GT:Qu.operators.LT,s=!1===i.opts.unicode?Qu._`${r}.length`:Qu._`${(0,Yu.useFunc)(t.gen,Ll.default)}(${r})`;t.fail$data(Qu._`${s} ${o} ${n}`)}};var Vl=ql,Hl=Object.defineProperty({default:Vl},"__esModule",{value:!0});var Gl={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>Qu.str`must match pattern "${t}"`,params:({schemaCode:t})=>Qu._`{pattern: ${t}}`},code(t){const{data:e,$data:r,schema:n,schemaCode:i,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?Qu._`(new RegExp(${i}, ${s}))`:(0,sl.usePattern)(t,n);t.fail$data(Qu._`!${a}.test(${e})`)}},Kl=Object.defineProperty({default:Gl},"__esModule",{value:!0});const Zl={message({keyword:t,schemaCode:e}){const r="maxProperties"===t?"more":"fewer";return Qu.str`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>Qu._`{limit: ${t}}`},Jl={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Zl,code(t){const{keyword:e,data:r,schemaCode:n}=t,i="maxProperties"===e?Qu.operators.GT:Qu.operators.LT;t.fail$data(Qu._`Object.keys(${r}).length ${i} ${n}`)}};var Ql=Jl,Yl=Object.defineProperty({default:Ql},"__esModule",{value:!0});const Wl={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:t}})=>Qu.str`must have required property '${t}'`,params:({params:{missingProperty:t}})=>Qu._`{missingProperty: ${t}}`},code(t){const{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&0===r.length)return;const h=r.length>=a.loopRequired;if(s.allErrors?function(){if(h||o)t.block$data(Qu.nil,u);else for(const e of r)(0,sl.checkReportMissingProp)(t,e)}():function(){const s=e.let("missing");if(h||o){const r=e.let("valid",!0);t.block$data(r,(()=>function(r,o){t.setParams({missingProperty:r}),e.forOf(r,n,(()=>{e.assign(o,(0,sl.propertyInData)(e,i,r,a.ownProperties)),e.if((0,Qu.not)(o),(()=>{t.error(),e.break()}))}),Qu.nil)}(s,r))),t.ok(r)}else e.if((0,sl.checkMissingProp)(t,r,s)),(0,sl.reportMissingProp)(t,s),e.else()}(),a.strictRequired){const e=t.parentSchema.properties,{definedProperties:n}=t.it;for(const t of r)if(void 0===(null==e?void 0:e[t])&&!n.has(t)){const e=`required property "${t}" is not defined at "${s.schemaEnv.baseId+s.errSchemaPath}" (strictRequired)`;(0,Yu.checkStrictMode)(s,e,s.opts.strictRequired)}}function u(){e.forOf("prop",n,(r=>{t.setParams({missingProperty:r}),e.if((0,sl.noPropertyInData)(e,i,r,a.ownProperties),(()=>t.error()))}))}}};var Xl=Wl,tc=Object.defineProperty({default:Xl},"__esModule",{value:!0});const ec={message({keyword:t,schemaCode:e}){const r="maxItems"===t?"more":"fewer";return Qu.str`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>Qu._`{limit: ${t}}`},rc={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:ec,code(t){const{keyword:e,data:r,schemaCode:n}=t,i="maxItems"===e?Qu.operators.GT:Qu.operators.LT;t.fail$data(Qu._`${r}.length ${i} ${n}`)}};var nc=rc,ic=Object.defineProperty({default:nc},"__esModule",{value:!0});ul.code='require("ajv/dist/runtime/equal").default';var oc=ul,sc=Object.defineProperty({default:oc},"__esModule",{value:!0});const ac={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:t,j:e}})=>Qu.str`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>Qu._`{i: ${t}, j: ${e}}`},code(t){const{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;const h=e.let("valid"),u=o.items?(0,il.getSchemaTypes)(o.items):[];function l(n,i){const o=e.name("item"),s=(0,il.checkDataTypes)(u,o,a.opts.strictNumbers,il.DataType.Wrong),l=e.const("indices",Qu._`{}`);e.for(Qu._`;${n}--;`,(()=>{e.let(o,Qu._`${r}[${n}]`),e.if(s,Qu._`continue`),u.length>1&&e.if(Qu._`typeof ${o} == "string"`,Qu._`${o} += "_"`),e.if(Qu._`typeof ${l}[${o}] == "number"`,(()=>{e.assign(i,Qu._`${l}[${o}]`),t.error(),e.assign(h,!1).break()})).code(Qu._`${l}[${o}] = ${n}`)}))}function c(n,i){const o=(0,Yu.useFunc)(e,sc.default),s=e.name("outer");e.label(s).for(Qu._`;${n}--;`,(()=>e.for(Qu._`${i} = ${n}; ${i}--;`,(()=>e.if(Qu._`${o}(${r}[${n}], ${r}[${i}])`,(()=>{t.error(),e.assign(h,!1).break(s)}))))))}t.block$data(h,(function(){const n=e.let("i",Qu._`${r}.length`),i=e.let("j");t.setParams({i:n,j:i}),e.assign(h,!0),e.if(Qu._`${n} > 1`,(()=>(u.length>0&&!u.some((t=>"object"===t||"array"===t))?l:c)(n,i)))}),Qu._`${s} === false`),t.ok(h)}};var hc=ac,uc=Object.defineProperty({default:hc},"__esModule",{value:!0});const lc={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>Qu._`{allowedValue: ${t}}`},code(t){const{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&"object"==typeof o?t.fail$data(Qu._`!${(0,Yu.useFunc)(e,sc.default)}(${r}, ${i})`):t.fail(Qu._`${o} !== ${r}`)}};var cc=lc,fc=Object.defineProperty({default:cc},"__esModule",{value:!0});const dc={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>Qu._`{allowedValues: ${t}}`},code(t){const{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&0===i.length)throw new Error("enum must have non-empty array");const a=i.length>=s.opts.loopEnum;let h;const u=()=>null!=h?h:h=(0,Yu.useFunc)(e,sc.default);let l;if(a||n)l=e.let("valid"),t.block$data(l,(function(){e.assign(l,!1),e.forOf("v",o,(t=>e.if(Qu._`${u()}(${r}, ${t})`,(()=>e.assign(l,!0).break()))))}));else{if(!Array.isArray(i))throw new Error("ajv implementation error");const t=e.const("vSchema",o);l=(0,Qu.or)(...i.map(((e,n)=>function(t,e){const n=i[e];return"object"==typeof n&&null!==n?Qu._`${u()}(${r}, ${t}[${e}])`:Qu._`${r} === ${n}`}(t,n))))}t.pass(l)}};var pc=dc,mc=Object.defineProperty({default:pc},"__esModule",{value:!0});var gc=[$l.default,Fl.default,Hl.default,Kl.default,Yl.default,tc.default,ic.default,uc.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},fc.default,mc.default],yc=Object.defineProperty({default:gc},"__esModule",{value:!0}),vc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;const r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>Qu.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>Qu._`{limit: ${t}}`},code(t){const{parentSchema:e,it:r}=t,{items:i}=e;Array.isArray(i)?n(t,i):(0,Yu.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function n(t,e){const{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;const a=r.const("len",Qu._`${i}.length`);if(!1===n)t.setParams({len:e.length}),t.pass(Qu._`${a} <= ${e.length}`);else if("object"==typeof n&&!(0,Yu.alwaysValidSchema)(s,n)){const n=r.var("valid",Qu._`${a} <= ${e.length}`);r.if((0,Qu.not)(n),(()=>function(n){r.forRange("i",e.length,a,(e=>{t.subschema({keyword:o,dataProp:e,dataPropType:Yu.Type.Num},n),s.allErrors||r.if((0,Qu.not)(n),(()=>r.break()))}))}(n))),t.ok(n)}}e.validateAdditionalItems=n,e.default=r})),wc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;const r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return n(t,"additionalItems",e);r.items=!0,(0,Yu.alwaysValidSchema)(r,e)||t.ok((0,sl.validateArray)(t))}};function n(t,e,r=t.schema){const{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;!function(t){const{opts:n,errSchemaPath:i}=a,o=r.length,h=o===t.minItems&&(o===t.maxItems||!1===t[e]);if(n.strictTuples&&!h){const t=`"${s}" is ${o}-tuple, but minItems or maxItems/${e} are not specified or different at path "${i}"`;(0,Yu.checkStrictMode)(a,t,n.strictTuples)}}(i),a.opts.unevaluated&&r.length&&!0!==a.items&&(a.items=Yu.mergeEvaluated.items(n,r.length,a.items));const h=n.name("valid"),u=n.const("len",Qu._`${o}.length`);r.forEach(((e,r)=>{(0,Yu.alwaysValidSchema)(a,e)||(n.if(Qu._`${u} > ${r}`,(()=>t.subschema({keyword:s,schemaProp:r,dataProp:r},h))),t.ok(h))}))}e.validateTuple=n,e.default=r}));var bc={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,wc.validateTuple)(t,"items")},_c=Object.defineProperty({default:bc},"__esModule",{value:!0});const Ec={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>Qu.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>Qu._`{limit: ${t}}`},code(t){const{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,(0,Yu.alwaysValidSchema)(n,e)||(i?(0,vc.validateAdditionalItems)(t,i):t.ok((0,sl.validateArray)(t)))}};var Ac=Ec,kc=Object.defineProperty({default:Ac},"__esModule",{value:!0});const Mc={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:e}})=>void 0===e?Qu.str`must contain at least ${t} valid item(s)`:Qu.str`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>void 0===e?Qu._`{minContains: ${t}}`:Qu._`{minContains: ${t}, maxContains: ${e}}`},code(t){const{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;let s,a;const{minContains:h,maxContains:u}=n;o.opts.next?(s=void 0===h?1:h,a=u):s=1;const l=e.const("len",Qu._`${i}.length`);if(t.setParams({min:s,max:a}),void 0===a&&0===s)return void(0,Yu.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==a&&s>a)return(0,Yu.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),void t.fail();if((0,Yu.alwaysValidSchema)(o,r)){let e=Qu._`${l} >= ${s}`;return void 0!==a&&(e=Qu._`${e} && ${l} <= ${a}`),void t.pass(e)}o.items=!0;const c=e.name("valid");function f(){const t=e.name("_valid"),r=e.let("count",0);d(t,(()=>e.if(t,(()=>function(t){e.code(Qu._`${t}++`),void 0===a?e.if(Qu._`${t} >= ${s}`,(()=>e.assign(c,!0).break())):(e.if(Qu._`${t} > ${a}`,(()=>e.assign(c,!1).break())),1===s?e.assign(c,!0):e.if(Qu._`${t} >= ${s}`,(()=>e.assign(c,!0))))}(r)))))}function d(r,n){e.forRange("i",0,l,(e=>{t.subschema({keyword:"contains",dataProp:e,dataPropType:Yu.Type.Num,compositeRule:!0},r),n()}))}void 0===a&&1===s?d(c,(()=>e.if(c,(()=>e.break())))):0===s?(e.let(c,!0),void 0!==a&&e.if(Qu._`${i}.length > 0`,f)):(e.let(c,!1),f()),t.result(c,(()=>t.reset()))}};var xc=Mc,Sc=Object.defineProperty({default:xc},"__esModule",{value:!0}),Nc=o((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0,e.error={message:({params:{property:t,depsCount:e,deps:r}})=>{const n=1===e?"property":"properties";return Qu.str`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>Qu._`{property: ${t},
|
|
@@ -29,4 +29,4 @@ function Gg(t){const{Fp:e,mds:r,reversePartialPowIdx:n,roundConstants:i}=t,{roun
|
|
|
29
29
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:Wg,hexToBytes:Xg}=Hm,ty={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=ty;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(128&n[0])throw new e("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Wg(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=ty,r="string"==typeof t?Xg(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:o}=ty._parseInt(r.subarray(2)),{d:s,l:a}=ty._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:s}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,r=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),h=r(s);return`30${r(s+o+4)}02${h}${i}02${a}${n}`}},ey=BigInt(0),ry=BigInt(1),ny=BigInt(2),iy=BigInt(3),oy=BigInt(4);function sy(t){const e=function(t){const e=Yg(t);Vm(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:r}=e,n=e.toBytes||((t,e,n)=>{const i=e.toAffine();return Fm(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=e.fromBytes||(t=>{const e=t.subarray(1);return{x:r.fromBytes(e.subarray(0,r.BYTES)),y:r.fromBytes(e.subarray(r.BYTES,2*r.BYTES))}});function o(t){const{a:n,b:i}=e,o=r.sqr(t),s=r.mul(o,t);return r.add(r.add(s,r.mul(t,n)),i)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&ey<t&&t<e.n}function a(t){if(!s(t))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function h(t){const{allowedPrivateKeyLengths:r,nByteLength:n,wrapPrivateKey:i,n:o}=e;if(r&&"bigint"!=typeof t){if(t instanceof Uint8Array&&(t=Nm(t)),"string"!=typeof t||!r.includes(t.length))throw new Error("Invalid key");t=t.padStart(2*n,"0")}let s;try{s="bigint"==typeof t?t:Pm(Dm("private key",t,n))}catch(e){throw new Error(`private key must be ${n} bytes, hex or bigint, not ${typeof t}`)}return i&&(s=$g(s,o)),a(s),s}const u=new Map;function l(t){if(!(t instanceof c))throw new Error("ProjectivePoint expected")}class c{constructor(t,e,n){if(this.px=t,this.py=e,this.pz=n,null==t||!r.isValid(t))throw new Error("x required");if(null==e||!r.isValid(e))throw new Error("y required");if(null==n||!r.isValid(n))throw new Error("z required")}static fromAffine(t){const{x:e,y:n}=t||{};if(!t||!r.isValid(e)||!r.isValid(n))throw new Error("invalid affine point");if(t instanceof c)throw new Error("projective point not allowed");const i=t=>r.eql(t,r.ZERO);return i(e)&&i(n)?c.ZERO:new c(e,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=r.invertBatch(t.map((t=>t.pz)));return t.map(((t,r)=>t.toAffine(e[r]))).map(c.fromAffine)}static fromHex(t){const e=c.fromAffine(i(Dm("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return c.BASE.multiply(h(t))}_setWindowSize(t){this._WINDOW_SIZE=t,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:n}=this.toAffine();if(!r.isValid(t)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),s=o(t);if(!r.eql(i,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(r.isOdd)return!r.isOdd(t);throw new Error("Field doesn't support isOdd")}equals(t){l(t);const{px:e,py:n,pz:i}=this,{px:o,py:s,pz:a}=t,h=r.eql(r.mul(e,a),r.mul(o,i)),u=r.eql(r.mul(n,a),r.mul(s,i));return h&&u}negate(){return new c(this.px,r.neg(this.py),this.pz)}double(){const{a:t,b:n}=e,i=r.mul(n,iy),{px:o,py:s,pz:a}=this;let h=r.ZERO,u=r.ZERO,l=r.ZERO,f=r.mul(o,o),d=r.mul(s,s),p=r.mul(a,a),m=r.mul(o,s);return m=r.add(m,m),l=r.mul(o,a),l=r.add(l,l),h=r.mul(t,l),u=r.mul(i,p),u=r.add(h,u),h=r.sub(d,u),u=r.add(d,u),u=r.mul(h,u),h=r.mul(m,h),l=r.mul(i,l),p=r.mul(t,p),m=r.sub(f,p),m=r.mul(t,m),m=r.add(m,l),l=r.add(f,f),f=r.add(l,f),f=r.add(f,p),f=r.mul(f,m),u=r.add(u,f),p=r.mul(s,a),p=r.add(p,p),f=r.mul(p,m),h=r.sub(h,f),l=r.mul(p,d),l=r.add(l,l),l=r.add(l,l),new c(h,u,l)}add(t){l(t);const{px:n,py:i,pz:o}=this,{px:s,py:a,pz:h}=t;let u=r.ZERO,f=r.ZERO,d=r.ZERO;const p=e.a,m=r.mul(e.b,iy);let g=r.mul(n,s),y=r.mul(i,a),v=r.mul(o,h),w=r.add(n,i),b=r.add(s,a);w=r.mul(w,b),b=r.add(g,y),w=r.sub(w,b),b=r.add(n,o);let _=r.add(s,h);return b=r.mul(b,_),_=r.add(g,v),b=r.sub(b,_),_=r.add(i,o),u=r.add(a,h),_=r.mul(_,u),u=r.add(y,v),_=r.sub(_,u),d=r.mul(p,b),u=r.mul(m,v),d=r.add(u,d),u=r.sub(y,d),d=r.add(y,d),f=r.mul(u,d),y=r.add(g,g),y=r.add(y,g),v=r.mul(p,v),b=r.mul(m,b),y=r.add(y,v),v=r.sub(g,v),v=r.mul(p,v),b=r.add(b,v),g=r.mul(y,b),f=r.add(f,g),g=r.mul(_,b),u=r.mul(w,u),u=r.sub(u,g),g=r.mul(w,y),d=r.mul(_,d),d=r.add(d,g),new c(u,f,d)}subtract(t){return this.add(t.negate())}is0(){return this.equals(c.ZERO)}wNAF(t){return d.wNAFCached(this,u,t,(t=>{const e=r.invertBatch(t.map((t=>t.pz)));return t.map(((t,r)=>t.toAffine(e[r]))).map(c.fromAffine)}))}multiplyUnsafe(t){const n=c.ZERO;if(t===ey)return n;if(a(t),t===ry)return this;const{endo:i}=e;if(!i)return d.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:h,k2:u}=i.splitScalar(t),l=n,f=n,p=this;for(;s>ey||u>ey;)s&ry&&(l=l.add(p)),u&ry&&(f=f.add(p)),p=p.double(),s>>=ry,u>>=ry;return o&&(l=l.negate()),h&&(f=f.negate()),f=new c(r.mul(f.px,i.beta),f.py,f.pz),l.add(f)}multiply(t){a(t);let n,i,o=t;const{endo:s}=e;if(s){const{k1neg:t,k1:e,k2neg:a,k2:h}=s.splitScalar(o);let{p:u,f:l}=this.wNAF(e),{p:f,f:p}=this.wNAF(h);u=d.constTimeNegate(t,u),f=d.constTimeNegate(a,f),f=new c(r.mul(f.px,s.beta),f.py,f.pz),n=u.add(f),i=l.add(p)}else{const{p:t,f:e}=this.wNAF(o);n=t,i=e}return c.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(t,e,r){const n=c.BASE,i=(t,e)=>e!==ey&&e!==ry&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,r));return o.is0()?void 0:o}toAffine(t){const{px:e,py:n,pz:i}=this,o=this.is0();null==t&&(t=o?r.ONE:r.inv(i));const s=r.mul(e,t),a=r.mul(n,t),h=r.mul(i,t);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(h,r.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:t,isTorsionFree:r}=e;if(t===ry)return!0;if(r)return r(c,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:r}=e;return t===ry?this:r?r(c,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),n(c,this,t)}toHex(t=!0){return Nm(this.toRawBytes(t))}}c.BASE=new c(e.Gx,e.Gy,r.ONE),c.ZERO=new c(r.ZERO,r.ONE,r.ZERO);const f=e.nBitLength,d=function(t,e){const r=(t,e)=>{const r=e.negate();return t?r:e},n=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:r,unsafeLadder(e,r){let n=t.ZERO,i=e;for(;r>Jg;)r&Qg&&(n=n.add(i)),i=i.double(),r>>=Qg;return n},precomputeWindow(t,e){const{windows:r,windowSize:i}=n(e),o=[];let s=t,a=s;for(let t=0;t<r;t++){a=s,o.push(a);for(let t=1;t<i;t++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(e,i,o){const{windows:s,windowSize:a}=n(e);let h=t.ZERO,u=t.BASE;const l=BigInt(2**e-1),c=2**e,f=BigInt(e);for(let t=0;t<s;t++){const e=t*a;let n=Number(o&l);o>>=f,n>a&&(n-=c,o+=Qg);const s=e,d=e+Math.abs(n)-1,p=t%2!=0,m=n<0;0===n?u=u.add(r(p,i[s])):h=h.add(r(m,i[d]))}return{p:h,f:u}},wNAFCached(t,e,r,n){const i=t._WINDOW_SIZE||1;let o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,n(o))),this.wNAF(i,o,r)}}}(c,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:c,normPrivateKeyToScalar:h,weierstrassEquation:o,isWithinCurveOrder:s}}function ay(t){const e=function(t){const e=Yg(t);return Vm(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(t){return $g(t,n)}function a(t){return Dg(t,n)}const{ProjectivePoint:h,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:c}=sy({...e,toBytes(t,e,n){const i=e.toAffine(),o=r.toBytes(i.x),s=Fm;return n?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(t){const e=t.length,n=t[0],s=t.subarray(1);if(e!==i||2!==n&&3!==n){if(e===o&&4===n){return{x:r.fromBytes(s.subarray(0,r.BYTES)),y:r.fromBytes(s.subarray(r.BYTES,2*r.BYTES))}}throw new Error(`Point of length ${e} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const t=Pm(s);if(!(ey<(a=t)&&a<r.ORDER))throw new Error("Point is not on curve");const e=l(t);let i=r.sqrt(e);return 1==(1&n)!==((i&ry)===ry)&&(i=r.neg(i)),{x:t,y:i}}var a}}),f=t=>Nm(Om(t,e.nByteLength));function d(t){return t>n>>ry}const p=(t,e,r)=>Pm(t.slice(e,r));class m{constructor(t,e,r){this.r=t,this.s=e,this.recovery=r,this.assertValidity()}static fromCompact(t){const r=e.nByteLength;return t=Dm("compactSignature",t,2*r),new m(p(t,0,r),p(t,r,2*r))}static fromDER(t){const{r:e,s:r}=ty.toSig(Dm("DER",t));return new m(e,r)}assertValidity(){if(!c(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!c(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new m(this.r,this.s,t)}recoverPublicKey(t){const{r:n,s:i,recovery:o}=this,u=w(Dm("msgHash",t));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const l=2===o||3===o?n+e.n:n;if(l>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const c=0==(1&o)?"02":"03",d=h.fromHex(c+f(l)),p=a(l),m=s(-u*p),g=s(i*p),y=h.BASE.multiplyAndAddUnsafe(d,m,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return Tm(this.toDERHex())}toDERHex(){return ty.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Tm(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const g={isValidPrivateKey(t){try{return u(t),!0}catch(t){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const t=Hg(e.n);return function(t,e,r=!1){const n=t.length,i=Vg(e),o=Hg(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const s=$g(r?Pm(t):Rm(t),e-Ig)+Ig;return r?$m(s,i):Om(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=h.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=t instanceof Uint8Array,r="string"==typeof t,n=(e||r)&&t.length;return e?n===i||n===o:r?n===2*i||n===2*o:t instanceof h}const v=e.bits2int||function(t){const r=Pm(t),n=8*t.length-e.nBitLength;return n>0?r>>BigInt(n):r},w=e.bits2int_modN||function(t){return s(v(t))},b=Um(e.nBitLength);function _(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(ey<=t&&t<b))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Om(t,e.nByteLength)}function E(t,n,i=A){if(["recovered","canonical"].some((t=>t in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=e;let{lowS:f,prehash:p,extraEntropy:g}=i;null==f&&(f=!0),t=Dm("msgHash",t),p&&(t=Dm("prehashed msgHash",o(t)));const y=w(t),b=u(n),E=[_(b),_(y)];if(null!=g){const t=!0===g?l(r.BYTES):g;E.push(Dm("extraEntropy",t))}const k=Fm(...E),M=y;return{seed:k,k2sig:function(t){const e=v(t);if(!c(e))return;const r=a(e),n=h.BASE.multiply(e).toAffine(),i=s(n.x);if(i===ey)return;const o=s(r*s(M+i*b));if(o===ey)return;let u=(n.x===i?0:2)|Number(n.y&ry),l=o;return f&&d(o)&&(l=function(t){return d(t)?s(-t):t}(o),u^=1),new m(i,l,u)}}}const A={lowS:e.lowS,prehash:!1},k={lowS:e.lowS,prehash:!1};return h.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return h.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,r=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return h.fromHex(e).multiply(u(t)).toRawBytes(r)},sign:function(t,r,n=A){const{seed:i,k2sig:o}=E(t,r,n),s=e;return zm(s.hash.outputLen,s.nByteLength,s.hmac)(i,o)},verify:function(t,r,n,i=k){const o=t;if(r=Dm("msgHash",r),n=Dm("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=i;let c,f;try{if("string"==typeof o||o instanceof Uint8Array)try{c=m.fromDER(o)}catch(t){if(!(t instanceof ty.Err))throw t;c=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:t,s:e}=o;c=new m(t,e)}}f=h.fromHex(n)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&c.hasHighS())return!1;l&&(r=e.hash(r));const{r:d,s:p}=c,g=w(r),y=a(p),v=s(g*y),b=s(d*y),_=h.BASE.multiplyAndAddUnsafe(f,v,b)?.toAffine();return!!_&&s(_.x)===d},ProjectivePoint:h,Signature:m,utils:g}}function hy(t,e){const r=t.ORDER;let n=ey;for(let t=r-ry;t%ny===ey;t/=ny)n+=ry;const i=n,o=ny<<i-ry-ry,s=o*ny,a=(r-ry)/s,h=(a-ry)/ny,u=s-ry,l=o,c=t.pow(e,a),f=t.pow(e,(a+ry)/ny);let d=(e,r)=>{let n=c,o=t.pow(r,u),s=t.sqr(o);s=t.mul(s,r);let a=t.mul(e,s);a=t.pow(a,h),a=t.mul(a,o),o=t.mul(a,r),s=t.mul(a,e);let d=t.mul(s,o);a=t.pow(d,l);let p=t.eql(a,t.ONE);o=t.mul(s,f),a=t.mul(d,n),s=t.cmov(o,s,p),d=t.cmov(a,d,p);for(let e=i;e>ry;e--){let r=e-ny;r=ny<<r-ry;let i=t.pow(d,r);const a=t.eql(i,t.ONE);o=t.mul(s,n),n=t.mul(n,n),i=t.mul(d,n),s=t.cmov(o,s,a),d=t.cmov(i,d,a)}return{isValid:p,value:s}};if(t.ORDER%oy===iy){const r=(t.ORDER-iy)/oy,n=t.sqrt(t.neg(e));d=(e,i)=>{let o=t.sqr(i);const s=t.mul(e,i);o=t.mul(o,s);let a=t.pow(o,r);a=t.mul(a,s);const h=t.mul(a,n),u=t.mul(t.sqr(a),i),l=t.eql(u,e);return{isValid:l,value:t.cmov(h,a,l)}}}return d}var uy=Object.freeze({__proto__:null,DER:ty,weierstrassPoints:sy,weierstrass:ay,SWUFpSqrtRatio:hy,mapToCurveSimpleSWU:function(t,e){if(jg(t),!t.isValid(e.A)||!t.isValid(e.B)||!t.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const r=hy(t,e.Z);if(!t.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,o,s,a,h,u,l,c;i=t.sqr(n),i=t.mul(i,e.Z),o=t.sqr(i),o=t.add(o,i),s=t.add(o,t.ONE),s=t.mul(s,e.B),a=t.cmov(e.Z,t.neg(o),!t.eql(o,t.ZERO)),a=t.mul(a,e.A),o=t.sqr(s),u=t.sqr(a),h=t.mul(u,e.A),o=t.add(o,h),o=t.mul(o,s),u=t.mul(u,a),h=t.mul(u,e.B),o=t.add(o,h),l=t.mul(i,s);const{isValid:f,value:d}=r(o,u);c=t.mul(i,n),c=t.mul(c,d),l=t.cmov(l,s,f),c=t.cmov(c,d,f);const p=t.isOdd(n)===t.isOdd(c);return c=t.cmov(t.neg(c),c,p),l=t.div(l,a),{x:l,y:c}}}});function ly(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function cy(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const fy="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,dy=t=>t instanceof Uint8Array;
|
|
30
30
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function py(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!dy(t))throw new Error("expected Uint8Array, got "+typeof t);return t}function my(t=32){if(fy&&"function"==typeof fy.getRandomValues)return fy.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class gy extends class{clone(){return this._cloneInto()}}{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");ly(t.outputLen),ly(t.blockLen)}(t);const r=py(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?t.create().update(r).digest():r);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){return cy(this),this.iHash.update(t),this}digestInto(t){cy(this),function(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const yy=(t,e,r)=>new gy(t,e).update(r).digest();yy.create=(t,e)=>new gy(t,e)
|
|
31
31
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */;const vy=BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"),wy=BigInt("0x800000000000000000000000000000000000000000000000000000000000000");function by(t){for(;0===t[0];)t=t.subarray(1);const e=8*t.length-252,r=Pm(t);return e>0?r>>BigInt(e):r}function _y(t){return"string"==typeof t&&1&(t=Oy(t)).length&&(t="0"+t),Tm(t)}const Ey=ay({a:BigInt(1),b:BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),Fp:qg(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),n:vy,nBitLength:252,Gx:BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),Gy:BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),h:BigInt(1),lowS:!1,...function(t){return{hash:t,hmac:(e,...r)=>yy(t,e,function(...t){const e=new Uint8Array(t.reduce(((t,e)=>t+e.length),0));let r=0;return t.forEach((t=>{if(!dy(t))throw new Error("Uint8Array expected");e.set(t,r),r+=t.length})),e}(...r)),randomBytes:my}}(Sg),bits2int:by,bits2int_modN:t=>{const e=Pm(t).toString(16);return 63===e.length&&(t=_y(e+"0")),$g(by(t),vy)}}),Ay=Ey;function ky(t){return Dm("","string"==typeof t?_y(t):t)}function My(t){return Nm(ky(t)).padStart(64,"0")}function xy(t,e=!1){return Ey.getPublicKey(My(t),e)}function Sy(t){const{r:e,s:r}=t;if(e<0n||e>=wy)throw new Error(`Signature.r should be [1, ${wy})`);const n=Dg(r,vy);if(n<0n||n>=wy)throw new Error(`inv(Signature.s) should be [1, ${wy})`)}function Ny(t){const e=ky(t);if(Pm(e)>=wy)throw new Error(`msgHash should be [0, ${wy})`);return e}const{CURVE:Iy,ProjectivePoint:Cy,Signature:Ty,utils:Py}=Ey;function Ry(t){return`0x${Nm(t.subarray(1)).replace(/^0+/gm,"")}`}function Oy(t){return t.replace(/^0x/i,"")}function $y(t){const e=ky(t),r=2n**256n,n=r-$g(r,vy);for(let t=0;;t++){const r=Ky(Fm(e,Bm(BigInt(t))));if(r<n)return $g(r,vy).toString(16);if(1e5===t)throw new Error("grindKey is broken: tried 100k vals")}}function By(t){return Ry(xy(t,!0))}const Dy=2n**31n-1n,Fy=t=>Number(t&Dy);const Uy=[new Cy(2089986280348253421170679821480865132823066470938446095505822317253594081284n,1713931329540660377023406109199410414810705867260802078187082345529207694986n,1n),new Cy(996781205833008774514500082376783249102396023663454813447423147977397232763n,1668503676786377725805489344771023921079126552019160156920634619255970485781n,1n),new Cy(2251563274489750535117886426533222435294046428347329203627021249169616184184n,1798716007562728905295480679789526322175868328062420237419143593021674992973n,1n),new Cy(2138414695194151160943305727036575959195309218611738193261179310511854807447n,113410276730064486255102093846540133784865286929052426931474106396135072156n,1n),new Cy(2379962749567351885752724891227938183011949129833673362440656643086021394946n,776496453633298175483985398648758586525933812536653089401905292063708816422n,1n)];function jy(t,e){const r=[];let n=t;for(let t=0;t<248;t++)r.push(n),n=n.double();n=e;for(let t=0;t<4;t++)r.push(n),n=n.double();return r}const Ly=jy(Uy[1],Uy[2]),zy=jy(Uy[3],Uy[4]);function qy(t,e,r){let n=function(t){let e;if("bigint"==typeof t)e=t;else if("number"==typeof t){if(!Number.isSafeInteger(t))throw new Error(`Invalid pedersenArg: ${t}`);e=BigInt(t)}else e=Pm(ky(t));if(!(0n<=e&&e<Ey.CURVE.Fp.ORDER))throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);return e}(e);for(let e=0;e<252;e++){const i=r[e];if(i.equals(t))throw new Error("Same point");0n!==(1n&n)&&(t=t.add(i)),n>>=1n}return t}function Vy(t,e){let r=Uy[0];return r=qy(r,t,Ly),r=qy(r,e,zy),Ry(r.toRawBytes(!0))}const Hy=Um(250),Gy=t=>Pm(bg(t))&Hy,Ky=t=>Pm(Sg(t)),Zy=qg(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));function Jy(t,e,r){const n=t.fromBytes(Sg(rg(`${e}${r}`)));return t.create(n)}function Qy(t,e,r,n=0){const i=[],o=[];for(let s=0;s<r;s++)i.push(Jy(t,`${e}x`,n*r+s)),o.push(Jy(t,`${e}y`,n*r+s));if(new Set([...i,...o]).size!==2*r)throw new Error("X and Y values are not distinct");return i.map((e=>o.map((r=>t.inv(t.sub(e,r))))))}function Yy(t,e){if(jg(t.Fp),!Number.isSafeInteger(t.rate)||!Number.isSafeInteger(t.capacity))throw new Error(`Wrong poseidon opts: ${t}`);const r=t.rate+t.capacity,n=t.roundsFull+t.roundsPartial,i=[];for(let e=0;e<n;e++){const n=[];for(let i=0;i<r;i++)n.push(Jy(t.Fp,"Hades",r*e+i));i.push(n)}const o=Kg({...t,t:r,sboxPower:3,reversePartialPowIdx:!0,mds:e,roundConstants:i});return o.m=r,o.rate=t.rate,o.capacity=t.capacity,o}const Wy=Yy({Fp:Zy,rate:2,capacity:1,roundsFull:8,roundsPartial:83},[[3,1,1],[1,-1,1],[1,1,-2]].map((t=>t.map(BigInt))));function Xy(t,e,r=Wy){return r([t,e,2n])[0]}function tv(t,e=Wy){const{m:r,rate:n}=e;if(!Array.isArray(t))throw new Error("bigint array expected in values");const i=Array.from(t);for(i.push(1n);i.length%n!=0;)i.push(0n);let o=new Array(r).fill(0n);for(let t=0;t<i.length;t+=n){for(let e=0;e<n;e++)o[e]+=i[t+e];o=e(o)}return o[0]}var ev=Object.freeze({__proto__:null,MAX_VALUE:wy,_starkCurve:Ay,getPublicKey:xy,getSharedSecret:function(t,e){return Ey.getSharedSecret(My(t),e)},sign:function(t,e,r){const n=Ey.sign(Ny(t),My(e),r);return Sy(n),n},verify:function(t,e,r){if(!(t instanceof Ty)){const e=ky(t);try{t=Ty.fromDER(e)}catch(r){if(!(r instanceof ty.Err))throw r;t=Ty.fromCompact(e)}}return Sy(t),Ey.verify(t,Ny(e),ky(r))},CURVE:Iy,ProjectivePoint:Cy,Signature:Ty,utils:Py,grindKey:$y,getStarkKey:By,ethSigToPrivate:function(t){if(130!==(t=Oy(t)).length)throw new Error("Wrong ethereum signature");return $y(t.substring(0,64))},getAccountPath:function(t,e,r,n){const i=Fy(Ky(t)),o=Fy(Ky(e)),s=Cm(Oy(r));return`m/2645'/${i}'/${o}'/${Fy(s)}'/${Fy(s>>31n)}'/${n}`},pedersen:Vy,computeHashOnElements:(t,e=Vy)=>[0,...t,t.length].reduce(((t,r)=>e(t,r))),keccak:Gy,Fp251:Zy,_poseidonMDS:Qy,poseidonBasic:Yy,poseidonCreate:function(t,e=0){const r=t.rate+t.capacity;if(!Number.isSafeInteger(e))throw new Error(`Wrong mdsAttempt=${e}`);return Yy(t,Qy(t.Fp,"HadesMDS",r,e))},poseidonSmall:Wy,poseidonHash:Xy,poseidonHashFunc:function(t,e,r=Wy){return Bm(Xy(Pm(t),Pm(e),r))},poseidonHashSingle:function(t,e=Wy){return e([t,0n,1n])[0]},poseidonHashMany:tv});function rv(t){return nv.test(t)}var nv=/^-?[0-9]+$/;function iv(t){return ov.test(t)}var ov=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;var sv=function(t){return t.underflow="underflow",t.overflow="overflow",t.truncate_integer="truncate_integer",t.truncate_float="truncate_float",t}({});function av(t){if(!function(t,e){var r=parseFloat(t),n=String(r),i=hv(t),o=hv(n);if(i===o)return!0;if(!0===(null==e?void 0:e.approx)&&!rv(t)&&o.length>=14&&i.startsWith(o.substring(0,14)))return!0;return!1}(t,{approx:!1})){if(rv(t))return sv.truncate_integer;var e=parseFloat(t);return isFinite(e)?0===e?sv.underflow:sv.truncate_float:sv.overflow}}function hv(t){return t.replace(uv,"").replace(cv,"").replace(fv,"").replace(lv,"")}var uv=/[eE][+-]?\d+$/,lv=/^-?(0*)?/,cv=/\./,fv=/0+$/;function dv(t){return dv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dv(t)}function pv(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mv(n.key),n)}}function mv(t){var e=function(t,e){if("object"!==dv(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==dv(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===dv(e)?e:String(e)}var gv=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),function(t,e,r){(e=mv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(this,"isLosslessNumber",!0),!iv(e))throw new Error('Invalid number (value: "'+e+'")');this.value=e}var e,r,n;return e=t,(r=[{key:"valueOf",value:function(){var t=av(this.value);if(void 0===t||t===sv.truncate_float)return parseFloat(this.value);if(rv(this.value))return BigInt(this.value);throw new Error("Cannot safely convert to number: "+"the value '".concat(this.value,"' would ").concat(t," and become ").concat(parseFloat(this.value)))}},{key:"toString",value:function(){return this.value}}])&&pv(e.prototype,r),n&&pv(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function yv(t){return new gv(t)}function vv(t){return rv(t)?BigInt(t):parseFloat(t)}function wv(t){return wv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wv(t)}function bv(t,e){return _v({"":t},"",t,e)}function _v(t,e,r,n){return Array.isArray(r)?n.call(t,e,function(t,e){for(var r=0;r<t.length;r++)t[r]=_v(t,r+"",t[r],e);return t}(r,n)):r&&"object"===wv(r)&&!function(t){return t&&"object"===dv(t)&&!0===t.isLosslessNumber||!1}(r)?n.call(t,e,function(t,e){return Object.keys(t).forEach((function(r){var n=_v(t,r,t[r],e);void 0!==n?t[r]=n:delete t[r]})),t}(r,n)):n.call(t,e,r)}function Ev(t){return Ev="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ev(t)}function Av(t){return function(t){if(Array.isArray(t))return kv(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return kv(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kv(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kv(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Mv(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yv,n=0,i=a();return p(i),g(),e?bv(i,e):i;function o(){if(t.charCodeAt(n)===$v){n++,u();for(var e={},r=!0;n<t.length&&t.charCodeAt(n)!==Bv;){r?r=!1:(f(),u());var i=n,o=l();void 0===o&&w(),u(),d();var s=a();void 0===s&&M(),Object.prototype.hasOwnProperty.call(e,o)&&!Tv(s,e[o])&&b(o,i+1),e[o]=s}return t.charCodeAt(n)!==Bv&&_(),n++,e}}function s(){if(t.charCodeAt(n)===Dv){n++,u();for(var e=[],r=!0;n<t.length&&t.charCodeAt(n)!==Fv;){r?r=!1:f();var i=a();m(i),e.push(i)}return t.charCodeAt(n)!==Fv&&E(),n++,e}}function a(){var t,e,r,n,i,a;u();var f=null!==(t=null!==(e=null!==(r=null!==(n=null!==(i=null!==(a=l())&&void 0!==a?a:c())&&void 0!==i?i:o())&&void 0!==n?n:s())&&void 0!==r?r:h("true",!0))&&void 0!==e?e:h("false",!1))&&void 0!==t?t:h("null",null);return u(),f}function h(e,r){if(t.slice(n,n+e.length)===e)return n+=e.length,r}function u(){for(;xv(t.charCodeAt(n));)n++}function l(){if(t.charCodeAt(n)===qv){n++;for(var e="";n<t.length&&t.charCodeAt(n)!==qv;){if(t.charCodeAt(n)===Ov){var r=t[n+1],i=Rv[r];void 0!==i?(e+=i,n++):"u"===r?Sv(t.charCodeAt(n+2))&&Sv(t.charCodeAt(n+3))&&Sv(t.charCodeAt(n+4))&&Sv(t.charCodeAt(n+5))?(e+=String.fromCharCode(parseInt(t.slice(n+2,n+6),16)),n+=5):x(n):k(n)}else Cv(t.charCodeAt(n))?e+=t[n]:A(t[n]);n++}return v(),n++,e}}function c(){var e=n;if(t.charCodeAt(n)===Hv&&(n++,y(e)),t.charCodeAt(n)===Gv)n++;else if(Iv(t.charCodeAt(n)))for(n++;Nv(t.charCodeAt(n));)n++;if(t.charCodeAt(n)===Qv)for(n++,y(e);Nv(t.charCodeAt(n));)n++;if(t.charCodeAt(n)===ew||t.charCodeAt(n)===tw)for(n++,t.charCodeAt(n)!==Hv&&t.charCodeAt(n)!==Vv||n++,y(e);Nv(t.charCodeAt(n));)n++;if(n>e)return r(t.slice(e,n))}function f(){if(t.charCodeAt(n)!==Jv)throw new SyntaxError("Comma ',' expected after value ".concat(I()));n++}function d(){if(t.charCodeAt(n)!==Yv)throw new SyntaxError("Colon ':' expected after property name ".concat(I()));n++}function p(t){if(void 0===t)throw new SyntaxError("JSON value expected ".concat(I()))}function m(t){if(void 0===t)throw new SyntaxError("Array item expected ".concat(I()))}function g(){if(n<t.length)throw new SyntaxError("Expected end of input ".concat(I()))}function y(e){if(!Nv(t.charCodeAt(n))){var r=t.slice(e,n);throw new SyntaxError("Invalid number '".concat(r,"', expecting a digit ").concat(I()))}}function v(){if(t.charCodeAt(n)!==qv)throw new SyntaxError("End of string '\"' expected ".concat(I()))}function w(){throw new SyntaxError("Quoted object key expected ".concat(I()))}function b(t,e){throw new SyntaxError("Duplicate key '".concat(t,"' encountered at position ").concat(e))}function _(){throw new SyntaxError("Quoted object key or end of object '}' expected ".concat(I()))}function E(){throw new SyntaxError("Array item or end of array ']' expected ".concat(I()))}function A(t){throw new SyntaxError("Invalid character '".concat(t,"' ").concat(S()))}function k(e){var r=t.slice(e,e+2);throw new SyntaxError("Invalid escape character '".concat(r,"' ").concat(S()))}function M(){throw new SyntaxError("Object value expected after ':' ".concat(S()))}function x(e){for(var r=e+2;/\w/.test(t[r]);)r++;var n=t.slice(e,r);throw new SyntaxError("Invalid unicode character '".concat(n,"' ").concat(S()))}function S(){return"at position ".concat(n)}function N(){return n<t.length?"but got '".concat(t[n],"'"):"but reached end of input"}function I(){return N()+" "+S()}}function xv(t){return t===Uv||t===jv||t===Lv||t===zv}function Sv(t){return t>=Gv&&t<=Zv||t>=Wv&&t<=rw||t>=Xv&&t<=nw}function Nv(t){return t>=Gv&&t<=Zv}function Iv(t){return t>=Kv&&t<=Zv}function Cv(t){return t>=32&&t<=1114111}function Tv(t,e){return t===e||(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((function(t,r){return Tv(t,e[r])})):!(!Pv(t)||!Pv(e))&&Av(new Set([].concat(Av(Object.keys(t)),Av(Object.keys(e))))).every((function(r){return Tv(t[r],e[r])})))}function Pv(t){return"object"===Ev(t)&&null!==t}var Rv={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Ov=92,$v=123,Bv=125,Dv=91,Fv=93,Uv=32,jv=10,Lv=9,zv=13,qv=34,Vv=43,Hv=45,Gv=48,Kv=49,Zv=57,Jv=44,Qv=46,Yv=58,Wv=65,Xv=97,tw=69,ew=101,rw=70,nw=102;function iw(t){return iw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iw(t)}function ow(t,e,r,n){var i=function(t){if("number"==typeof t)return" ".repeat(t);if("string"==typeof t&&""!==t)return t;return}
|
|
32
|
-
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */(r);return o("function"==typeof e?e.call({"":t},"",t):t,"");function o(t,s){if(Array.isArray(n)){var a=n.find((function(e){return e.test(t)}));if(a){var h=a.stringify(t);if("string"!=typeof h||!iv(h))throw new Error("Invalid JSON number: output of a number stringifier must be a string containing a JSON number "+"(output: ".concat(h,")"));return h}}return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||t instanceof Date||t instanceof Boolean||t instanceof Number||t instanceof String?JSON.stringify(t):t&&t.isLosslessNumber||"bigint"==typeof t?t.toString():Array.isArray(t)?function(t,r){if(0===t.length)return"[]";for(var n=i?r+i:void 0,s=i?"[\n":"[",a=0;a<t.length;a++){var h="function"==typeof e?e.call(t,String(a),t[a]):t[a];i&&(s+=n),s+=void 0!==h&&"function"!=typeof h?o(h,n):"null",a<t.length-1&&(s+=i?",\n":",")}return s+=i?"\n"+r+"]":"]"}(t,s):t&&"object"===iw(t)?function(t,n){if("function"==typeof t.toJSON)return ow(t.toJSON(),e,r,void 0);var s=Array.isArray(e)?e.map(String):Object.keys(t);if(0===s.length)return"{}";var a=i?n+i:void 0,h=!0,u=i?"{\n":"{";return s.forEach((function(r){var n="function"==typeof e?e.call(t,r,t[r]):t[r];if(function(t,e){return void 0!==e&&"function"!=typeof e&&"symbol"!==iw(e)}(0,n)){h?h=!1:u+=i?",\n":",";var s=JSON.stringify(r);u+=i?a+s+": ":s+":",u+=o(n,a)}})),u+=i?"\n"+n+"}":"}"}(t,s):void 0}}function sw(t){let e=t.length;for(;--e>=0;)t[e]=0}const aw=256,hw=286,uw=30,lw=15,cw=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),fw=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),dw=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),pw=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mw=new Array(576);sw(mw);const gw=new Array(60);sw(gw);const yw=new Array(512);sw(yw);const vw=new Array(256);sw(vw);const ww=new Array(29);sw(ww);const bw=new Array(uw);function _w(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}let Ew,Aw,kw;function Mw(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}sw(bw);const xw=t=>t<256?yw[t]:yw[256+(t>>>7)],Sw=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Nw=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,Sw(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Iw=(t,e,r)=>{Nw(t,r[2*e],r[2*e+1])},Cw=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},Tw=(t,e,r)=>{const n=new Array(16);let i,o,s=0;for(i=1;i<=lw;i++)s=s+r[i-1]<<1,n[i]=s;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=Cw(n[e]++,e))}},Pw=t=>{let e;for(e=0;e<hw;e++)t.dyn_ltree[2*e]=0;for(e=0;e<uw;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Rw=t=>{t.bi_valid>8?Sw(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Ow=(t,e,r,n)=>{const i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]},$w=(t,e,r)=>{const n=t.heap[r];let i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&Ow(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Ow(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},Bw=(t,e,r)=>{let n,i,o,s,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,i=t.pending_buf[t.sym_buf+a++],0===n?Iw(t,i,e):(o=vw[i],Iw(t,o+aw+1,e),s=cw[o],0!==s&&(i-=ww[o],Nw(t,i,s)),n--,o=xw(n),Iw(t,o,r),s=fw[o],0!==s&&(n-=bw[o],Nw(t,n,s)))}while(a<t.sym_next);Iw(t,256,e)},Dw=(t,e)=>{const r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let s,a,h,u=-1;for(t.heap_len=0,t.heap_max=573,s=0;s<o;s++)0!==r[2*s]?(t.heap[++t.heap_len]=u=s,t.depth[s]=0):r[2*s+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=u<2?++u:0,r[2*h]=1,t.depth[h]=0,t.opt_len--,i&&(t.static_len-=n[2*h+1]);for(e.max_code=u,s=t.heap_len>>1;s>=1;s--)$w(t,r,s);h=o;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],$w(t,r,1),a=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=a,r[2*h]=r[2*s]+r[2*a],t.depth[h]=(t.depth[s]>=t.depth[a]?t.depth[s]:t.depth[a])+1,r[2*s+1]=r[2*a+1]=h,t.heap[1]=h++,$w(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,h=e.stat_desc.max_length;let u,l,c,f,d,p,m=0;for(f=0;f<=lw;f++)t.bl_count[f]=0;for(r[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)l=t.heap[u],f=r[2*r[2*l+1]+1]+1,f>h&&(f=h,m++),r[2*l+1]=f,l>n||(t.bl_count[f]++,d=0,l>=a&&(d=s[l-a]),p=r[2*l],t.opt_len+=p*(f+d),o&&(t.static_len+=p*(i[2*l+1]+d)));if(0!==m){do{for(f=h-1;0===t.bl_count[f];)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[h]--,m-=2}while(m>0);for(f=h;0!==f;f--)for(l=t.bl_count[f];0!==l;)c=t.heap[--u],c>n||(r[2*c+1]!==f&&(t.opt_len+=(f-r[2*c+1])*r[2*c],r[2*c+1]=f),l--)}})(t,e),Tw(r,u,t.bl_count)},Fw=(t,e,r)=>{let n,i,o=-1,s=e[1],a=0,h=7,u=4;for(0===s&&(h=138,u=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=e[2*(n+1)+1],++a<h&&i===s||(a<u?t.bl_tree[2*i]+=a:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,a=0,o=i,0===s?(h=138,u=3):i===s?(h=6,u=3):(h=7,u=4))},Uw=(t,e,r)=>{let n,i,o=-1,s=e[1],a=0,h=7,u=4;for(0===s&&(h=138,u=3),n=0;n<=r;n++)if(i=s,s=e[2*(n+1)+1],!(++a<h&&i===s)){if(a<u)do{Iw(t,i,t.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(Iw(t,i,t.bl_tree),a--),Iw(t,16,t.bl_tree),Nw(t,a-3,2)):a<=10?(Iw(t,17,t.bl_tree),Nw(t,a-3,3)):(Iw(t,18,t.bl_tree),Nw(t,a-11,7));a=0,o=i,0===s?(h=138,u=3):i===s?(h=6,u=3):(h=7,u=4)}};let jw=!1;const Lw=(t,e,r,n)=>{Nw(t,0+(n?1:0),3),Rw(t),Sw(t,r),Sw(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r};var zw=t=>{jw||((()=>{let t,e,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(ww[n]=r,t=0;t<1<<cw[n];t++)vw[r++]=n;for(vw[r-1]=n,i=0,n=0;n<16;n++)for(bw[n]=i,t=0;t<1<<fw[n];t++)yw[i++]=n;for(i>>=7;n<uw;n++)for(bw[n]=i<<7,t=0;t<1<<fw[n]-7;t++)yw[256+i++]=n;for(e=0;e<=lw;e++)o[e]=0;for(t=0;t<=143;)mw[2*t+1]=8,t++,o[8]++;for(;t<=255;)mw[2*t+1]=9,t++,o[9]++;for(;t<=279;)mw[2*t+1]=7,t++,o[7]++;for(;t<=287;)mw[2*t+1]=8,t++,o[8]++;for(Tw(mw,287,o),t=0;t<uw;t++)gw[2*t+1]=5,gw[2*t]=Cw(t,5);Ew=new _w(mw,cw,257,hw,lw),Aw=new _w(gw,fw,0,uw,lw),kw=new _w(new Array(0),dw,0,19,7)})(),jw=!0),t.l_desc=new Mw(t.dyn_ltree,Ew),t.d_desc=new Mw(t.dyn_dtree,Aw),t.bl_desc=new Mw(t.bl_tree,kw),t.bi_buf=0,t.bi_valid=0,Pw(t)},qw=(t,e,r,n)=>{let i,o,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<aw;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Dw(t,t.l_desc),Dw(t,t.d_desc),s=(t=>{let e;for(Fw(t,t.dyn_ltree,t.l_desc.max_code),Fw(t,t.dyn_dtree,t.d_desc.max_code),Dw(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*pw[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?Lw(t,e,r,n):4===t.strategy||o===i?(Nw(t,2+(n?1:0),3),Bw(t,mw,gw)):(Nw(t,4+(n?1:0),3),((t,e,r,n)=>{let i;for(Nw(t,e-257,5),Nw(t,r-1,5),Nw(t,n-4,4),i=0;i<n;i++)Nw(t,t.bl_tree[2*pw[i]+1],3);Uw(t,t.dyn_ltree,e-1),Uw(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Bw(t,t.dyn_ltree,t.dyn_dtree)),Pw(t),n&&Rw(t)},Vw=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(vw[r]+aw+1)]++,t.dyn_dtree[2*xw(e)]++),t.sym_next===t.sym_end),Hw=t=>{Nw(t,2,3),Iw(t,256,mw),(t=>{16===t.bi_valid?(Sw(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)},Gw={_tr_init:zw,_tr_stored_block:Lw,_tr_flush_block:qw,_tr_tally:Vw,_tr_align:Hw};var Kw=(t,e,r,n)=>{let i=65535&t|0,o=t>>>16&65535|0,s=0;for(;0!==r;){s=r>2e3?2e3:r,r-=s;do{i=i+e[n++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const Zw=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})());var Jw=(t,e,r,n)=>{const i=Zw,o=n+r;t^=-1;for(let r=n;r<o;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},Qw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Yw={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ww,_tr_stored_block:Xw,_tr_flush_block:tb,_tr_tally:eb,_tr_align:rb}=Gw,{Z_NO_FLUSH:nb,Z_PARTIAL_FLUSH:ib,Z_FULL_FLUSH:ob,Z_FINISH:sb,Z_BLOCK:ab,Z_OK:hb,Z_STREAM_END:ub,Z_STREAM_ERROR:lb,Z_DATA_ERROR:cb,Z_BUF_ERROR:fb,Z_DEFAULT_COMPRESSION:db,Z_FILTERED:pb,Z_HUFFMAN_ONLY:mb,Z_RLE:gb,Z_FIXED:yb,Z_DEFAULT_STRATEGY:vb,Z_UNKNOWN:wb,Z_DEFLATED:bb}=Yw,_b=258,Eb=262,Ab=42,kb=113,Mb=666,xb=(t,e)=>(t.msg=Qw[e],e),Sb=t=>2*t-(t>4?9:0),Nb=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Ib=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do{r=t.head[--n],t.head[n]=r>=i?r-i:0}while(--e);e=i,n=e;do{r=t.prev[--n],t.prev[n]=r>=i?r-i:0}while(--e)};let Cb=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const Tb=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},Pb=(t,e)=>{tb(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Tb(t.strm)},Rb=(t,e)=>{t.pending_buf[t.pending++]=e},Ob=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},$b=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),1===t.state.wrap?t.adler=Kw(t.adler,e,i,r):2===t.state.wrap&&(t.adler=Jw(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},Bb=(t,e)=>{let r,n,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match;const h=t.strstart>t.w_size-Eb?t.strstart-(t.w_size-Eb):0,u=t.window,l=t.w_mask,c=t.prev,f=t.strstart+_b;let d=u[o+s-1],p=u[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(r=e,u[r+s]===p&&u[r+s-1]===d&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<f);if(n=_b-(f-o),o=f-_b,n>s){if(t.match_start=e,s=n,n>=a)break;d=u[o+s-1],p=u[o+s]}}}while((e=c[e&l])>h&&0!=--i);return s<=t.lookahead?s:t.lookahead},Db=t=>{const e=t.w_size;let r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Eb)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Ib(t),n+=e),0===t.strm.avail_in)break;if(r=$b(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Cb(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Cb(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Eb&&0!==t.strm.avail_in)},Fb=(t,e)=>{let r,n,i,o=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,s=0,a=t.strm.avail_in;do{if(r=65535,i=t.bi_valid+42>>3,t.strm.avail_out<i)break;if(i=t.strm.avail_out-i,n=t.strstart-t.block_start,r>n+t.strm.avail_in&&(r=n+t.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&e!==sb||e===nb||r!==n+t.strm.avail_in))break;s=e===sb&&r===n+t.strm.avail_in?1:0,Xw(t,0,0,s),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,Tb(t.strm),n&&(n>r&&(n=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,r-=n),r&&($b(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===s);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),s?4:e!==nb&&e!==sb&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(i=t.window_size-t.strstart,t.strm.avail_in>i&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&($b(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water<t.strstart&&(t.high_water=t.strstart),i=t.bi_valid+42>>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,o=i>t.w_size?t.w_size:i,n=t.strstart-t.block_start,(n>=o||(n||e===sb)&&e!==nb&&0===t.strm.avail_in&&n<=i)&&(r=n>i?i:n,s=e===sb&&0===t.strm.avail_in&&r===n?1:0,Xw(t,t.block_start,r,s),t.block_start+=r,Tb(t.strm)),s?3:1)},Ub=(t,e)=>{let r,n;for(;;){if(t.lookahead<Eb){if(Db(t),t.lookahead<Eb&&e===nb)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-Eb&&(t.match_length=Bb(t,r)),t.match_length>=3)if(n=eb(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+1]);else n=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Pb(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2},jb=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<Eb){if(Db(t),t.lookahead<Eb&&e===nb)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Eb&&(t.match_length=Bb(t,r),t.match_length<=5&&(t.strategy===pb||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=eb(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Pb(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=eb(t,0,t.window[t.strstart-1]),n&&Pb(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=eb(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2};function Lb(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}const zb=[new Lb(0,0,0,0,Fb),new Lb(4,4,8,4,Ub),new Lb(4,5,16,8,Ub),new Lb(4,6,32,32,Ub),new Lb(4,4,16,16,jb),new Lb(8,16,32,32,jb),new Lb(8,16,128,128,jb),new Lb(8,32,128,256,jb),new Lb(32,128,258,1024,jb),new Lb(32,258,258,4096,jb)];function qb(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=bb,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Nb(this.dyn_ltree),Nb(this.dyn_dtree),Nb(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Nb(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Nb(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Vb=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ab&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==kb&&e.status!==Mb?1:0},Hb=t=>{if(Vb(t))return xb(t,lb);t.total_in=t.total_out=0,t.data_type=wb;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ab:kb,t.adler=2===e.wrap?0:1,e.last_flush=-2,Ww(e),hb},Gb=t=>{const e=Hb(t);return e===hb&&(t=>{t.window_size=2*t.w_size,Nb(t.head),t.max_lazy_match=zb[t.level].max_lazy,t.good_match=zb[t.level].good_length,t.nice_match=zb[t.level].nice_length,t.max_chain_length=zb[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0})(t.state),e},Kb=(t,e,r,n,i,o)=>{if(!t)return lb;let s=1;if(e===db&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||r!==bb||n<8||n>15||e<0||e>9||o<0||o>yb||8===n&&1!==s)return xb(t,lb);8===n&&(n=9);const a=new qb;return t.state=a,a.strm=t,a.status=Ab,a.wrap=s,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=e,a.strategy=o,a.method=r,Gb(t)};var Zb=(t,e)=>{if(Vb(t)||e>ab||e<0)return t?xb(t,lb):lb;const r=t.state;if(!t.output||0!==t.avail_in&&!t.input||r.status===Mb&&e!==sb)return xb(t,0===t.avail_out?fb:lb);const n=r.last_flush;if(r.last_flush=e,0!==r.pending){if(Tb(t),0===t.avail_out)return r.last_flush=-1,hb}else if(0===t.avail_in&&Sb(e)<=Sb(n)&&e!==sb)return xb(t,fb);if(r.status===Mb&&0!==t.avail_in)return xb(t,fb);if(r.status===Ab&&0===r.wrap&&(r.status=kb),r.status===Ab){let e=bb+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=mb||r.level<2?0:r.level<6?1:6===r.level?2:3,e|=n<<6,0!==r.strstart&&(e|=32),e+=31-e%31,Ob(r,e),0!==r.strstart&&(Ob(r,t.adler>>>16),Ob(r,65535&t.adler)),t.adler=1,r.status=kb,Tb(t),0!==r.pending)return r.last_flush=-1,hb}if(57===r.status)if(t.adler=0,Rb(r,31),Rb(r,139),Rb(r,8),r.gzhead)Rb(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Rb(r,255&r.gzhead.time),Rb(r,r.gzhead.time>>8&255),Rb(r,r.gzhead.time>>16&255),Rb(r,r.gzhead.time>>24&255),Rb(r,9===r.level?2:r.strategy>=mb||r.level<2?4:0),Rb(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Rb(r,255&r.gzhead.extra.length),Rb(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Jw(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Rb(r,0),Rb(r,0),Rb(r,0),Rb(r,0),Rb(r,0),Rb(r,9===r.level?2:r.strategy>=mb||r.level<2?4:0),Rb(r,3),r.status=kb,Tb(t),0!==r.pending)return r.last_flush=-1,hb;if(69===r.status){if(r.gzhead.extra){let e=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>e&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex+=i,Tb(t),0!==r.pending)return r.last_flush=-1,hb;e=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>e&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n)),Tb(t),0!==r.pending)return r.last_flush=-1,hb;n=0}e=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Rb(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n)),Tb(t),0!==r.pending)return r.last_flush=-1,hb;n=0}e=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Rb(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Tb(t),0!==r.pending))return r.last_flush=-1,hb;Rb(r,255&t.adler),Rb(r,t.adler>>8&255),t.adler=0}if(r.status=kb,Tb(t),0!==r.pending)return r.last_flush=-1,hb}if(0!==t.avail_in||0!==r.lookahead||e!==nb&&r.status!==Mb){let n=0===r.level?Fb(r,e):r.strategy===mb?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(Db(t),0===t.lookahead)){if(e===nb)return 1;break}if(t.match_length=0,r=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Pb(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2})(r,e):r.strategy===gb?((t,e)=>{let r,n,i,o;const s=t.window;for(;;){if(t.lookahead<=_b){if(Db(t),t.lookahead<=_b&&e===nb)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){o=t.strstart+_b;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<o);t.match_length=_b-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=eb(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Pb(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2})(r,e):zb[r.level].func(r,e);if(3!==n&&4!==n||(r.status=Mb),1===n||3===n)return 0===t.avail_out&&(r.last_flush=-1),hb;if(2===n&&(e===ib?rb(r):e!==ab&&(Xw(r,0,0,!1),e===ob&&(Nb(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Tb(t),0===t.avail_out))return r.last_flush=-1,hb}return e!==sb?hb:r.wrap<=0?ub:(2===r.wrap?(Rb(r,255&t.adler),Rb(r,t.adler>>8&255),Rb(r,t.adler>>16&255),Rb(r,t.adler>>24&255),Rb(r,255&t.total_in),Rb(r,t.total_in>>8&255),Rb(r,t.total_in>>16&255),Rb(r,t.total_in>>24&255)):(Ob(r,t.adler>>>16),Ob(r,65535&t.adler)),Tb(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?hb:ub)},Jb=(t,e)=>{let r=e.length;if(Vb(t))return lb;const n=t.state,i=n.wrap;if(2===i||1===i&&n.status!==Ab||n.lookahead)return lb;if(1===i&&(t.adler=Kw(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){0===i&&(Nb(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(r-n.w_size,r),0),e=t,r=n.w_size}const o=t.avail_in,s=t.next_in,a=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Db(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=Cb(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Db(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=s,t.input=a,t.avail_in=o,n.wrap=i,hb},Qb={deflateInit:(t,e)=>Kb(t,e,bb,15,8,vb),deflateInit2:Kb,deflateReset:Gb,deflateResetKeep:Hb,deflateSetHeader:(t,e)=>Vb(t)||2!==t.state.wrap?lb:(t.state.gzhead=e,hb),deflate:Zb,deflateEnd:t=>{if(Vb(t))return lb;const e=t.state.status;return t.state=null,e===kb?xb(t,cb):hb},deflateSetDictionary:Jb,deflateInfo:"pako deflate (from Nodeca project)"};const Yb=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Wb=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const e in r)Yb(r,e)&&(t[e]=r[e])}}return t},Xb=t=>{let e=0;for(let r=0,n=t.length;r<n;r++)e+=t[r].length;const r=new Uint8Array(e);for(let e=0,n=0,i=t.length;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r};let t_=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){t_=!1}const e_=new Uint8Array(256);for(let t=0;t<256;t++)e_[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;e_[254]=e_[254]=1;var r_=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,n,i,o,s=t.length,a=0;for(i=0;i<s;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),a+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(a),o=0,i=0;o<a;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[o++]=r:r<2048?(e[o++]=192|r>>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},n_=(t,e)=>{const r=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let e=t[n++];if(e<128){o[i++]=e;continue}let s=e_[e];if(s>4)o[i++]=65533,n+=s-1;else{for(e&=2===s?31:3===s?15:7;s>1&&n<r;)e=e<<6|63&t[n++],s--;s>1?o[i++]=65533:e<65536?o[i++]=e:(e-=65536,o[i++]=55296|e>>10&1023,o[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&t_)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r})(o,i)},i_=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+e_[t[r]]>e?r:e};var o_=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const s_=Object.prototype.toString,{Z_NO_FLUSH:a_,Z_SYNC_FLUSH:h_,Z_FULL_FLUSH:u_,Z_FINISH:l_,Z_OK:c_,Z_STREAM_END:f_,Z_DEFAULT_COMPRESSION:d_,Z_DEFAULT_STRATEGY:p_,Z_DEFLATED:m_}=Yw;function g_(t){this.options=Wb({level:d_,method:m_,chunkSize:16384,windowBits:15,memLevel:8,strategy:p_},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o_,this.strm.avail_out=0;let r=Qb.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==c_)throw new Error(Qw[r]);if(e.header&&Qb.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?r_(e.dictionary):"[object ArrayBuffer]"===s_.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=Qb.deflateSetDictionary(this.strm,t),r!==c_)throw new Error(Qw[r]);this._dict_set=!0}}function y_(t,e){const r=new g_(e);if(r.push(t,!0),r.err)throw r.msg||Qw[r.err];return r.result}g_.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?l_:a_,"string"==typeof t?r.input=r_(t):"[object ArrayBuffer]"===s_.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===h_||o===u_)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=Qb.deflate(r,o),i===f_)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Qb.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c_;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},g_.prototype.onData=function(t){this.chunks.push(t)},g_.prototype.onEnd=function(t){t===c_&&(this.result=Xb(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var v_={Deflate:g_,deflate:y_,deflateRaw:function(t,e){return(e=e||{}).raw=!0,y_(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,y_(t,e)},constants:Yw};const w_=16209;var b_=function(t,e){let r,n,i,o,s,a,h,u,l,c,f,d,p,m,g,y,v,w,b,_,E,A,k,M;const x=t.state;r=t.next_in,k=t.input,n=r+(t.avail_in-5),i=t.next_out,M=t.output,o=i-(e-t.avail_out),s=i+(t.avail_out-257),a=x.dmax,h=x.wsize,u=x.whave,l=x.wnext,c=x.window,f=x.hold,d=x.bits,p=x.lencode,m=x.distcode,g=(1<<x.lenbits)-1,y=(1<<x.distbits)-1;t:do{d<15&&(f+=k[r++]<<d,d+=8,f+=k[r++]<<d,d+=8),v=p[f&g];e:for(;;){if(w=v>>>24,f>>>=w,d-=w,w=v>>>16&255,0===w)M[i++]=65535&v;else{if(!(16&w)){if(0==(64&w)){v=p[(65535&v)+(f&(1<<w)-1)];continue e}if(32&w){x.mode=16191;break t}t.msg="invalid literal/length code",x.mode=w_;break t}b=65535&v,w&=15,w&&(d<w&&(f+=k[r++]<<d,d+=8),b+=f&(1<<w)-1,f>>>=w,d-=w),d<15&&(f+=k[r++]<<d,d+=8,f+=k[r++]<<d,d+=8),v=m[f&y];r:for(;;){if(w=v>>>24,f>>>=w,d-=w,w=v>>>16&255,!(16&w)){if(0==(64&w)){v=m[(65535&v)+(f&(1<<w)-1)];continue r}t.msg="invalid distance code",x.mode=w_;break t}if(_=65535&v,w&=15,d<w&&(f+=k[r++]<<d,d+=8,d<w&&(f+=k[r++]<<d,d+=8)),_+=f&(1<<w)-1,_>a){t.msg="invalid distance too far back",x.mode=w_;break t}if(f>>>=w,d-=w,w=i-o,_>w){if(w=_-w,w>u&&x.sane){t.msg="invalid distance too far back",x.mode=w_;break t}if(E=0,A=c,0===l){if(E+=h-w,w<b){b-=w;do{M[i++]=c[E++]}while(--w);E=i-_,A=M}}else if(l<w){if(E+=h+l-w,w-=l,w<b){b-=w;do{M[i++]=c[E++]}while(--w);if(E=0,l<b){w=l,b-=w;do{M[i++]=c[E++]}while(--w);E=i-_,A=M}}}else if(E+=l-w,w<b){b-=w;do{M[i++]=c[E++]}while(--w);E=i-_,A=M}for(;b>2;)M[i++]=A[E++],M[i++]=A[E++],M[i++]=A[E++],b-=3;b&&(M[i++]=A[E++],b>1&&(M[i++]=A[E++]))}else{E=i-_;do{M[i++]=M[E++],M[i++]=M[E++],M[i++]=M[E++],b-=3}while(b>2);b&&(M[i++]=M[E++],b>1&&(M[i++]=M[E++]))}break}}break}}while(r<n&&i<s);b=d>>3,r-=b,d-=b<<3,f&=(1<<d)-1,t.next_in=r,t.next_out=i,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=i<s?s-i+257:257-(i-s),x.hold=f,x.bits=d};const __=15,E_=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),A_=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),k_=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),M_=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var x_=(t,e,r,n,i,o,s,a)=>{const h=a.bits;let u,l,c,f,d,p,m=0,g=0,y=0,v=0,w=0,b=0,_=0,E=0,A=0,k=0,M=null;const x=new Uint16Array(16),S=new Uint16Array(16);let N,I,C,T=null;for(m=0;m<=__;m++)x[m]=0;for(g=0;g<n;g++)x[e[r+g]]++;for(w=h,v=__;v>=1&&0===x[v];v--);if(w>v&&(w=v),0===v)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(y=1;y<v&&0===x[y];y++);for(w<y&&(w=y),E=1,m=1;m<=__;m++)if(E<<=1,E-=x[m],E<0)return-1;if(E>0&&(0===t||1!==v))return-1;for(S[1]=0,m=1;m<__;m++)S[m+1]=S[m]+x[m];for(g=0;g<n;g++)0!==e[r+g]&&(s[S[e[r+g]]++]=g);if(0===t?(M=T=s,p=20):1===t?(M=E_,T=A_,p=257):(M=k_,T=M_,p=0),k=0,g=0,m=y,d=o,b=w,_=0,c=-1,A=1<<w,f=A-1,1===t&&A>852||2===t&&A>592)return 1;for(;;){N=m-_,s[g]+1<p?(I=0,C=s[g]):s[g]>=p?(I=T[s[g]-p],C=M[s[g]-p]):(I=96,C=0),u=1<<m-_,l=1<<b,y=l;do{l-=u,i[d+(k>>_)+l]=N<<24|I<<16|C|0}while(0!==l);for(u=1<<m-1;k&u;)u>>=1;if(0!==u?(k&=u-1,k+=u):k=0,g++,0==--x[m]){if(m===v)break;m=e[r+s[g]]}if(m>w&&(k&f)!==c){for(0===_&&(_=w),d+=y,b=m-_,E=1<<b;b+_<v&&(E-=x[b+_],!(E<=0));)b++,E<<=1;if(A+=1<<b,1===t&&A>852||2===t&&A>592)return 1;c=k&f,i[c]=w<<24|b<<16|d-o|0}}return 0!==k&&(i[d+k]=m-_<<24|64<<16|0),a.bits=w,0};const{Z_FINISH:S_,Z_BLOCK:N_,Z_TREES:I_,Z_OK:C_,Z_STREAM_END:T_,Z_NEED_DICT:P_,Z_STREAM_ERROR:R_,Z_DATA_ERROR:O_,Z_MEM_ERROR:$_,Z_BUF_ERROR:B_,Z_DEFLATED:D_}=Yw,F_=16180,U_=16190,j_=16191,L_=16192,z_=16194,q_=16199,V_=16200,H_=16206,G_=16209,K_=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Z_(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const J_=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<F_||e.mode>16211?1:0},Q_=t=>{if(J_(t))return R_;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=F_,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,C_},Y_=t=>{if(J_(t))return R_;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Q_(t)},W_=(t,e)=>{let r;if(J_(t))return R_;const n=t.state;return e<0?(r=0,e=-e):(r=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?R_:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,Y_(t))},X_=(t,e)=>{if(!t)return R_;const r=new Z_;t.state=r,r.strm=t,r.window=null,r.mode=F_;const n=W_(t,e);return n!==C_&&(t.state=null),n};let tE,eE,rE=!0;const nE=t=>{if(rE){tE=new Int32Array(512),eE=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(x_(1,t.lens,0,288,tE,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;x_(2,t.lens,0,32,eE,0,t.work,{bits:5}),rE=!1}t.lencode=tE,t.lenbits=9,t.distcode=eE,t.distbits=5},iE=(t,e,r,n)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(e.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(e.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(e.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var oE=(t,e)=>{let r,n,i,o,s,a,h,u,l,c,f,d,p,m,g,y,v,w,b,_,E,A,k=0;const M=new Uint8Array(4);let x,S;const N=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(J_(t)||!t.output||!t.input&&0!==t.avail_in)return R_;r=t.state,r.mode===j_&&(r.mode=L_),s=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,u=r.hold,l=r.bits,c=a,f=h,A=C_;t:for(;;)switch(r.mode){case F_:if(0===r.wrap){r.mode=L_;break}for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=G_;break}if((15&u)!==D_){t.msg="unknown compression method",r.mode=G_;break}if(u>>>=4,l-=4,E=8+(15&u),0===r.wbits&&(r.wbits=E),E>15||E>r.wbits){t.msg="invalid window size",r.mode=G_;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=512&u?16189:j_,u=0,l=0;break;case 16181:for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==D_){t.msg="unknown compression method",r.mode=G_;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=G_;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,M[2]=u>>>16&255,M[3]=u>>>24&255,r.check=Jw(r.check,M,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(d=r.length,d>a&&(d=a),d&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+d),E)),512&r.flags&&4&r.wrap&&(r.check=Jw(r.check,n,d,o)),a-=d,o+=d,r.length-=d),r.length))break t;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===a)break t;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&d<a);if(512&r.flags&&4&r.wrap&&(r.check=Jw(r.check,n,d,o)),a-=d,o+=d,E)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===a)break t;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&d<a);if(512&r.flags&&4&r.wrap&&(r.check=Jw(r.check,n,d,o)),a-=d,o+=d,E)break t}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){t.msg="header crc mismatch",r.mode=G_;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=j_;break;case 16189:for(;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}t.adler=r.check=K_(u),u=0,l=0,r.mode=U_;case U_:if(0===r.havedict)return t.next_out=s,t.avail_out=h,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=l,P_;t.adler=r.check=1,r.mode=j_;case j_:if(e===N_||e===I_)break t;case L_:if(r.last){u>>>=7&l,l-=7&l,r.mode=H_;break}for(;l<3;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(nE(r),r.mode=q_,e===I_){u>>>=2,l-=2;break t}break;case 2:r.mode=16196;break;case 3:t.msg="invalid block type",r.mode=G_}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=G_;break}if(r.length=65535&u,u=0,l=0,r.mode=z_,e===I_)break t;case z_:r.mode=16195;case 16195:if(d=r.length,d){if(d>a&&(d=a),d>h&&(d=h),0===d)break t;i.set(n.subarray(o,o+d),s),a-=d,o+=d,h-=d,s+=d,r.length-=d;break}r.mode=j_;break;case 16196:for(;l<14;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=G_;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.lens[N[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[N[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,x={bits:r.lenbits},A=x_(0,r.lens,0,19,r.lencode,0,r.work,x),r.lenbits=x.bits,A){t.msg="invalid code lengths set",r.mode=G_;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;k=r.lencode[u&(1<<r.lenbits)-1],g=k>>>24,y=k>>>16&255,v=65535&k,!(g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(v<16)u>>>=g,l-=g,r.lens[r.have++]=v;else{if(16===v){for(S=g+2;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(u>>>=g,l-=g,0===r.have){t.msg="invalid bit length repeat",r.mode=G_;break}E=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===v){for(S=g+3;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=g,l-=g,E=0,d=3+(7&u),u>>>=3,l-=3}else{for(S=g+7;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=g,l-=g,E=0,d=11+(127&u),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=G_;break}for(;d--;)r.lens[r.have++]=E}}if(r.mode===G_)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=G_;break}if(r.lenbits=9,x={bits:r.lenbits},A=x_(1,r.lens,0,r.nlen,r.lencode,0,r.work,x),r.lenbits=x.bits,A){t.msg="invalid literal/lengths set",r.mode=G_;break}if(r.distbits=6,r.distcode=r.distdyn,x={bits:r.distbits},A=x_(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,x),r.distbits=x.bits,A){t.msg="invalid distances set",r.mode=G_;break}if(r.mode=q_,e===I_)break t;case q_:r.mode=V_;case V_:if(a>=6&&h>=258){t.next_out=s,t.avail_out=h,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=l,b_(t,f),s=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,u=r.hold,l=r.bits,r.mode===j_&&(r.back=-1);break}for(r.back=0;k=r.lencode[u&(1<<r.lenbits)-1],g=k>>>24,y=k>>>16&255,v=65535&k,!(g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(y&&0==(240&y)){for(w=g,b=y,_=v;k=r.lencode[_+((u&(1<<w+b)-1)>>w)],g=k>>>24,y=k>>>16&255,v=65535&k,!(w+g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=w,l-=w,r.back+=w}if(u>>>=g,l-=g,r.back+=g,r.length=v,0===y){r.mode=16205;break}if(32&y){r.back=-1,r.mode=j_;break}if(64&y){t.msg="invalid literal/length code",r.mode=G_;break}r.extra=15&y,r.mode=16201;case 16201:if(r.extra){for(S=r.extra;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;k=r.distcode[u&(1<<r.distbits)-1],g=k>>>24,y=k>>>16&255,v=65535&k,!(g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(0==(240&y)){for(w=g,b=y,_=v;k=r.distcode[_+((u&(1<<w+b)-1)>>w)],g=k>>>24,y=k>>>16&255,v=65535&k,!(w+g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=w,l-=w,r.back+=w}if(u>>>=g,l-=g,r.back+=g,64&y){t.msg="invalid distance code",r.mode=G_;break}r.offset=v,r.extra=15&y,r.mode=16203;case 16203:if(r.extra){for(S=r.extra;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=G_;break}r.mode=16204;case 16204:if(0===h)break t;if(d=f-h,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=G_;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=s-r.offset,d=r.length;d>h&&(d=h),h-=d,r.length-=d;do{i[s++]=m[p++]}while(--d);0===r.length&&(r.mode=V_);break;case 16205:if(0===h)break t;i[s++]=r.length,h--,r.mode=V_;break;case H_:if(r.wrap){for(;l<32;){if(0===a)break t;a--,u|=n[o++]<<l,l+=8}if(f-=h,t.total_out+=f,r.total+=f,4&r.wrap&&f&&(t.adler=r.check=r.flags?Jw(r.check,i,f,s-f):Kw(r.check,i,f,s-f)),f=h,4&r.wrap&&(r.flags?u:K_(u))!==r.check){t.msg="incorrect data check",r.mode=G_;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=G_;break}u=0,l=0}r.mode=16208;case 16208:A=T_;break t;case G_:A=O_;break t;case 16210:return $_;default:return R_}return t.next_out=s,t.avail_out=h,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=l,(r.wsize||f!==t.avail_out&&r.mode<G_&&(r.mode<H_||e!==S_))&&iE(t,t.output,t.next_out,f-t.avail_out),c-=t.avail_in,f-=t.avail_out,t.total_in+=c,t.total_out+=f,r.total+=f,4&r.wrap&&f&&(t.adler=r.check=r.flags?Jw(r.check,i,f,t.next_out-f):Kw(r.check,i,f,t.next_out-f)),t.data_type=r.bits+(r.last?64:0)+(r.mode===j_?128:0)+(r.mode===q_||r.mode===z_?256:0),(0===c&&0===f||e===S_)&&A===C_&&(A=B_),A},sE={inflateReset:Y_,inflateReset2:W_,inflateResetKeep:Q_,inflateInit:t=>X_(t,15),inflateInit2:X_,inflate:oE,inflateEnd:t=>{if(J_(t))return R_;let e=t.state;return e.window&&(e.window=null),t.state=null,C_},inflateGetHeader:(t,e)=>{if(J_(t))return R_;const r=t.state;return 0==(2&r.wrap)?R_:(r.head=e,e.done=!1,C_)},inflateSetDictionary:(t,e)=>{const r=e.length;let n,i,o;return J_(t)?R_:(n=t.state,0!==n.wrap&&n.mode!==U_?R_:n.mode===U_&&(i=1,i=Kw(i,e,r,0),i!==n.check)?O_:(o=iE(t,e,r,r),o?(n.mode=16210,$_):(n.havedict=1,C_)))},inflateInfo:"pako inflate (from Nodeca project)"};var aE=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const hE=Object.prototype.toString,{Z_NO_FLUSH:uE,Z_FINISH:lE,Z_OK:cE,Z_STREAM_END:fE,Z_NEED_DICT:dE,Z_STREAM_ERROR:pE,Z_DATA_ERROR:mE,Z_MEM_ERROR:gE}=Yw;function yE(t){this.options=Wb({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o_,this.strm.avail_out=0;let r=sE.inflateInit2(this.strm,e.windowBits);if(r!==cE)throw new Error(Qw[r]);if(this.header=new aE,sE.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=r_(e.dictionary):"[object ArrayBuffer]"===hE.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=sE.inflateSetDictionary(this.strm,e.dictionary),r!==cE)))throw new Error(Qw[r])}function vE(t,e){const r=new yE(e);if(r.push(t),r.err)throw r.msg||Qw[r.err];return r.result}yE.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=e===~~e?e:!0===e?lE:uE,"[object ArrayBuffer]"===hE.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=sE.inflate(r,s),o===dE&&i&&(o=sE.inflateSetDictionary(r,i),o===cE?o=sE.inflate(r,s):o===mE&&(o=dE));r.avail_in>0&&o===fE&&r.state.wrap>0&&0!==t[r.next_in];)sE.inflateReset(r),o=sE.inflate(r,s);switch(o){case pE:case mE:case dE:case gE:return this.onEnd(o),this.ended=!0,!1}if(a=r.avail_out,r.next_out&&(0===r.avail_out||o===fE))if("string"===this.options.to){let t=i_(r.output,r.next_out),e=r.next_out-t,i=n_(r.output,t);r.next_out=e,r.avail_out=n-e,e&&r.output.set(r.output.subarray(t,t+e),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==cE||0!==a){if(o===fE)return o=sE.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},yE.prototype.onData=function(t){this.chunks.push(t)},yE.prototype.onEnd=function(t){t===cE&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Xb(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var wE={Inflate:yE,inflate:vE,inflateRaw:function(t,e){return(e=e||{}).raw=!0,vE(t,e)},ungzip:vE,constants:Yw};const{Deflate:bE,deflate:_E,deflateRaw:EE,gzip:AE}=v_,{Inflate:kE,inflate:ME,inflateRaw:xE,ungzip:SE}=wE;var NE=AE,IE=SE,CE="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==B&&B||{},TE="URLSearchParams"in CE,PE="Symbol"in CE&&"iterator"in Symbol,RE="FileReader"in CE&&"Blob"in CE&&function(){try{return new Blob,!0}catch(t){return!1}}(),OE="FormData"in CE,$E="ArrayBuffer"in CE;if($E)var BE=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],DE=ArrayBuffer.isView||function(t){return t&&BE.indexOf(Object.prototype.toString.call(t))>-1};function FE(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function UE(t){return"string"!=typeof t&&(t=String(t)),t}function jE(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return PE&&(e[Symbol.iterator]=function(){return e}),e}function LE(t){this.map={},t instanceof LE?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function zE(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function qE(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function VE(t){var e=new FileReader,r=qE(e);return e.readAsArrayBuffer(t),r}function HE(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function GE(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:RE&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:OE&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:TE&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():$E&&RE&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=HE(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):$E&&(ArrayBuffer.prototype.isPrototypeOf(t)||DE(t))?this._bodyArrayBuffer=HE(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,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):TE&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},RE&&(this.blob=function(){var t=zE(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(){if(this._bodyArrayBuffer){var t=zE(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(RE)return this.blob().then(VE);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,n,i,o=zE(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=qE(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),i=n?n[1]:"utf-8",e.readAsText(t,i),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},OE&&(this.formData=function(){return this.text().then(JE)}),this.json=function(){return this.text().then(JSON.parse)},this}LE.prototype.append=function(t,e){t=FE(t),e=UE(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},LE.prototype.delete=function(t){delete this.map[FE(t)]},LE.prototype.get=function(t){return t=FE(t),this.has(t)?this.map[t]:null},LE.prototype.has=function(t){return this.map.hasOwnProperty(FE(t))},LE.prototype.set=function(t,e){this.map[FE(t)]=UE(e)},LE.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},LE.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),jE(t)},LE.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),jE(t)},LE.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),jE(t)},PE&&(LE.prototype[Symbol.iterator]=LE.prototype.entries);var KE=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function ZE(t,e){if(!(this instanceof ZE))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,i=(e=e||{}).body;if(t instanceof ZE){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new LE(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=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 LE(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),KE.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in CE)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function JE(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function QE(t,e){if(!(this instanceof QE))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new LE(e.headers),this.url=e.url||"",this._initBody(t)}ZE.prototype.clone=function(){return new ZE(this,{body:this._bodyInit})},GE.call(ZE.prototype),GE.call(QE.prototype),QE.prototype.clone=function(){return new QE(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new LE(this.headers),url:this.url})},QE.error=function(){var t=new QE(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var YE=[301,302,303,307,308];QE.redirect=function(t,e){if(-1===YE.indexOf(e))throw new RangeError("Invalid status code");return new QE(null,{status:e,headers:{location:t}})};var WE=CE.DOMException;try{new WE}catch(xb){WE=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},WE.prototype=Object.create(Error.prototype),WE.prototype.constructor=WE}function XE(t,e){return new Promise((function(r,n){var i=new ZE(t,e);if(i.signal&&i.signal.aborted)return n(new WE("Aborted","AbortError"));var o=new XMLHttpRequest;function s(){o.abort()}if(o.onload=function(){var t,e,n={statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new LE,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();try{e.append(n,i)}catch(t){console.warn("Response "+t.message)}}})),e)};0===i.url.indexOf("file://")&&(o.status<200||o.status>599)?n.status=200:n.status=o.status,n.url="responseURL"in o?o.responseURL:n.headers.get("X-Request-URL");var s="response"in o?o.response:o.responseText;setTimeout((function(){r(new QE(s,n))}),0)},o.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request timed out"))}),0)},o.onabort=function(){setTimeout((function(){n(new WE("Aborted","AbortError"))}),0)},o.open(i.method,function(t){try{return""===t&&CE.location.href?CE.location.href:t}catch(e){return t}}(i.url),!0),"include"===i.credentials?o.withCredentials=!0:"omit"===i.credentials&&(o.withCredentials=!1),"responseType"in o&&(RE?o.responseType="blob":$E&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof LE||CE.Headers&&e.headers instanceof CE.Headers)){var a=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){a.push(FE(t)),o.setRequestHeader(t,UE(e.headers[t]))})),i.headers.forEach((function(t,e){-1===a.indexOf(e)&&o.setRequestHeader(e,t)}))}else i.headers.forEach((function(t,e){o.setRequestHeader(e,t)}));i.signal&&(i.signal.addEventListener("abort",s),o.onreadystatechange=function(){4===o.readyState&&i.signal.removeEventListener("abort",s)}),o.send(void 0===i._bodyInit?null:i._bodyInit)}))}XE.polyfill=!0,CE.fetch||(CE.fetch=XE,CE.Headers=LE,CE.Request=ZE,CE.Response=QE);var tA=self.fetch.bind(self),eA=o((function(t){var e,n;e=r,n=function(){function t(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var r=t.shift();t[0]=r+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<t.length;n++){var i=t[n];if("string"!=typeof i)throw new TypeError("Url must be a string. Received "+i);""!==i&&(n>0&&(i=i.replace(/^[\/]+/,"")),i=n<t.length-1?i.replace(/[\/]+$/,""):i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/"),s=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return o=s.shift()+(s.length>0?"?":"")+s.join("&")}return function(){return t("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=n():e.urljoin=n()})),rA=Object.defineProperty,nA=(t,e)=>{for(var r in e)rA(t,r,{get:e[r],enumerable:!0})};nA({},{API_VERSION:()=>NA,BN_FEE_TRANSACTION_VERSION_1:()=>AA,BN_FEE_TRANSACTION_VERSION_2:()=>kA,BN_TRANSACTION_VERSION_1:()=>_A,BN_TRANSACTION_VERSION_2:()=>EA,BaseUrl:()=>IA,HEX_STR_TRANSACTION_VERSION_1:()=>wA,HEX_STR_TRANSACTION_VERSION_2:()=>bA,IS_BROWSER:()=>iA,MASK_250:()=>xA,MASK_251:()=>SA,NetworkName:()=>CA,RPC_GOERLI_NODES:()=>OA,RPC_MAINNET_NODES:()=>$A,StarknetChainId:()=>TA,TEXT_TO_FELT_MAX_LEN:()=>vA,TransactionHashPrefix:()=>PA,UDC:()=>RA,ZERO:()=>MA});nA({},{IS_BROWSER:()=>iA,addHexPrefix:()=>fA,arrayBufferToString:()=>oA,atobUniversal:()=>hA,btoaUniversal:()=>uA,buf2hex:()=>lA,calcByteLength:()=>pA,padLeft:()=>dA,pascalToSnake:()=>yA,removeHexPrefix:()=>cA,sanitizeBytes:()=>mA,sanitizeHex:()=>gA,stringToArrayBuffer:()=>aA,utf8ToArray:()=>sA});var iA="undefined"!=typeof window;function oA(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function sA(t){return(new TextEncoder).encode(t)}function aA(t){return sA(t)}function hA(t){return Em.decode(t)}function uA(t){return Em.encode(new Uint8Array(t))}function lA(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function cA(t){return t.replace(/^0x/i,"")}function fA(t){return`0x${cA(t)}`}function dA(t,e,r="0"){return function(t,e,r,n="0"){const i=e-t.length;let o=t;if(i>0){const e=n.repeat(i);o=r?e+t:t+e}return o}(t,e,!0,r)}function pA(t,e=8){const{length:r}=t,n=r%e;return n?(r-n)/e*e+e:r}function mA(t,e=8,r="0"){return dA(t,pA(t,e),r)}function gA(t){return(t=mA(t=cA(t),2))&&(t=fA(t)),t}var yA=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t,vA=31,wA="0x1",bA="0x2",_A=1n,EA=2n,AA=2n**128n+_A,kA=2n**128n+EA,MA=0n,xA=2n**250n-1n,SA=2n**251n,NA=MA,IA=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_GOERLI="https://alpha4.starknet.io",t))(IA||{}),CA=(t=>(t.SN_MAIN="SN_MAIN",t.SN_GOERLI="SN_GOERLI",t))(CA||{}),TA=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_GOERLI="0x534e5f474f45524c49",t))(TA||{}),PA=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(PA||{}),RA={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},OA=["https://starknet-testnet.public.blastapi.io/rpc/v0.5","https://limited-rpc.nethermind.io/goerli-juno/v0_5"],$A=["https://starknet-mainnet.public.blastapi.io/rpc/v0.5","https://limited-rpc.nethermind.io/mainnet-juno/v0_5"];nA({},{BlockStatus:()=>HA,BlockTag:()=>GA,EntryPointType:()=>jA,Litteral:()=>UA,RPC:()=>KA,SIMULATION_FLAG:()=>BA,Sequencer:()=>ik,TransactionExecutionStatus:()=>VA,TransactionFinalityStatus:()=>qA,TransactionStatus:()=>zA,TransactionType:()=>LA,Uint:()=>FA,ValidateType:()=>DA});var BA=(t=>(t.SKIP_VALIDATE="SKIP_VALIDATE",t.SKIP_EXECUTE="SKIP_EXECUTE",t))(BA||{}),DA=(t=>(t.DEPLOY="DEPLOY",t.CALL="CALL",t.INVOKE="INVOKE",t))(DA||{}),FA=(t=>(t.u8="core::integer::u8",t.u16="core::integer::u16",t.u32="core::integer::u32",t.u64="core::integer::u64",t.u128="core::integer::u128",t.u256="core::integer::u256",t))(FA||{}),UA=(t=>(t.ClassHash="core::starknet::class_hash::ClassHash",t.ContractAddress="core::starknet::contract_address::ContractAddress",t))(UA||{}),jA=(t=>(t.EXTERNAL="EXTERNAL",t.L1_HANDLER="L1_HANDLER",t.CONSTRUCTOR="CONSTRUCTOR",t))(jA||{}),LA=(t=>(t.DECLARE="DECLARE",t.DEPLOY="DEPLOY",t.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",t.INVOKE="INVOKE_FUNCTION",t))(LA||{}),zA=(t=>(t.NOT_RECEIVED="NOT_RECEIVED",t.RECEIVED="RECEIVED",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t.REJECTED="REJECTED",t.REVERTED="REVERTED",t))(zA||{}),qA=(t=>(t.NOT_RECEIVED="NOT_RECEIVED",t.RECEIVED="RECEIVED",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t))(qA||{}),VA=(t=>(t.REJECTED="REJECTED",t.REVERTED="REVERTED",t.SUCCEEDED="SUCCEEDED",t))(VA||{}),HA=(t=>(t.PENDING="PENDING",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.REJECTED="REJECTED",t))(HA||{}),GA=(t=>(t.pending="pending",t.latest="latest",t))(GA||{}),KA={};nA(KA,{EBlockTag:()=>rk,EDataAvailabilityMode:()=>nk,ESimulationFlag:()=>WA,ETransactionExecutionStatus:()=>ek,ETransactionFinalityStatus:()=>tk,ETransactionStatus:()=>XA,ETransactionType:()=>YA,Errors:()=>JA,JRPC:()=>ZA,SPEC:()=>QA});var ZA={},JA={},QA={},YA=(t=>(t.DECLARE="DECLARE",t.DEPLOY="DEPLOY",t.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",t.INVOKE="INVOKE",t.L1_HANDLER="L1_HANDLER",t))(YA||{}),WA=(t=>(t.SKIP_VALIDATE="SKIP_VALIDATE",t.SKIP_FEE_CHARGE="SKIP_FEE_CHARGE",t))(WA||{}),XA=(t=>(t.RECEIVED="RECEIVED",t.REJECTED="REJECTED",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t))(XA||{}),tk=(t=>(t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t))(tk||{}),ek=(t=>(t.SUCCEEDED="SUCCEEDED",t.REVERTED="REVERTED",t))(ek||{}),rk=(t=>(t.LATEST="latest",t.PENDING="pending",t))(rk||{}),nk=(t=>(t.L1="L1",t.L2="L2",t))(nk||{}),ik={};function ok(t,e){if(!t)throw new Error(e||"Assertion failure")}function sk(t){return/^0x[0-9a-f]*$/i.test(t)}function ak(t){return BigInt(t)}function hk(t){return"bigint"==typeof t}function uk(t){return fA(ak(t).toString(16))}nA({},{assertInRange:()=>pk,bigNumberishArrayToDecimalStringArray:()=>mk,bigNumberishArrayToHexadecimalStringArray:()=>gk,cleanHex:()=>dk,getDecimalString:()=>vk,getHexString:()=>wk,getHexStringArray:()=>bk,hexToBytes:()=>Ek,hexToDecimalString:()=>fk,isBigInt:()=>hk,isHex:()=>sk,isStringWholeNumber:()=>yk,toBigInt:()=>ak,toCairoBool:()=>_k,toHex:()=>uk,toHexString:()=>lk,toStorageKey:()=>ck});var lk=uk;function ck(t){return fA(ak(t).toString(16).padStart(64,"0"))}function fk(t){return BigInt(fA(t)).toString(10)}var dk=t=>t.toLowerCase().replace(/^(0x)0+/,"$1");function pk(t,e,r,n=""){const i=""===n?"invalid length":`invalid ${n} length`,o=BigInt(t),s=BigInt(e),a=BigInt(r);ok(o>=s&&o<=a,`Message not signable, ${i}.`)}function mk(t){return t.map((t=>ak(t).toString(10)))}function gk(t){return t.map((t=>uk(t)))}var yk=t=>/^\d+$/.test(t);function vk(t){if(sk(t))return fk(t);if(yk(t))return t;throw new Error(`${t} need to be hex-string or whole-number-string`)}function wk(t){if(sk(t))return t;if(yk(t))return lk(t);throw new Error(`${t} need to be hex-string or whole-number-string`)}function bk(t){return t.map((t=>wk(t)))}var _k=t=>(+t).toString();function Ek(t){if(!sk(t))throw new Error(`${t} need to be a hex-string`);let e=cA(t);return e.length%2!=0&&(e=`0${e}`),Tm(e)}function Ak(t){const e=cA(uk(BigInt(t))),r=e.length%2==0?e:`0${e}`;return fA(Gy(Ek(fA(r))).toString(16))}function kk(t){const e=BigInt(function(t){return fA(Gy(sA(t)).toString(16))}(t));return e&xA}function Mk(t){return uk(kk(t))}function xk(t){return sk(t)?t:yk(t)?lk(t):Mk(t)}nA({},{getSelector:()=>xk,getSelectorFromName:()=>Mk,keccakBn:()=>Ak,starknetKeccak:()=>kk});function Sk(t){return/^[\x00-\x7F]*$/.test(t)}function Nk(t){return t.length<=vA}function Ik(t){return/^[0-9]*$/i.test(t)}function Ck(t){return"string"==typeof t&&!sk(t)&&!yk(t)}nA({},{decodeShortString:()=>$k,encodeShortString:()=>Ok,isASCII:()=>Sk,isDecimalString:()=>Ik,isLongText:()=>Pk,isShortString:()=>Nk,isShortText:()=>Tk,isText:()=>Ck,splitLongString:()=>Rk});var Tk=t=>Ck(t)&&Nk(t),Pk=t=>Ck(t)&&!Nk(t);function Rk(t){const e=RegExp(`[^]{1,${vA}}`,"g");return t.match(e)||[]}function Ok(t){if(!Sk(t))throw new Error(`${t} is not an ASCII string`);if(!Nk(t))throw new Error(`${t} is too long`);return fA(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function $k(t){if(!Sk(t))throw new Error(`${t} is not an ASCII string`);if(sk(t))return cA(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(Ik(t))return $k("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}var Bk={};nA(Bk,{felt:()=>uM,getAbiContractVersion:()=>sM,getArrayType:()=>iM,isCairo1Abi:()=>oM,isCairo1Type:()=>nM,isLen:()=>zk,isTypeArray:()=>Vk,isTypeBool:()=>tM,isTypeContractAddress:()=>eM,isTypeEnum:()=>Zk,isTypeEthAddress:()=>rM,isTypeFelt:()=>qk,isTypeLitteral:()=>Wk,isTypeNamedTuple:()=>Gk,isTypeOption:()=>Jk,isTypeResult:()=>Qk,isTypeStruct:()=>Kk,isTypeTuple:()=>Hk,isTypeUint:()=>Yk,isTypeUint256:()=>Xk,tuple:()=>hM,uint256:()=>aM});nA({},{UINT_128_MAX:()=>Dk,UINT_256_MAX:()=>Fk,bnToUint256:()=>Lk,isUint256:()=>jk,uint256ToBN:()=>Uk});var Dk=(1n<<128n)-1n,Fk=(1n<<256n)-1n;function Uk(t){return(ak(t.high)<<128n)+ak(t.low)}function jk(t){return ak(t)<=Fk}function Lk(t){const e=ak(t);if(!jk(e))throw new Error("Number is too large");return{low:fA((e&Dk).toString(16)),high:fA((e>>128n).toString(16))}}var zk=t=>/_len$/.test(t),qk=t=>"felt"===t||"core::felt252"===t,Vk=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),Hk=t=>/^\(.*\)$/i.test(t),Gk=t=>/\(.*\)/i.test(t)&&t.includes(":"),Kk=(t,e)=>t in e,Zk=(t,e)=>t in e,Jk=t=>t.startsWith("core::option::Option::"),Qk=t=>t.startsWith("core::result::Result::"),Yk=t=>Object.values(FA).includes(t),Wk=t=>Object.values(UA).includes(t),Xk=t=>"core::integer::u256"===t,tM=t=>"core::bool"===t,eM=t=>"core::starknet::contract_address::ContractAddress"===t,rM=t=>"core::starknet::eth_address::EthAddress"===t,nM=t=>t.includes("::"),iM=t=>nM(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function oM(t){const{cairo:e}=sM(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function sM(t){if(t.find((t=>"interface"===t.type)))return{cairo:"1",compiler:"2"};const e=t.find((t=>"function"===t.type&&(t.inputs.length||t.outputs.length)));if(!e)return{cairo:void 0,compiler:void 0};const r=e.inputs.length?e.inputs:e.outputs;return nM(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var aM=t=>{const e=BigInt(t);if(!jk(e))throw new Error("Number is too large");return{low:(e&Dk).toString(10),high:(e>>128n).toString(10)}},hM=(...t)=>({...t});function uM(t){if(hk(t)||"number"==typeof t&&Number.isInteger(t))return t.toString();if(Ck(t)){if(!Nk(t))throw new Error(`${t} is a long string > 31 chars, felt can store short strings, split it to array of short strings`);const e=Ok(t);return BigInt(e).toString()}if("string"==typeof t&&sk(t))return BigInt(t).toString();if("string"==typeof t&&yk(t))return t;if("boolean"==typeof t)return""+ +t;throw new Error(`${t} can't be computed by felt()`)}var lM=class{constructor(t){const e=Object.values(t);if(0===e.length)throw new Error("This Enum must have a least 1 variant");if(1!==e.filter((t=>void 0!==t)).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){const t=Object.entries(this.variant).find((t=>void 0!==t[1]));if(void 0!==t)return t[1]}activeVariant(){const t=Object.entries(this.variant).find((t=>void 0!==t[1]));return void 0===t?"":t[0]}},cM=(t=>(t[t.Some=0]="Some",t[t.None=1]="None",t))(cM||{}),fM=class{constructor(t,e){if(!(t in cM))throw new Error("Wrong variant : should be CairoOptionVariant.Some or .None.");if(0===t){if(void 0===e)throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=e,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){if(!this.None)return this.Some}isSome(){return!(void 0===this.Some)}isNone(){return!0===this.None}},dM=(t=>(t[t.Ok=0]="Ok",t[t.Err=1]="Err",t))(dM||{}),pM=class{constructor(t,e){if(!(t in dM))throw new Error("Wrong variant : should be CairoResultVariant.Ok or .Err.");0===t?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(void 0!==this.Ok)return this.Ok;if(void 0!==this.Err)return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!(void 0===this.Ok)}isErr(){return!(void 0===this.Err)}},mM=(t,e,r)=>{if(!hk(t[r]))throw new Error(`Data and formatter mismatch on ${r}:${e[r]}, expected response data ${r}:${t[r]} to be BN instead it is ${typeof t[r]}`)},gM=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function yM(t,e,r){return Object.entries(t).reduce(((n,[i,o])=>{const s=r??e[i];if(!(i in e)&&!r)return n[i]=o,n;if("string"===s){if(Array.isArray(t[i])){const e=yM(t[i],t[i].map((t=>s)));return n[i]=Object.values(e).join(""),n}return mM(t,e,i),n[i]=$k(o),n}if("number"===s)return mM(t,e,i),n[i]=Number(o),n;if("function"==typeof s)return n[i]=s(o),n;if(Array.isArray(s)){const e=yM(t[i],s,s[0]);return n[i]=Object.values(e),n}return"object"==typeof s?(n[i]=yM(t[i],s),n):(gM(t,e,i),n)}),{})}function vM(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:oM(t)?1:0}(t);if(0===e||1===e)return new class{constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.reduce(((t,e)=>zk(e.name)?t:t+1),0)}getMethod(t){return this.abi.find((e=>e.name===t))}getLegacyFormat(){return this.abi}}(t);if(2===e)return new class{constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.length}getMethod(t){return this.abi.find((t=>"interface"===t.type)).items.find((e=>e.name===t))}getLegacyFormat(){return this.abi.flatMap((t=>"interface"===t.type?t.items:t))}}(t);throw Error(`Unsupported ABI version ${e}`)}function wM(t,e,r){return"constructor"===t&&!r&&!e.length}function bM(t){if(!t.includes("("))return{subTuple:[],result:t};const e=[];let r="",n=0;for(;n<t.length;){if("("===t[n]){let i=1;const o=n;for(n++;i;)")"===t[n]&&i--,"("===t[n]&&i++,n++;e.push(t.substring(o,n)),r+=" ",n--}else r+=t[n];n++}return{subTuple:e,result:r}}function _M(t){return nM(t)?function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:n}=bM(e);return n.split(",").map((t=>r.length?t.replace(" ",r.shift()):t))}(t):function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:n}=bM(e);let i=n.split(",").map((t=>r.length?t.replace(" ",r.shift()):t));return Gk(t)&&(i=i.reduce(((t,e)=>t.concat(function(t){const e=t.substring(0,t.indexOf(":"));return{name:e,type:t.substring(e.length+":".length)}}(e))),[])),i}(t)}function EM(t,e,r,n){const i=(t,e)=>{if(Vk(e))return function(t,e){const r=iM(e);if("string"==typeof t)return t;return t.map((t=>i(t,r)))}(t,e);if(Zk(e,n)){const r=n[e];return s(t,r)}if(Hk(e))return function(t,e){const r=_M(e).reduce(((e,r,n)=>{const o=Object.keys(t),s=r=>Object.defineProperty(e,n.toString(),{enumerable:!0,value:r??t[o[n]]}),a=r?.type?r.type:r;return s(i(t[o[n]],a)),e}),{});return r}(t,e);if(rM(e))return t;if(Xk(e)){const r=t;if("object"!=typeof r)return r;if(!("low"in r)||!("high"in r))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint256 object without the 'low' and 'high' keys.`)}(e);return{low:r.low,high:r.high}}if(Kk(e,r)){const n=r[e].members;return o(t,n)}return t},o=(t,e)=>e.reduce(((e,r)=>{if("undefined"===t[r.name]&&(nM(r.type)||!zk(r.name)))throw Error(`Your object needs a property with key : ${r.name} .`);var n;return n=i(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:n??t[r.name]}),e}),{});const s=(t,e)=>{if(Qk(e.name)){const r=t,n=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(",")),o=e.name.substring(e.name.indexOf(",")+1,e.name.lastIndexOf(">"));return r.isOk()?new pM(0,i(t.unwrap(),n)):new pM(1,i(t.unwrap(),o))}if(Jk(e.name)){const r=t,n=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new fM(0,i(r.unwrap(),n)):new fM(1,{})}const r=t,n=Object.entries(r.variant).map((t=>{if(void 0===t[1])return t;const n=e.type.substring(e.type.lastIndexOf("<")+1,e.type.lastIndexOf(">"));return"()"===n?t:[t[0],i(r.unwrap(),n)]}));return new lM(Object.fromEntries(n))};return e.reduce(((e,r)=>{return zk(r.name)&&!nM(r.type)||(n=i(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:n})),e;var n}),{})}function AM(t,e){if(!0===Xk(t)){const t=aM(e);return[uM(t.low),uM(t.high)]}return uM(e)}function kM(t){if("object"==typeof t){const{low:e,high:r}=t;return[uM(e),uM(r)]}const e=aM(t);return[uM(e.low),uM(e.high)]}function MM(t,e,r,n){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(Array.isArray(t)){const i=[];i.push(uM(t.length));const o=iM(e);return t.reduce(((t,e)=>t.concat(MM(e,o,r,n))),i)}if(r[e]&&r[e].members.length){if(Xk(e))return kM(t);if("core::starknet::eth_address::EthAddress"===e)return AM(e,t);const{members:i}=r[e],o=t;return i.reduce(((t,e)=>t.concat(MM(o[e.name],e.type,r,n))),[])}if(Hk(e)){const i=function(t,e){const r=_M(e),n=Object.values(t);if(n.length!==r.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match.\n provided: ${n} \n expected: ${r}`);return r.map(((t,e)=>({element:n[e],type:t.type??t})))}(t,e);return i.reduce(((t,e)=>{const i=MM(e.element,e.type,r,n);return t.concat(i)}),[])}if(Xk(e))return kM(t);if(Zk(e,n)){const{variants:i}=n[e];if(Jk(e)){const e=t;if(e.isSome()){const t=i.find((t=>"Some"===t.name));if(void 0===t)throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return(0).toString();const s=MM(e.unwrap(),o,r,n);return Array.isArray(s)?[(0).toString(),...s]:[(0).toString(),s]}return 1..toString()}if(Qk(e)){const e=t;if(e.isOk()){const t=i.find((t=>"Ok"===t.name));if(void 0===t)throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return(0).toString();const s=MM(e.unwrap(),o,r,n);return Array.isArray(s)?[(0).toString(),...s]:[(0).toString(),s]}const o=i.find((t=>"Err"===t.name));if(void 0===o)throw Error("Error in abi : Result has no 'Err' variant.");const s=o.type;if("()"===s)return 1..toString();const a=MM(e.unwrap(),s,r,n);return Array.isArray(a)?[1..toString(),...a]:[1..toString(),a]}const o=t,s=o.activeVariant(),a=i.find((t=>t.name===s));if(void 0===a)throw Error(`Not find in abi : Enum has no '${s}' variant.`);const h=a.type,u=i.findIndex((t=>t.name===s));if("()"===h)return u.toString();const l=MM(o.unwrap(),h,r,n);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return AM(e,t)}function xM(t,e){let r;switch(!0){case tM(t):return r=e.next().value,Boolean(BigInt(r));case Xk(t):return Uk({low:e.next().value,high:e.next().value});default:return r=e.next().value,BigInt(r)}}function SM(t,e,r,n){if("()"===e.type)return{};if(Xk(e.type)){return Uk({low:t.next().value,high:t.next().value})}if(Vk(e.type)){const i=[],o={name:"",type:iM(e.type)},s=BigInt(t.next().value);for(;i.length<s;)i.push(SM(t,o,r,n));return i}if(r&&e.type in r&&r[e.type])return"core::starknet::eth_address::EthAddress"===e.type?xM(e.type,t):r[e.type].members.reduce(((e,i)=>(e[i.name]=SM(t,i,r,n),e)),{});if(n&&e.type in n&&n[e.type]){const i=Number(t.next().value),o=n[e.type].variants.reduce(((e,o,s)=>s===i?(e[o.name]=SM(t,{name:"",type:o.type},r,n),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=0===i?o.Some:void 0;return new fM(i,t)}if(e.type.startsWith("core::result::Result")){let t;return t=0===i?o.Ok:o.Err,new pM(i,t)}return new lM(o)}if(Hk(e.type)){return _M(e.type).reduce(((e,i,o)=>{const s=i?.name?i.name:o,a={name:s,type:i?.type?i.type:i};return e[s]=SM(t,a,r,n),e}),{})}if(Vk(e.type)){const i=[],o={name:"",type:iM(e.type)},s=BigInt(t.next().value);for(;i.length<s;)i.push(SM(t,o,r,n));return i}return xM(e.type,t)}function NM(t,e,r,n,i){const{name:o,type:s}=e;let a;switch(!0){case zk(o):return a=t.next().value,BigInt(a);case r&&s in r||Hk(s):case n&&Zk(s,n):return SM(t,e,r,n);case Vk(s):if(nM(s))return SM(t,e,r,n);const h=[];if(i&&i[`${o}_len`]){const s=i[`${o}_len`];for(;h.length<s;)h.push(SM(t,{name:o,type:e.type.replace("*","")},r,n))}return h;default:return xM(s,t)}}var IM=(t,e)=>{if(ok("string"==typeof t||"number"==typeof t||"bigint"==typeof t,`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),"string"==typeof t&&!sk(t))return;const r=BigInt(t.toString(10));ok(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},CM=(t,e)=>{"number"==typeof t&&ok(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is to large to be typed as Number use (BigInt or String)"),ok("string"==typeof t||"number"==typeof t||"bigint"==typeof t||"object"==typeof t&&"low"in t&&"high"in t,`Validate: arg ${e.name} of cairo type ${e.type} should be type (String, Number or BigInt), but is ${typeof t} ${t}.`);const r="object"==typeof t?Uk(t):ak(t);switch(e.type){case"core::integer::u8":ok(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case"core::integer::u16":ok(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case"core::integer::u32":ok(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case"core::integer::u64":ok(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case"core::integer::u128":ok(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case"core::integer::u256":ok(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} 0 - 2^256-1`);break;case"core::starknet::class_hash::ClassHash":case"core::starknet::contract_address::ContractAddress":ok(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)}},TM=(t,e)=>{ok("boolean"==typeof t,`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},PM=(t,e,r)=>{if("core::integer::u256"!==e.type)if("core::starknet::eth_address::EthAddress"!==e.type)ok("object"==typeof t&&!Array.isArray(t),`Validate: arg ${e.name} is cairo type struct (${e.type}), and should be defined as js object (not array)`),r[e.type].members.forEach((({name:r})=>{ok(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else{ok("object"!=typeof t,`EthAdress type is waiting a BigNumberish. Got ${t}`);const r=BigInt(t.toString(10));ok(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else CM(t,e)},RM=(t,e)=>{ok("object"==typeof t&&!Array.isArray(t),`Validate: arg ${e.name} is cairo type Enum (${e.type}), and should be defined as js object (not array)`);const r=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),n=[...Object.getOwnPropertyNames(t),...r];if(!(Jk(e.type)&&n.includes("isSome")&&n.includes("isNone")||Qk(e.type)&&n.includes("isOk")&&n.includes("isErr")||n.includes("variant")&&n.includes("activeVariant")))throw new Error(`Validate Enum: argument ${e.name}, type ${e.type}, value received ${t}, is not an Enum.`)},OM=(t,e)=>{ok("object"==typeof t&&!Array.isArray(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},$M=(t,e,r,n)=>{const i=iM(e.type);if(!qk(i)||!Pk(t))switch(ok(Array.isArray(t),`Validate: arg ${e.name} should be an Array`),!0){case qk(i):t.forEach((t=>IM(t,e)));break;case Hk(i):t.forEach((t=>OM(t,{name:e.name,type:i})));break;case Vk(i):t.forEach((t=>$M(t,{name:"",type:i},r,n)));break;case Kk(i,r):t.forEach((t=>PM(t,{name:e.name,type:i},r)));break;case Zk(i,n):t.forEach((t=>RM(t,{name:e.name,type:i})));break;case Yk(i)||Wk(i):t.forEach((t=>CM(t,e)));break;case tM(i):t.forEach((t=>TM(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${t}`)}};function BM(t,e,r,n){t.inputs.reduce(((t,i)=>{const o=e[t];switch(!0){case zk(i.name):return t;case qk(i.type):IM(o,i);break;case Yk(i.type)||Wk(i.type):CM(o,i);break;case tM(i.type):TM(o,i);break;case Vk(i.type):$M(o,i,r,n);break;case Kk(i.type,r):PM(o,i,r);break;case Zk(i.type,n):RM(o,i);break;case Hk(i.type):OM(o,i);break;default:throw new Error(`Validate Unhandled: argument ${i.name}, type ${i.type}, value ${o}`)}return t+1}),0)}var DM=class{constructor(t){this.structs=DM.getAbiStruct(t),this.enums=DM.getAbiEnum(t),this.parser=vM(t),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if("DEPLOY"!==t){ok(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return"INVOKE"===t?!r:r})).map((t=>t.name)).includes(e),("INVOKE"===t?"invocable":"viewable")+" method not found in abi")}const n=this.abi.find((r=>"DEPLOY"===t?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(wM(e,r,n))return;const i=this.parser.methodInputsLength(n);if(r.length!==i)throw Error(`Invalid number of arguments, expected ${i} arguments, but got ${r.length}`);BM(n,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(wM(t,e,r))return[];let n;if(Array.isArray(e))n=e;else{const t=EM(e,r.inputs,this.structs,this.enums);n=Object.values(t),BM(r,n,this.structs,this.enums)}const i=n[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>zk(e.name)&&!nM(e.type)?t:t.concat(function(t,e,r,n){const{name:i,type:o}=e;let{value:s}=t.next();switch(!0){case Vk(o):if(!Array.isArray(s)&&!Ck(s))throw Error(`ABI expected parameter ${i} to be array or long string, got ${s}`);return"string"==typeof s&&(s=Rk(s)),MM(s,e.type,r,n);case"core::starknet::eth_address::EthAddress"===o:return AM(o,s);case Kk(o,r)||Hk(o)||Xk(o):case Zk(o,n):return MM(s,o,r,n);default:return AM(o,s)}}(i,e,this.structs,this.enums))),[]);return Object.defineProperty(o,"__compiled__",{enumerable:!1,writable:!1,value:!0}),o}static compile(t){const e=t=>{const e=(t,r=".")=>{const n=Array.isArray(t)?[t.length.toString(),...t]:t;return Object.entries(n).flatMap((([t,i])=>{let o=i;Pk(o)&&(o=Rk(o)),"entrypoint"===t&&(o=Mk(o));const s=Array.isArray(n)&&"0"===t?"$$len":t;if(hk(o))return[[`${r}${s}`,uM(o)]];if(Object(o)===o){const t=Object.getOwnPropertyNames(Object.getPrototypeOf(o)),n=[...Object.getOwnPropertyNames(o),...t];if(n.includes("isSome")&&n.includes("isNone")){const t=o,n=t.isSome()?0:1;return t.isSome()?e({0:n,1:t.unwrap()},`${r}${s}.`):[[`${r}${s}`,uM(n)]]}if(n.includes("isOk")&&n.includes("isErr")){const t=o,n=t.isOk()?0:1;return e({0:n,1:t.unwrap()},`${r}${s}.`)}if(n.includes("variant")&&n.includes("activeVariant")){const t=o,n=t.activeVariant(),i=Object.keys(t.variant).findIndex((t=>t===n));return"object"==typeof t.unwrap()&&0===Object.keys(t.unwrap()).length?[[`${r}${s}`,uM(i)]]:e({0:i,1:t.unwrap()},`${r}${s}.`)}return e(o,`${r}${s}.`)}return[[`${r}${s}`,uM(o)]]}))};return Object.fromEntries(e(t))};let r;if(Array.isArray(t)){const n=e({...t});r=Object.values(n)}else{const n=e(t);r=Object.values(n)}return Object.defineProperty(r,"__compiled__",{enumerable:!1,writable:!1,value:!0}),r}parse(t,e){const{outputs:r}=this.abi.find((e=>e.name===t)),n=e.flat()[Symbol.iterator](),i=r.flat().reduce(((t,e,r)=>{const i=e.name??r;return t[i]=NM(n,e,this.structs,this.enums,t),t[i]&&t[`${i}_len`]&&delete t[`${i}_len`],t}),{});return 1===Object.keys(i).length&&0 in i?i[0]:i}format(t,e,r){return yM(this.parse(t,e),r)}static getAbiStruct(t){return t.filter((t=>"struct"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{})}static getAbiEnum(t){const e=t.filter((t=>"enum"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{});return delete e["core::bool"],e}static toCalldata(t=[]){return DM.compile(t)}static toHex(t=[]){return DM.compile(t).map((t=>uk(t)))}};nA({},{calculateContractAddressFromHash:()=>tx,calculateDeclareTransactionHash:()=>YM,calculateDeployAccountTransactionHash:()=>WM,calculateDeployTransactionHash:()=>QM,calculateTransactionHash:()=>XM,calculateTransactionHashCommon:()=>JM,computeCompiledClassHash:()=>sx,computeContractClassHash:()=>ux,computeHashOnElements:()=>ZM,computeLegacyContractClassHash:()=>ix,computeSierraContractClassHash:()=>hx,default:()=>nx,feeTransactionVersion:()=>HM,feeTransactionVersion_2:()=>GM,formatSpaces:()=>rx,getSelector:()=>xk,getSelectorFromName:()=>Mk,getVersionsByType:()=>KM,keccakBn:()=>Ak,poseidon:()=>Zg,starknetKeccak:()=>kk,transactionVersion:()=>qM,transactionVersion_2:()=>VM});nA({},{starkCurve:()=>ev,weierstrass:()=>uy});nA({},{parse:()=>UM,parseAlwaysAsBig:()=>jM,stringify:()=>LM,stringifyAlwaysAsBig:()=>zM});var FM=t=>{if(!rv(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},UM=t=>Mv(String(t),void 0,FM),jM=t=>Mv(String(t),void 0,vv),LM=(t,e,r,n)=>ow(t,e,r,n),zM=LM,qM=_A,VM=EA,HM=AA,GM=kA;function KM(t){return"fee"===t?{v1:HM,v2:GM}:{v1:qM,v2:VM}}function ZM(t){return[...t,t.length].reduce(((t,e)=>Vy(ak(t),ak(e))),0).toString()}function JM(t,e,r,n,i,o,s,a=[]){const h=ZM(i);return ZM([t,e,r,n,h,o,s,...a])}function QM(t,e,r,n,i="constructor"){return JM("0x6465706c6f79",r,t,Mk(i),e,0,n)}function YM(t,e,r,n,i,o,s){return JM("0x6465636c617265",r,e,0,[t],n,i,[o,...s?[s]:[]])}function WM(t,e,r,n,i,o,s,a){return JM("0x6465706c6f795f6163636f756e74",i,t,0,[e,n,...r],o,s,[a])}function XM(t,e,r,n,i,o){return JM("0x696e766f6b65",e,t,0,r,n,i,[o])}function tx(t,e,r,n){const i=ZM(DM.compile(r));return ZM([uM("0x535441524b4e45545f434f4e54524143545f41444452455353"),n,t,e,i])}function ex(t,e){return"attributes"===t||"accessible_scopes"===t?Array.isArray(e)&&0===e.length?void 0:e:"debug_info"===t?null:null===e?void 0:e}function rx(t){let e=!1;const r=[];for(const n of t)'"'===n&&!1==(r.length>0&&"\\"===r.slice(-1)[0])&&(e=!e),e?r.push(n):r.push(":"===n?": ":","===n?", ":n);return r.join("")}function nx(t){const{abi:e,program:r}=t,n=rx(LM({abi:e,program:r},ex));return fA(Gy(sA(n)).toString(16))}function ix(t){const e="string"==typeof t?UM(t):t,r=uk(NA),n=ZM(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),i=ZM(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=ZM(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),s=ZM(e.program.builtins.map((t=>Ok(t)))),a=nx(e),h=ZM(e.program.data);return ZM([r,n,i,o,s,a,h])}function ox(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,tv(e.flatMap((t=>BigInt(Ok(t))))))];var e}));return tv(e)}function sx(t){const e=BigInt(Ok("COMPILED_CLASS_V1")),r=ox(t.entry_points_by_type.EXTERNAL),n=ox(t.entry_points_by_type.L1_HANDLER),i=ox(t.entry_points_by_type.CONSTRUCTOR),o=tv(t.bytecode.map((t=>BigInt(t))));return uk(tv([e,r,n,i,o]))}function ax(t){return tv(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function hx(t){const e=BigInt(Ok("CONTRACT_CLASS_V0.1.0")),r=ax(t.entry_points_by_type.EXTERNAL),n=ax(t.entry_points_by_type.L1_HANDLER),i=ax(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=rx(LM(t.abi,null));return BigInt(fA(Gy(sA(e)).toString(16)))}(t),s=tv(t.sierra_program.map((t=>BigInt(t))));return uk(tv([e,r,n,i,o,s]))}function ux(t){const e="string"==typeof t?UM(t):t;return"sierra_program"in e?hx(e):ix(e)}function lx(t){const e="string"==typeof t?t:LM(t);return uA(NE(e))}function cx(t){if(Array.isArray(t))return t;const e=oA(IE(hA(t)));return UM(e)}function fx(){return By(Py.randomPrivateKey())}function dx(t){return fA(t).toLowerCase()}function px(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>uk(t)));try{const{r:e,s:r}=t;return[uk(e),uk(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function mx(t){return mk(px(t))}function gx(t){return gk(px(t))}function yx(t,e=.5){const r=Math.round(100*(1+e));return ak(t)*ak(r)/100n}function vx(t){return"sierra_program"in("string"==typeof t?UM(t):t)}nA({},{compressProgram:()=>lx,decompressProgram:()=>cx,estimatedFeeToMaxFee:()=>yx,formatSignature:()=>px,makeAddress:()=>dx,randomAddress:()=>fx,signatureToDecimalArray:()=>mx,signatureToHexArray:()=>gx});var wx="undefined"!=typeof window&&window.fetch||"undefined"!=typeof global&&global.fetch||tA;function bx(t){return new Promise((e=>{setTimeout(e,t)}))}function _x(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=rx(LM(t.abi)),e.sierra_program=rx(LM(t.sierra_program)),e.sierra_program=lx(e.sierra_program),e}function Ex(t){const e="string"==typeof t?UM(t):t;return vx(t)?_x(e):{...e,..."program"in e&&{program:lx(e.program)}}}nA({},{createSierraContractClass:()=>_x,parseContract:()=>Ex,wait:()=>bx});var Ax=class extends Error{constructor(t){super(t),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),function(t,e){const{setPrototypeOf:r}=Object;r?r(t,e):t.__proto__=e}(this,new.target.prototype),function(t,e=t.constructor){const{captureStackTrace:r}=Error;r&&r(t,e)}(this)}},kx=class extends Ax{},Mx=class extends kx{constructor(t,e){super(t),this.errorCode=e}},xx=class extends kx{constructor(t,e){super(t),this.errorCode=e}};nA({},{StarknetIdContract:()=>Bx,getStarknetIdContract:()=>Dx,useDecoded:()=>Ox,useEncoded:()=>$x});var Sx="abcdefghijklmnopqrstuvwxyz0123456789-",Nx=BigInt(Sx.length+1),Ix="这来",Cx=BigInt(Sx.length),Tx=BigInt(Ix.length),Px=BigInt(Ix.length+1);function Rx(t){let e=0;for(;t.endsWith(Ix[Ix.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function Ox(t){let e="";return t.forEach((t=>{for(;t!==MA;){const r=t%Nx;if(t/=Nx,r===BigInt(Sx.length)){const r=t/Px;if(r===MA){const n=t%Px;t=r,e+=n===MA?Sx[0]:Ix[Number(n)-1]}else{e+=Ix[Number(t%Tx)],t/=Tx}}else e+=Sx[Number(r)]}const[r,n]=Rx(e);n&&(e=r+(n%2==0?Ix[Ix.length-1].repeat(n/2-1)+Ix[0]+Sx[1]:Ix[Ix.length-1].repeat((n-1)/2+1))),e+="."})),e?e.concat("stark"):e}function $x(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(Ix[0]+Sx[1])){const[e,r]=Rx(t.substring(0,t.length-2));t=e+Ix[Ix.length-1].repeat(2*(r+1))}else{const[e,r]=Rx(t);r&&(t=e+Ix[Ix.length-1].repeat(1+2*(r-1)))}for(let n=0;n<t.length;n+=1){const i=t[n],o=Sx.indexOf(i),s=BigInt(Sx.indexOf(i));if(-1!==o)n===t.length-1&&t[n]===Sx[0]?(e+=r*Cx,r*=Nx,r*=Nx):(e+=r*s,r*=Nx);else if(-1!==Ix.indexOf(i)){e+=r*Cx,r*=Nx;const o=(n===t.length-1?1:0)+Ix.indexOf(i);e+=r*BigInt(o),r*=Tx}}return e}var Bx=(t=>(t.MAINNET="0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",t.TESTNET="0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce",t))(Bx||{});function Dx(t){switch(t){case"0x534e5f4d41494e":return"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";case"0x534e5f474f45524c49":return"0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";default:throw new Error("Starknet.id is not yet deployed on this network")}}async function Fx(t,e,r){const n=await t.getChainId(),i=r??Dx(n);try{const r=await t.callContract({contractAddress:i,entrypoint:"address_to_domain",calldata:DM.compile({address:e})}),n=Ox(r.result.map((t=>BigInt(t))).slice(1));if(!n)throw Error("Starkname not found");return n}catch(t){if(t instanceof Error&&"Starkname not found"===t.message)throw t;throw Error("Could not get stark name")}}async function Ux(t,e,r){const n=await t.getChainId(),i=r??Dx(n);try{return(await t.callContract({contractAddress:i,entrypoint:"domain_to_address",calldata:DM.compile({domain:[$x(e.replace(".stark","")).toString(10)]})})).result[0]}catch{throw Error("Could not get address from stark name")}}var jx=Object.values(GA),Lx=class{constructor(t){this.hash=null,this.number=null,this.tag=null,this.valueOf=()=>this.number,this.toString=()=>this.hash,this.setIdentifier(t)}setIdentifier(t){"string"==typeof t&&sk(t)?this.hash=t:"bigint"==typeof t?this.hash=uk(t):"number"==typeof t?this.number=t:"string"==typeof t&&jx.includes(t)?this.tag=t:this.tag="pending"}get queryIdentifier(){return null!==this.number?`blockNumber=${this.number}`:null!==this.hash?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return null!==this.number?{block_number:this.number}:null!==this.hash?{block_hash:this.hash}:this.tag}set identifier(t){this.setIdentifier(t)}get sequencerIdentifier(){return null!==this.hash?{blockHash:this.hash}:{blockNumber:this.number??this.tag}}},zx=(t,e=!1)=>{e||console.warn("Using default public node url, please provide nodeUrl in provider options!");const r="SN_MAIN"===t?$A:OA;return r[Math.floor(Math.random()*r.length)]},qx={"Content-Type":"application/json"},Vx="pending",Hx=200,Gx=class{constructor(t){this.responseParser=new class{parseGetBlockResponse(t){return{timestamp:t.timestamp,block_hash:"block_hash"in t?t.block_hash:"",block_number:"block_number"in t?t.block_number:-1,new_root:"new_root"in t?t.new_root:"",parent_hash:t.parent_hash,status:"status"in t?t.status:"PENDING",transactions:t.transactions}}parseGetTransactionResponse(t){return{calldata:"calldata"in t?t.calldata:[],contract_address:"contract_address"in t?t.contract_address:"",sender_address:"sender_address"in t?t.sender_address:"",max_fee:"max_fee"in t?t.max_fee:"",nonce:"nonce"in t?t.nonce:"",signature:"signature"in t?t.signature:[],transaction_hash:t.transaction_hash,version:t.version}}parseFeeEstimateResponse(t){return{overall_fee:ak(t[0].overall_fee),gas_consumed:ak(t[0].gas_consumed),gas_price:ak(t[0].gas_price)}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:ak(t.overall_fee),gas_consumed:ak(t.gas_consumed),gas_price:ak(t.gas_price)})))}parseCallContractResponse(t){return{result:t}}parseSimulateTransactionResponse(t){return t.map((t=>({...t,suggestedMaxFee:yx(BigInt(t.fee_estimation.overall_fee))})))}parseContractClassResponse(t){return{...t,abi:"string"==typeof t.abi?JSON.parse(t.abi):t.abi}}},this.getBlockHashAndNumber=this.getBlockLatestAccepted,this.getStateUpdate=this.getBlockStateUpdate,this.traceBlockTransactions=this.getBlockTransactionsTraces,this.getTransactionCount=this.getBlockTransactionCount,this.traceTransaction=this.getTransactionTrace,this.getSimulateTransaction=this.simulateTransaction;const{nodeUrl:e,retries:r,headers:n,blockIdentifier:i,chainId:o}=t||{};Object.values(CA).includes(e)?this.nodeUrl=zx(e,t?.default):this.nodeUrl=e||zx(void 0,t?.default),this.retries=r||Hx,this.headers={...qx,...n},this.blockIdentifier=i||Vx,this.chainId=o}fetch(t,e,r=0){const n={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return wx(this.nodeUrl,{method:"POST",body:LM(n),headers:this.headers})}errorHandler(t,e,r,n){if(r){const{code:n,message:i,data:o}=r;throw new kx(`RPC: ${t} with params ${LM(e)}\n ${n}: ${i}: ${LM(o)}`)}if(n instanceof kx)throw n;if(n)throw Error(n.message)}async fetchEndpoint(t,e){try{const r=await this.fetch(t,e),{error:n,result:i}=await r.json();return this.errorHandler(t,e,n),i}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??(this.chainId=await this.fetchEndpoint("starknet_chainId")),this.chainId}async getSpecVersion(){return this.fetchEndpoint("starknet_specVersion")}async getNonceForAddress(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:n})}async getBlock(t=this.blockIdentifier){return this.getBlockWithTxHashes(t).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}async getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}async getBlockWithTxHashes(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}async getBlockWithTxs(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}async getBlockStateUpdate(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}async getBlockTransactionsTraces(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}async getBlockTransactionCount(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}async getPendingTransactions(){const{transactions:t}=await this.getBlock("pending");return Promise.all(t.map((t=>this.getTransactionByHash(t))))}async getTransaction(t){return this.getTransactionByHash(t).then(this.responseParser.parseGetTransactionResponse)}async getTransactionByHash(t){const e=uk(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}async getTransactionByBlockIdAndIndex(t,e){const r=new Lx(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}async getTransactionReceipt(t){const e=uk(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}async getTransactionTrace(t){const e=uk(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}async getTransactionStatus(t){const e=uk(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}async simulateTransaction(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1,skipFeeCharge:n=!0}){const i=new Lx(e).identifier,o=[];return r&&o.push(KA.ESimulationFlag.SKIP_VALIDATE),n&&o.push(KA.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:i,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:o}).then(this.responseParser.parseSimulateTransactionResponse)}async waitForTransaction(t,e){const r=uk(t);let{retries:n}=this,i=!1,o=!1;const s=e?.retryInterval??5e3,a=e?.errorStates??[KA.ETransactionStatus.REJECTED,KA.ETransactionExecutionStatus.REVERTED],h=e?.successStates??[KA.ETransactionExecutionStatus.SUCCEEDED,KA.ETransactionStatus.ACCEPTED_ON_L2,KA.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!i;){await bx(s);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(h.includes(t)||h.includes(e))i=!0;else if(a.includes(t)||a.includes(e)){const r=`${t}: ${e}`,n=new Error(r);throw n.response=u,o=!0,n}}catch(t){if(t instanceof Error&&o)throw t;if(n<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}n-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(n<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}n-=1,await bx(s)}return l}async getStorageAt(t,e,r=this.blockIdentifier){const n=uk(t),i=ck(e),o=new Lx(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:n,key:i,block_id:o})}async getClassHashAt(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:n,contract_address:r})}async getClassByHash(t){return this.getClass(t)}async getClass(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:n}).then(this.responseParser.parseContractClassResponse)}async getClassAt(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:n,contract_address:r}).then(this.responseParser.parseContractClassResponse)}async getCode(t,e){throw new Error("RPC does not implement getCode function")}async getContractVersion(t,e,{blockIdentifier:r=this.blockIdentifier,compiler:n=!0}={}){let i;if(t)i=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");i=await this.getClass(e,r)}if(vx(i)){if(n){return{cairo:"1",compiler:sM(i.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async getEstimateFee(t,e,r=this.blockIdentifier){return this.getInvokeEstimateFee(t,e,r)}async getInvokeEstimateFee(t,e,r=this.blockIdentifier){const n=new Lx(r).identifier,i=this.buildTransaction({type:"INVOKE_FUNCTION",...t,...e},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[i],block_id:n}).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(t,e,r=this.blockIdentifier){const n=new Lx(r).identifier,i=this.buildTransaction({type:"DECLARE",...t,...e},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[i],block_id:n}).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(t,e,r=this.blockIdentifier){const n=new Lx(r).identifier,i=this.buildTransaction({type:"DEPLOY_ACCOUNT",...t,...e},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[i],block_id:n}).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1}){r&&console.warn("getEstimateFeeBulk RPC does not support skipValidate");const n=new Lx(e).identifier;return this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:n}).then(this.responseParser.parseFeeEstimateBulkResponse)}async invokeFunction(t,e){return this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:DM.toHex(t.calldata),type:KA.ETransactionType.INVOKE,max_fee:uk(e.maxFee||0),version:"0x1",signature:gx(t.signature),nonce:uk(e.nonce)}})}async declareContract({contract:t,signature:e,senderAddress:r,compiledClassHash:n},i){return vx(t)?this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:KA.ETransactionType.DECLARE,contract_class:{sierra_program:cx(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:n||"",version:bA,max_fee:uk(i.maxFee||0),signature:gx(e),sender_address:r,nonce:uk(i.nonce)}}):this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:KA.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:wA,max_fee:uk(i.maxFee||0),signature:gx(e),sender_address:r,nonce:uk(i.nonce)}})}async deployAccountContract({classHash:t,constructorCalldata:e,addressSalt:r,signature:n},i){return this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:DM.toHex(e||[]),class_hash:uk(t),contract_address_salt:uk(r||0),type:KA.ETransactionType.DEPLOY_ACCOUNT,max_fee:uk(i.maxFee||0),version:uk(i.version||0),signature:gx(n),nonce:uk(i.nonce)}})}async callContract(t,e=this.blockIdentifier){const r=new Lx(e).identifier,n=await this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:Mk(t.entrypoint),calldata:DM.toHex(t.calldata)},block_id:r});return this.responseParser.parseCallContractResponse(n)}async estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:n,entry_point_selector:i,payload:o}=t,s={from_address:uk(r),to_address:uk(n),entry_point_selector:xk(i),payload:bk(o)},a=new Lx(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:s,block_id:a})}async getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}async getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}async getStarkName(t,e){return Fx(this,t,e)}async getAddressFromStarkName(t,e){return Ux(this,t,e)}buildTransaction(t,e){const r=KM(e),n={signature:gx(t.signature),nonce:uk(t.nonce),max_fee:uk(t.maxFee||0)};if("INVOKE_FUNCTION"===t.type)return{type:KA.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:DM.toHex(t.calldata),version:uk(t.version||r.v1),...n};if("DECLARE"===t.type)return vx(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:cx(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:uk(t.version||r.v2),...n}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:uk(t.version||r.v1),...n};if("DEPLOY_ACCOUNT"===t.type)return{type:t.type,constructor_calldata:DM.toHex(t.constructorCalldata||[]),class_hash:uk(t.classHash),contract_address_salt:uk(t.addressSalt||0),version:uk(t.version||r.v1),...n};throw Error("RPC buildTransaction received unknown TransactionType")}},Kx=/^(?:\w+:)?\/\/(\S+)$/,Zx=/^localhost[:?\d]*(?:[^:?\d]\S*)?$/,Jx=/^[^\s.]+\.\S{2,}$/;function Qx(t,e,r){return function(t){if(!t)return!1;if("string"!=typeof t)return!1;const e=t.match(Kx);if(!e)return!1;const r=e[1];return!(!r||!Zx.test(r)&&!Jx.test(r))}(r)?r:eA(t,r??e)}var Yx={network:"SN_GOERLI",blockIdentifier:"pending"},Wx=class{constructor(t=Yx){this.responseParser=new class extends class{}{parseGetBlockResponse(t){return{...t,new_root:t.state_root,parent_hash:t.parent_block_hash,transactions:Object.values(t.transactions).map((t=>"transaction_hash"in t&&t.transaction_hash)).filter(Boolean)}}parseGetTransactionResponse(t){if("NOT_RECEIVED"===t.status&&"NOT_RECEIVED"===t.finality_status)throw new kx;return{...t,calldata:"calldata"in t.transaction?t.transaction.calldata:[],contract_class:"contract_class"in t.transaction?t.transaction.contract_class:void 0,entry_point_selector:"entry_point_selector"in t.transaction?t.transaction.entry_point_selector:void 0,max_fee:"max_fee"in t.transaction?t.transaction.max_fee:void 0,nonce:t.transaction.nonce,sender_address:"sender_address"in t.transaction?t.transaction.sender_address:void 0,signature:"signature"in t.transaction?t.transaction.signature:void 0,transaction_hash:"transaction_hash"in t.transaction?t.transaction.transaction_hash:void 0,version:"version"in t.transaction?t.transaction.version:void 0}}parseGetTransactionReceiptResponse(t){return{...t,messages_sent:t.l2_to_l1_messages,..."revert_error"in t&&{revert_reason:t.revert_error}}}parseFeeEstimateResponse(t){if("overall_fee"in t){let e={};try{e={gas_consumed:ak(t.gas_usage),gas_price:ak(t.gas_price)}}catch{}return{overall_fee:ak(t.overall_fee),...e}}return{overall_fee:ak(t.amount)}}parseFeeEstimateBulkResponse(t){return[].concat(t).map((t=>{if("overall_fee"in t){let e={};try{e={gas_consumed:ak(t.gas_usage),gas_price:ak(t.gas_price)}}catch{}return{overall_fee:ak(t.overall_fee),...e}}return{overall_fee:ak(t.amount)}}))}parseSimulateTransactionResponse(t){const e="overall_fee"in t.fee_estimation?t.fee_estimation.overall_fee:t.fee_estimation.amount;return[{transaction_trace:t.trace,fee_estimation:t.fee_estimation,suggestedMaxFee:yx(BigInt(e))}]}parseCallContractResponse(t){return{result:t.result}}parseInvokeFunctionResponse(t){return{transaction_hash:t.transaction_hash}}parseDeployContractResponse(t){return{transaction_hash:t.transaction_hash,contract_address:t.address}}parseDeclareContractResponse(t){return{transaction_hash:t.transaction_hash,class_hash:t.class_hash}}parseGetStateUpdateResponse(t){const e=Object.entries(t.state_diff.nonces).map((([t,e])=>({contract_address:t,nonce:e}))),r=Object.entries(t.state_diff.storage_diffs).map((([t,e])=>({address:t,storage_entries:e})));return{...t,state_diff:{...t.state_diff,storage_diffs:r,nonces:e}}}parseContractClassResponse(t){const e=vx(t)?t:Ex(t);return{...e,abi:"string"==typeof e.abi?JSON.parse(e.abi):e.abi}}},"network"in t?(this.baseUrl=Wx.getNetworkFromName(t.network),this.feederGatewayUrl=Qx(this.baseUrl,"feeder_gateway"),this.gatewayUrl=Qx(this.baseUrl,"gateway")):(this.baseUrl=t.baseUrl,this.feederGatewayUrl=Qx(this.baseUrl,"feeder_gateway",t.feederGatewayUrl),this.gatewayUrl=Qx(this.baseUrl,"gateway",t.gatewayUrl)),this.chainId=t?.chainId??Wx.getChainIdFromBaseUrl(this.baseUrl),this.headers=t.headers,this.blockIdentifier=t?.blockIdentifier||Yx.blockIdentifier}static getNetworkFromName(t){switch(t){case"SN_MAIN":case"0x534e5f4d41494e":return"https://alpha-mainnet.starknet.io";case"SN_GOERLI":case"0x534e5f474f45524c49":return"https://alpha4.starknet.io";default:throw new Error("Could not detect base url from NetworkName")}}static getChainIdFromBaseUrl(t){try{return new URL(t).host.includes("mainnet.starknet.io")?"0x534e5f4d41494e":"0x534e5f474f45524c49"}catch{return console.error(`Could not parse baseUrl: ${t}`),"0x534e5f474f45524c49"}}getFetchUrl(t){return["add_transaction"].includes(t)?this.gatewayUrl:this.feederGatewayUrl}getFetchMethod(t){return["add_transaction","call_contract","estimate_fee","estimate_message_fee","estimate_fee_bulk","simulate_transaction"].includes(t)?"POST":"GET"}getQueryString(t){if(void 0===(e=t)||0===Object.keys(e).length||1===Object.keys(e).length&&Object.entries(e).every((([t,e])=>"blockIdentifier"===t&&null===e)))return"";var e;const r=Object.entries(t).map((([t,e])=>{if("blockIdentifier"===t){return`${new Lx(e).queryIdentifier}`}return`${t}=${e}`})).join("&");return`?${r}`}getHeaders(t){return"POST"===t?{"Content-Type":"application/json",...this.headers}:this.headers}async fetchEndpoint(t,...[e,r]){const n=this.getFetchUrl(t),i=this.getFetchMethod(t),o=this.getQueryString(e),s=eA(n,t,o);return this.fetch(s,{method:i,body:r})}async fetch(t,e){const r=Qx(this.baseUrl,"",t),n=e?.method??"GET",i=this.getHeaders(n),o=LM(e?.body);try{const t=await wx(r,{method:n,body:o,headers:i}),s=await t.text();if(!t.ok){let e;try{e=UM(s)}catch{throw new xx(t.statusText,t.status)}throw new Mx(e.message,e.code)}return(e?.parseAlwaysAsBigInt?jM:UM)(s)}catch(t){if(t instanceof Error&&!(t instanceof kx))throw Error(`Could not ${n} from endpoint \`${r}\`: ${t.message}`);throw t}}async getChainId(){return Promise.resolve(this.chainId)}async callContract({contractAddress:t,entrypoint:e,calldata:r=[]},n=this.blockIdentifier){return this.fetchEndpoint("call_contract",{blockIdentifier:n},{contract_address:t,entry_point_selector:Mk(e),calldata:DM.compile(r)}).then(this.responseParser.parseCallContractResponse)}async getBlock(t=this.blockIdentifier){return this.fetchEndpoint("get_block",{blockIdentifier:t}).then(this.responseParser.parseGetBlockResponse)}async getNonceForAddress(t,e=this.blockIdentifier){return this.fetchEndpoint("get_nonce",{contractAddress:t,blockIdentifier:e})}async getStorageAt(t,e,r=this.blockIdentifier){const n=ak(e).toString(10);return this.fetchEndpoint("get_storage_at",{blockIdentifier:r,contractAddress:t,key:n})}async getTransaction(t){const e=uk(t);return this.fetchEndpoint("get_transaction",{transactionHash:e}).then((t=>{if(1===Object.values(t).length)throw new kx(t.status);return this.responseParser.parseGetTransactionResponse(t)}))}async getTransactionReceipt(t){const e=uk(t);return this.fetchEndpoint("get_transaction_receipt",{transactionHash:e}).then(this.responseParser.parseGetTransactionReceiptResponse)}async getClassAt(t,e=this.blockIdentifier){return this.fetchEndpoint("get_full_contract",{blockIdentifier:e,contractAddress:t}).then(this.responseParser.parseContractClassResponse)}async getClassHashAt(t,e=this.blockIdentifier){return this.fetchEndpoint("get_class_hash_at",{blockIdentifier:e,contractAddress:t})}async getClassByHash(t,e=this.blockIdentifier){return this.fetchEndpoint("get_class_by_hash",{classHash:t,blockIdentifier:e}).then(this.responseParser.parseContractClassResponse)}async getCompiledClassByClassHash(t,e=this.blockIdentifier){return this.fetchEndpoint("get_compiled_class_by_class_hash",{classHash:t,blockIdentifier:e})}async getContractVersion(t,e,{blockIdentifier:r=this.blockIdentifier,compiler:n=!0}={}){let i;if(t)i=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");i=await this.getClassByHash(e,r)}if(vx(i)){if(n){return{cairo:"1",compiler:sM(i.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async invokeFunction(t,e){return this.fetchEndpoint("add_transaction",void 0,{type:"INVOKE_FUNCTION",sender_address:t.contractAddress,calldata:DM.compile(t.calldata??[]),signature:mx(t.signature),nonce:uk(e.nonce),max_fee:uk(e.maxFee||0),version:"0x1"}).then(this.responseParser.parseInvokeFunctionResponse)}async deployAccountContract({classHash:t,constructorCalldata:e,addressSalt:r,signature:n},i){return this.fetchEndpoint("add_transaction",void 0,{type:"DEPLOY_ACCOUNT",contract_address_salt:r??fx(),constructor_calldata:DM.compile(e??[]),class_hash:uk(t),max_fee:uk(i.maxFee||0),version:uk(i.version||0),nonce:uk(i.nonce),signature:mx(n)}).then(this.responseParser.parseDeployContractResponse)}async declareContract({senderAddress:t,contract:e,signature:r,compiledClassHash:n},i){return vx(e)?this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",sender_address:t,compiled_class_hash:n,contract_class:e,nonce:uk(i.nonce),signature:mx(r),max_fee:uk(i.maxFee||0),version:uk(VM)}).then(this.responseParser.parseDeclareContractResponse):this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",contract_class:e,nonce:uk(i.nonce),signature:mx(r),sender_address:t,max_fee:uk(i.maxFee||0),version:uk(qM)}).then(this.responseParser.parseDeclareContractResponse)}async getEstimateFee(t,e,r=this.blockIdentifier,n=!1){return this.getInvokeEstimateFee(t,e,r,n)}async getInvokeEstimateFee(t,e,r=this.blockIdentifier,n=!1){const i=this.buildTransaction({type:"INVOKE_FUNCTION",...t,...e},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:r,skipValidate:n},i).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(t,e,r=this.blockIdentifier,n=!1){const i=this.buildTransaction({type:"DECLARE",...t,...e},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:r,skipValidate:n},i).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(t,e,r=this.blockIdentifier,n=!1){const i=this.buildTransaction({type:"DEPLOY_ACCOUNT",...t,...e},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:r,skipValidate:n},i).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1}){const n=t.map((t=>this.buildTransaction(t,"fee")));return this.fetchEndpoint("estimate_fee_bulk",{blockIdentifier:e,skipValidate:r},n).then(this.responseParser.parseFeeEstimateBulkResponse)}async getCode(t,e=this.blockIdentifier){return this.fetchEndpoint("get_code",{contractAddress:t,blockIdentifier:e})}async waitForTransaction(t,e){let r,n=!1,i=0;const o=e?.retryInterval??5e3,s=e?.errorStates??["REJECTED","NOT_RECEIVED","REVERTED"],a=e?.successStates??["SUCCEEDED","ACCEPTED_ON_L1","ACCEPTED_ON_L2"];for(;!n;)if(await bx(o),r=await this.getTransactionStatus(t),"NOT_RECEIVED"===r.finality_status&&i<3)i+=1;else if(a.includes(r.finality_status)||a.includes(r.execution_status))n=!0;else if(s.includes(r.finality_status)||s.includes(r.execution_status)){let t;t=r.tx_failure_reason?`${r.tx_status}: ${r.tx_failure_reason.code}\n${r.tx_failure_reason.error_message}`:r.tx_revert_reason?`${r.tx_status}: ${r.tx_revert_reason}`:r.tx_status;const e=new Error(t);throw e.response=r,e}return await this.getTransactionReceipt(t)}async getTransactionStatus(t){const e=uk(t);return this.fetchEndpoint("get_transaction_status",{transactionHash:e})}async getContractAddresses(){return this.fetchEndpoint("get_contract_addresses")}async getTransactionTrace(t){const e=uk(t);return this.fetchEndpoint("get_transaction_trace",{transactionHash:e})}async estimateMessageFee({from_address:t,to_address:e,entry_point_selector:r,payload:n},i=this.blockIdentifier){const o={from_address:vk(t),to_address:wk(e),entry_point_selector:xk(r),payload:bk(n)};return this.fetchEndpoint("estimate_message_fee",{blockIdentifier:i},o)}async getSimulateTransaction(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1,skipExecute:n=!1}){t.length>1&&console.warn("Sequencer simulate process only first element from invocations list"),n&&console.warn("Sequencer can't skip account __execute__");const i=this.buildTransaction(t[0]);return this.fetchEndpoint("simulate_transaction",{blockIdentifier:e,skipValidate:r??!1},i).then(this.responseParser.parseSimulateTransactionResponse)}async getStateUpdate(t=this.blockIdentifier){const e=new Lx(t).sequencerIdentifier;return this.fetchEndpoint("get_state_update",{...e}).then(this.responseParser.parseGetStateUpdateResponse)}async getBlockTraces(t=this.blockIdentifier){const e=new Lx(t).sequencerIdentifier;return this.fetchEndpoint("get_block_traces",{...e})}async getStarkName(t,e){return Fx(this,t,e)}async getAddressFromStarkName(t,e){return Ux(this,t,e)}buildTransaction(t,e){const r=KM(e),n={signature:mx(t.signature),nonce:uk(t.nonce)};if("INVOKE_FUNCTION"===t.type)return{type:t.type,sender_address:t.contractAddress,calldata:DM.compile(t.calldata??[]),version:uk(t.version||r.v1),...n};if("DECLARE"===t.type)return vx(t.contract)?{type:t.type,contract_class:t.contract,compiled_class_hash:t.compiledClassHash,sender_address:t.senderAddress,version:uk(t.version||r.v2),...n}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:uk(t.version||r.v1),...n};if("DEPLOY_ACCOUNT"===t.type)return{type:t.type,constructor_calldata:DM.compile(t.constructorCalldata||[]),class_hash:uk(t.classHash),contract_address_salt:uk(t.addressSalt||0),version:uk(t.version||r.v1),...n};throw Error("Sequencer buildTransaction received unknown TransactionType")}},Xx=class{constructor(t){this.provider=t instanceof Xx?t.provider:t instanceof Gx||t instanceof Wx?t:t&&"rpc"in t?new Gx(t.rpc):t&&"sequencer"in t?new Wx(t.sequencer):new Gx}async getChainId(){return this.provider.getChainId()}async getBlock(t){return this.provider.getBlock(t)}async getClassAt(t,e){return this.provider.getClassAt(t,e)}async getClassHashAt(t,e){return this.provider.getClassHashAt(t,e)}getClassByHash(t){return this.provider.getClassByHash(t)}async getEstimateFee(t,e,r){return this.provider.getEstimateFee(t,e,r)}async getInvokeEstimateFee(t,e,r,n){return this.provider.getInvokeEstimateFee(t,e,r,n)}async getEstimateFeeBulk(t,e){return this.provider.getEstimateFeeBulk(t,e)}async getNonceForAddress(t,e){return this.provider.getNonceForAddress(t,e)}async getStorageAt(t,e,r){return this.provider.getStorageAt(t,e,r)}async getTransaction(t){return this.provider.getTransaction(t)}async getTransactionReceipt(t){return this.provider.getTransactionReceipt(t)}async callContract(t,e){return this.provider.callContract(t,e)}async invokeFunction(t,e){return this.provider.invokeFunction(t,e)}async deployAccountContract(t,e){return this.provider.deployAccountContract(t,e)}async declareContract(t,e){return this.provider.declareContract(t,e)}async getDeclareEstimateFee(t,e,r,n){return this.provider.getDeclareEstimateFee(t,e,r,n)}getDeployAccountEstimateFee(t,e,r,n){return this.provider.getDeployAccountEstimateFee(t,e,r,n)}async getCode(t,e){return this.provider.getCode(t,e)}async waitForTransaction(t,e){return this.provider.waitForTransaction(t,e)}async getSimulateTransaction(t,e){return this.provider.getSimulateTransaction(t,e)}async getStateUpdate(t){return this.provider.getStateUpdate(t)}async getStarkName(t,e){return Fx(this,t,e)}async getAddressFromStarkName(t,e){return Ux(this,t,e)}async getContractVersion(t,e,r){return this.provider.getContractVersion(t,e,r)}};nA({},{fromCallsToExecuteCalldata:()=>eS,fromCallsToExecuteCalldataWithNonce:()=>rS,fromCallsToExecuteCalldata_cairo1:()=>iS,getExecuteCalldata:()=>oS,transformCallsToMulticallArrays:()=>tS,transformCallsToMulticallArrays_cairo1:()=>nS});var tS=t=>{const e=[],r=[];return t.forEach((t=>{const n=DM.compile(t.calldata||[]);e.push({to:ak(t.contractAddress).toString(10),selector:ak(Mk(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:n.length.toString()}),r.push(...n)})),{callArray:e,calldata:DM.compile({calldata:r})}},eS=t=>{const{callArray:e,calldata:r}=tS(t);return[...DM.compile({callArray:e}),...r]},rS=(t,e)=>[...eS(t),ak(e).toString()],nS=t=>{const e=t.map((t=>({to:ak(t.contractAddress).toString(10),selector:ak(Mk(t.entrypoint)).toString(10),calldata:DM.compile(t.calldata||[])})));return e},iS=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:DM.compile(t.calldata)})));return DM.compile({orderCalls:e})},oS=(t,e="0")=>"1"===e?iS(t):eS(t),sS={};nA(sS,{encodeData:()=>gS,encodeType:()=>dS,encodeValue:()=>mS,getDependencies:()=>fS,getMessageHash:()=>vS,getStructHash:()=>yS,getTypeHash:()=>pS,isMerkleTreeType:()=>cS,prepareSelector:()=>lS});nA({},{MerkleTree:()=>aS,proofMerklePath:()=>hS});var aS=class{constructor(t){this.branches=[],this.leaves=t,this.root=this.build(t)}build(t){if(1===t.length)return t[0];t.length!==this.leaves.length&&this.branches.push(t);const e=[];for(let r=0;r<t.length;r+=2)r+1===t.length?e.push(aS.hash(t[r],"0x0")):e.push(aS.hash(t[r],t[r+1]));return this.build(e)}static hash(t,e){const[r,n]=[ak(t),ak(e)].sort(((t,e)=>t>=e?1:-1));return Vy(r,n)}getProof(t,e=this.leaves,r=[]){const n=e.indexOf(t);if(-1===n)throw new Error("leaf not found");if(1===e.length)return r;const i=n%2==0,o=(i?e[n+1]:e[n-1])??"0x0",s=[...r,o],a=this.leaves.length===e.length?-1:this.branches.findIndex((t=>t.length===e.length)),h=this.branches[a+1]??[this.root];return this.getProof(aS.hash(i?t:o,i?o:t),h,s)}};function hS(t,e,r){if(0===r.length)return t===e;const[n,...i]=r;return hS(t,aS.hash(e,n),i)}function uS(t){try{return uk(t)}catch(e){if("string"==typeof t)return uk(Ok(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function lS(t){return sk(t)?t:Mk(t)}function cS(t){return"merkletree"===t.type}var fS=(t,e,r=[])=>("*"===e[e.length-1]&&(e=e.slice(0,-1)),r.includes(e)?r:t[e]?[e,...t[e].reduce(((e,r)=>[...e,...fS(t,r.type,e).filter((t=>!e.includes(t)))]),[])]:r);var dS=(t,e)=>{const[r,...n]=fS(t,e);return(r?[r,...n.sort()]:[]).map((e=>`${e}(${t[e].map((t=>`${t.name}:${t.type}`))})`)).join("")},pS=(t,e)=>Mk(dS(t,e)),mS=(t,e,r,n={})=>{if(t[e])return[e,yS(t,e,r)];if(Object.keys(t).map((t=>`${t}*`)).includes(e)){const n=r.map((r=>yS(t,e.slice(0,-1),r)));return[e,ZM(n)]}if("merkletree"===e){const e=function(t,e){if(e.parent&&e.key){const r=t[e.parent].find((t=>t.name===e.key));if(!cS(r))throw new Error(`${e.key} is not a merkle tree`);if(r.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${e.key}`);return r.contains}return"raw"}(t,n),i=r.map((r=>mS(t,e,r)[1])),{root:o}=new aS(i);return["felt",o]}return"felt*"===e?["felt*",ZM(r)]:"selector"===e?["felt",lS(r)]:[e,uS(r)]},gS=(t,e,r)=>{const[n,i]=t[e].reduce((([n,i],o)=>{if(void 0===r[o.name]||null===r[o.name])throw new Error(`Cannot encode data: missing data for '${o.name}'`);const s=r[o.name],[a,h]=mS(t,o.type,s,{parent:e,key:o.name});return[[...n,a],[...i,h]]}),[["felt"],[pS(t,e)]]);return[n,i]},yS=(t,e,r)=>ZM(gS(t,e,r)[1]),vS=(t,e)=>{if(!(t=>{const e=t;return Boolean(e.types&&e.primaryType&&e.message)})(t))throw new Error("Typed data does not match JSON schema");return ZM([Ok("StarkNet Message"),yS(t.types,"StarkNetDomain",t.domain),e,yS(t.types,t.primaryType,t.message)])},wS=new Xx({rpc:{default:!0}});function bS(t){return t.filter((t=>"event"===t.type&&(t.size||"enum"!==t.kind))).reduce(((t,e)=>{const r=e.name.slice(e.name.lastIndexOf(":")+1),n={...e};return n.name=r,{...t,[fA(Gy(sA(r)).toString(16))]:n}}),{})}function _S(t,e,r,n){const i=t.flat().reduce(((t,i)=>{const o=e[i.keys[0]];if(!o)return t;const s={};s[o.name]={},i.keys.shift();const a=i.keys[Symbol.iterator](),h=i.data[Symbol.iterator](),u=o.members?.filter((t=>"key"===t.kind))||o.keys,l=o.members?.filter((t=>"data"===t.kind))||o.data;return u.forEach((t=>{s[o.name][t.name]=NM(a,t,r,n,s[o.name])})),l.forEach((t=>{s[o.name][t.name]=NM(h,t,r,n,s[o.name])})),t.push(s),t}),[]);return i}nA({},{getAbiEvents:()=>bS,parseEvents:()=>_S});var ES=t=>{const e=t[t.length-1];return"object"==typeof e&&["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"].some((t=>t in e))?{args:t,options:t.pop()}:{args:t}};function AS(t,e){return async function(...r){const n=ES(r);return t.call(e.name,n.args,{parseRequest:!0,parseResponse:!0,...n.options})}}function kS(t,e){return"view"===e.stateMutability||"view"===e.state_mutability?AS(t,e):function(t,e){return async function(...r){const n=ES(r);return t.invoke(e.name,n.args,{parseRequest:!0,...n.options})}}(t,e)}function MS(t,e){return function(...r){return t.estimate(e.name,r)}}function xS(t,e){return Array.isArray(t)&&"__compiled__"in t?t:Array.isArray(t)&&Array.isArray(t[0])&&"__compiled__"in t[0]?t[0]:e()}var SS=class{constructor(t,e,r=wS){this.address=e&&e.toLowerCase(),this.providerOrAccount=r,this.callData=new DM(t),this.structs=DM.getAbiStruct(t),this.events=bS(t);const n=vM(t);this.abi=n.getLegacyFormat();const i={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach((t=>{if("function"!==t.type)return;const e=t.name;var r,n;this[e]||Object.defineProperty(this,e,{...i,value:kS(this,t)}),this.functions[e]||Object.defineProperty(this.functions,e,{...i,value:kS(this,t)}),this.callStatic[e]||Object.defineProperty(this.callStatic,e,{...i,value:AS(this,t)}),this.populateTransaction[e]||Object.defineProperty(this.populateTransaction,e,{...i,value:(r=this,n=t,function(...t){return r.populate(n.name,t)})}),this.estimateFee[e]||Object.defineProperty(this.estimateFee,e,{...i,value:MS(this,t)})}))}attach(t){this.address=t}connect(t){this.providerOrAccount=t}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(t,e=[],{parseRequest:r=!0,parseResponse:n=!0,formatResponse:i,blockIdentifier:o}={}){ok(null!==this.address,"contract is not connected to an address");const s=xS(e,(()=>r?(this.callData.validate("CALL",t,e),this.callData.compile(t,e)):(console.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),e)));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:s,entrypoint:t},o).then((e=>n?i?this.callData.format(t,e.result,i):this.callData.parse(t,e.result):e.result))}invoke(t,e=[],{parseRequest:r=!0,maxFee:n,nonce:i,signature:o}={}){ok(null!==this.address,"contract is not connected to an address");const s=xS(e,(()=>r?(this.callData.validate("INVOKE",t,e),this.callData.compile(t,e)):(console.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),e))),a={contractAddress:this.address,calldata:s,entrypoint:t};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(a,void 0,{maxFee:n,nonce:i});if(!i)throw new Error("Nonce is required when invoking a function without an account");return console.warn(`Invoking ${t} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...a,signature:o},{nonce:i})}async estimate(t,e=[]){ok(null!==this.address,"contract is not connected to an address"),xS(e,(()=>!1))||this.callData.validate("INVOKE",t,e);const r=this.populate(t,e);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(r);throw Error("Contract must be connected to the account contract to estimate")}populate(t,e=[]){const r=xS(e,(()=>this.callData.compile(t,e)));return{contractAddress:this.address,entrypoint:t,calldata:r}}parseEvents(t){return _S(t.events?.filter((t=>dk(t.from_address)===dk(this.address)),[])||[],this.events,this.structs,DM.getAbiEnum(this.abi))}isCairo1(){return Bk.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typed(t){return this}};function NS(t){pk(t,MA,SA,"Starknet Address");const e=function(t){return fA(cA(uk(t)).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return e}const IS={SN_MAIN:"https://starknet-mainnet.public.blastapi.io",SN_SEPOLIA:"https://starknet-sepolia.public.blastapi.io"},CS=[{name:"argent::account::interface::IDeprecatedArgentAccount",type:"interface",items:[{name:"isValidSignature",type:"function",inputs:[{name:"hash",type:"core::felt252"},{name:"signatures",type:"core::array::Array::<core::felt252>"}],outputs:[{type:"core::felt252"}],state_mutability:"view"}]}];function TS(t,e){var r;if(!IS[t])throw new Error("Invalid network");return new Gx({nodeUrl:null!==(r=null==e?void 0:e.broviderUrl)&&void 0!==r?r:IS[t]})}function PS(t){return!!t.primaryType&&!!t.types.StarkNetDomain}function RS(t,e){const{domain:r,types:n,primaryType:i,message:o}=t;return sS.getMessageHash({types:n,primaryType:i,domain:r,message:o},e)}var OS=Object.freeze({__proto__:null,isStarknetMessage:PS,getHash:RS,default:function(t,r,n){return e(this,arguments,void 0,(function*(t,e,r,n="SN_MAIN",i={}){const o=new SS(CS,t,TS(n,i));return yield o.isValidSignature(RS(r,t),[e[0],e[1]]),!0}))}});function $S(t){return we(En(t))}var BS=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const DS=new y("hash/5.6.1"),FS=new Uint8Array(32);FS.fill(0);const US=qt.from(-1),jS=qt.from(0),LS=qt.from(1),zS=qt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const qS=O(LS.toHexString(),32),VS=O(jS.toHexString(),32),HS={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},GS=["name","version","chainId","verifyingContract","salt"];function KS(t){return function(e){return"string"!=typeof e&&DS.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const ZS={name:KS("name"),version:KS("version"),chainId:function(t){try{return qt.from(t).toString()}catch(t){}return DS.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Pe(t).toLowerCase()}catch(t){}return DS.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=k(t);if(32!==e.length)throw new Error("bad length");return I(e)}catch(t){}return DS.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function JS(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&DS.throwArgumentError("invalid numeric width","type",t);const i=zS.mask(r?n-1:n),o=r?i.add(LS).mul(US):jS;return function(e){const r=qt.from(e);return(r.lt(o)||r.gt(i))&&DS.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),O(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&DS.throwArgumentError("invalid bytes width","type",t),function(e){return k(e).length!==r&&DS.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=k(t),r=e.length%32;return r?P([e,FS.slice(r)]):I(e)}(e)}}}switch(t){case"address":return function(t){return O(Pe(t),32)};case"bool":return function(t){return t?qS:VS};case"bytes":return function(t){return we(t)};case"string":return function(t){return $S(t)}}return null}function QS(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class YS{constructor(t){gr(this,"types",Object.freeze(Ar(t))),gr(this,"_encoderCache",{}),gr(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&DS.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&DS.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);JS(s)||(r[s]||DS.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?DS.throwArgumentError("missing primary type","types",t):i.length>1&&DS.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),gr(this,"primaryType",i[0]),function i(o,s){s[o]&&DS.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=QS(e,t[e])+r.map((e=>QS(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=JS(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&DS.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(we)),we(P(i))}}const r=this.types[t];if(r){const e=$S(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?we(n):n}));return n.unshift(e),P(n)}}return DS.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||DS.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return we(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(JS(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&DS.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):DS.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new YS(t)}static getPrimaryType(t){return YS.from(t).primaryType}static hashStruct(t,e,r){return YS.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=HS[r];n||DS.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>GS.indexOf(t.name)-GS.indexOf(e.name))),YS.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return P(["0x1901",YS.hashDomain(t),YS.from(e).hash(r)])}static hash(t,e,r){return we(YS.encode(t,e,r))}static resolveNames(t,e,r,n){return BS(this,void 0,void 0,(function*(){t=wr(t);const i={};t.verifyingContract&&!S(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=YS.from(e);o.visit(r,((t,e)=>("address"!==t||S(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){YS.hashDomain(t);const n={},i=[];GS.forEach((e=>{const r=t[e];null!=r&&(n[e]=ZS[e](r),i.push({name:e,type:HS[e]}))}));const o=YS.from(e),s=wr(e);return s.EIP712Domain?DS.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return I(k(e));if(t.match(/^u?int/))return qt.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&DS.throwArgumentError("invalid string","value",e),e}return DS.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new y("wallet/5.6.2");function WS(t,e,r,n){return Fs(YS.hash(t,e,r),n)}function XS(t,e){return t.toLowerCase()===e.toLowerCase()}function tN(t){const{domain:e,types:r,message:n}=t;return Lu.hash(e,r,n)}function eN(t,r,n,i){return e(this,void 0,void 0,(function*(){let e;try{e=yield ON(i,["function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[k(n),r]])}catch(t){if(t.message.startsWith("missing revert data in call exception"))return!1;throw t}return XS(e,"0x1626ba7e")}))}function rN(t,r,n,i){return e(this,void 0,void 0,(function*(){return XS(yield ON(i,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[k(n),r]]),"0x20c13b0b")}))}var nN=Object.freeze({__proto__:null,getHash:tN,default:function(t,r,n){return e(this,arguments,void 0,(function*(t,e,r,n="1",i={}){const{domain:o,types:s,message:a}=r;try{if(XS(t,WS(o,s,a,e)))return!0}catch(t){}const h=cm(n,i),u=tN(r);return!!(yield eN(t,e,u,h))||(yield rN(t,e,u,h))}))}});var iN=["snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"],oN={1:{key:"1",name:"Ethereum",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",ensResolvers:["0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63","0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"],ensNameWrapper:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH",rpc:["https://rpc.ankr.com/eth",{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],light:["https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:{url:"https://etherscan.io",apiUrl:"https://api.etherscan.io"},start:7929876,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},8:{key:"8",name:"Ubiq",chainId:8,network:"Ubiq",multicall:"0x6668750957e4083725926B71C41bDF1434C73262",rpc:["https://rpc.octano.dev"],ws:["wss://ws.octano.dev"],explorer:{url:"https://ubiqscan.io"},start:1,logo:"ipfs://Qmec3HLoN4QhwZAhw4XTi2aN8Wwmcko5hHN22sHARzb9tw"},10:{key:"10",name:"Optimism",chainId:10,network:"Optimism mainnet",multicall:"0x35A6Cdb2C9AD4a45112df4a04147EB07dFA01aB7",rpc:["https://opt-mainnet.g.alchemy.com/v2/JzmIL4Q3jBj7it2duxLFeuCa9Wobmm7D"],explorer:{url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io"},start:657806,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb"},19:{key:"19",name:"Songbird Canary-Network",shortName:"Songbird",chainId:19,network:"songbird",multicall:"0x17032Ea9c3a13Ed337665145364c0d2aD1108c91",rpc:["https://songbird-api.flare.network/ext/C/rpc"],explorer:{url:"https://songbird-explorer.flare.network"},start:21807126,logo:"ipfs://QmXyvnrZY8FUxSULfnKKA99sAEkjAHtvhRx5WeHixgaEdu"},24:{key:"24",name:"KardiaChain Mainnet",shortName:"KAI",chainId:24,network:"mainnet",multicall:"0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",rpc:["https://kai-internal.kardiachain.io"],explorer:{url:"https://explorer.kardiachain.io"},start:8260245,logo:"ipfs://bafkreig73yfyqzbxydv6e3dbj5nks3f57px2iez7tywayey4rilfhhrr34"},25:{key:"25",name:"Cronos",shortName:"Cronos",chainId:25,network:"mainnet",multicall:"0x6F522a3982e8F9A50A2EDc9E46ed1A3aE2B3FD3a",rpc:["https://evm-cronos.crypto.org"],explorer:{url:"https://cronos.crypto.org/explorer"},start:4067,logo:"ipfs://QmfSJbtirJoa3Pt7o5Fdm85wbyw9V1hpzqLr5PQbdnfsAj"},30:{key:"30",name:"RSK",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:{url:"https://explorer.rsk.co"},start:2516442,logo:"ipfs://QmXTwpE1SqoNZmyY4c3fYWy6qUgQELsyWKbgJo2Pg6K6V9"},46:{key:"46",name:"Darwinia Network",shortName:"Darwinia",chainId:46,network:"mainnet",multicall:"0x67f9ae42EaA9a8aBf065D60ec6Ab3C1A11370607",rpc:["https://rpc.darwinia.network"],explorer:{url:"https://darwinia.subscan.io"},start:141853,logo:"ipfs://bafkreicf55maidhx46pyu3mwsshlr43xbewr6tkckkonh4nesbkp7krwkm"},56:{key:"56",name:"Binance Smart Chain",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://rpc.ankr.com/bsc","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org"],explorer:{url:"https://bscscan.com"},start:461230,logo:"ipfs://QmWQaQ4Tv28DwA4DRKjSDJFWY9mZboGvuu77J8nh7kucxv"},61:{key:"61",name:"Ethereum Classic",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"0x51be3a92C56ae7E207C5b5Fd87F7798Ce82C1AC2",rpc:["https://www.ethercluster.com/etc"],explorer:{url:"https://blockscout.com/etc/mainnet"},start:13307544,logo:"ipfs://QmVegc28DvA7LjKUFysab81c9BSuN4wQVDQkRXyAtuEBis"},66:{key:"66",name:"OKExChain",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:{url:"https://www.oklink.com/okexchain"},start:5076543,logo:"ipfs://Qmd7dKnNwHRZ4HRCbCXUbkNV7gP28fGqPdjbHtjRtT9sQF"},75:{key:"75",name:"Decimal",shortName:"mainnet",chainId:75,network:"mainnet",multicall:"0x949d1A0757803C51F2EfFFEb5472C861A898B8E8",rpc:[],explorer:{url:"https://explorer.decimalchain.com"},start:16031065,logo:"ipfs://bafkreihkdhbce5rkogl63xegaarlirjrvbfarxbtbf5mqme3s5grvbjyxm"},81:{key:"81",name:"Shibuya Network",shortName:"Shibuya",chainId:81,network:"testnet",testnet:!0,multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shibuya.astar.network:8545"],explorer:{url:"https://blockscout.com/shibuya"},start:856303,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},82:{key:"82",name:"Meter",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:{url:"https://scan.meter.io"},start:4992871,logo:"ipfs://QmSZvT9w9eUDvV1YVaq3BKKEbubtNVqu1Rin44FuN4wz11"},97:{key:"97",name:"Binance Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",testnet:!0,multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://data-seed-prebsc-1-s1.binance.org:8545","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive"],explorer:{url:"https://testnet.bscscan.com"},start:3599656,logo:"ipfs://QmWQaQ4Tv28DwA4DRKjSDJFWY9mZboGvuu77J8nh7kucxv"},100:{key:"100",name:"Gnosis Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://gno.getblock.io/mainnet/6c1d1e6e-75d9-452f-a863-a694bff93d5c/","https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://rpc.gnosischain.com"],light:["https://rpc.gnosischain.com"],ws:["wss://rpc.xdaichain.com/wss"],explorer:{url:"https://gnosis.blockscout.com"},start:4108192,logo:"ipfs://QmZeiy8Ax4133wzxUQM9ky8z5XFVf6YLFjJMmTWbWVniZR"},108:{key:"108",name:"Thundercore",chainId:108,network:"mainnet",multicall:"0x3017086deef56679e267f67f66c4415109b7a97f",rpc:["https://mainnet-rpc.thundercore.com/archived/SNAPSHOTEuR82a75fLYA"],explorer:{url:"https://viewblock.io/thundercore"},start:94425385,logo:"ipfs://bafkreifc5z5vtvqx2luzgateyvoocwpd2ifv2hwufxdnyl2a767wa6icli"},122:{key:"122",name:"Fuse",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://explorer-node.fuse.io/","https://oefusefull1.liquify.info/"],explorer:{url:"https://explorer.fuse.io"},start:11923459,logo:"ipfs://QmXjWb64nako7voaVEifgdjAbDbswpTY8bghsiHpv8yWtb"},137:{key:"137",name:"Polygon PoS",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://rpc.ankr.com/polygon","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e"],ws:["wss://ws-mainnet.matic.network"],explorer:{url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com"},start:9834491,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},144:{key:"144",name:"PHI Network",shortName:"PHI",chainId:144,network:"mainnet",multicall:"0xc2f41B404a6757863AAeF49ff93039421acCd630",rpc:["https://connect.phi.network"],explorer:{url:"https://phiscan.com"},start:360030,logo:"ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"},148:{key:"148",name:"ShimmerEVM",shortName:"ShimmerEVM",chainId:148,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.evm.shimmer.network/"},start:1290,logo:"ipfs://bafkreib4xhbgbhrwkmizp4d4nz3wzbpyhdm6wpz2v2pbkk7jxsgg3hdt74"},169:{key:"169",name:"Manta Pacific",shortName:"Manta",chainId:169,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.oklink.com/manta"},start:332890,logo:"ipfs://bafkreibbrwgwdcfh755dqh4ndta6tja77qbaa36bfv4pstub6prhhore7a"},204:{key:"204",name:"opBNB",shortName:"mainnet",chainId:204,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"http://opbnbscan.com/"},start:512881,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:{url:"https://explorer.energyweb.org"},start:12086501,logo:"ipfs://Qmai7AGHgs8NpeGeXgbMZz7pS2i4kw44qubCJYGrZW2f3a"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ankr.com/fantom","https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:{url:"https://ftmscan.com"},start:2497732,logo:"ipfs://QmVEgNeQDKnXygeGxfY9FywZpNGQu98ktZtRJ9bToYF6g7"},269:{key:"269",name:"High Performance Blockchain",shortName:"HPB",chainId:269,network:"mainnet",multicall:"0x67D0f263aef2F6167FA77353695D75b582Ff4Bca",rpc:["https://hpbnode.com"],ws:["wss://ws.hpbnode.com"],explorer:{url:"https://hscan.org"},start:13960096,logo:"ipfs://QmU7f1MyRz8rLELFfypnWZQjGbDGYgZtC9rjw47jYMYrnu"},300:{key:"300",name:"zkSync Sepolia Testnet",shortName:"testnet",chainId:300,network:"testnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:[],explorer:{url:"https://sepolia.explorer.zksync.dev/"},start:2292,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy",testnet:!0},314:{key:"314",name:"Filecoin",shortName:"mainnet",chainId:314,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://filfox.io"},start:3328594,logo:"ipfs://bafybeibyvjfmk6aqlfdrczvth55jkmnoadtrch7ht3rdmvqmy2bfxynecm"},321:{key:"321",name:"KCC",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:{url:"https://explorer.kcc.io"},start:1487453,logo:"ipfs://QmRdzYGhFRG8QLzMJahHrw3vETE2YZ9sywQbEkenSjKEvb"},324:{key:"324",name:"zkSync Era",shortName:"zkSync-era",chainId:324,network:"zkSync Era Mainnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:["https://mainnet.era.zksync.io"],explorer:{url:"https://explorer.zksync.io/"},start:3908235,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy"},336:{key:"336",name:"Shiden Network",shortName:"Shiden",chainId:336,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shiden.astar.network:8545","https://shiden.api.onfinality.io/public"],explorer:{url:"https://blockscout.com/shiden"},start:1170016,logo:"ipfs://QmcqGQE4Sk73zXc3e91TUFFefKBVeaNgbxV141XkSNE4xj"},369:{key:"369",name:"Pulsechain",shortName:"Pulsechain",chainId:369,network:"mainnet",multicall:"0xdbdd0FD8B16F0092f306392b699D7fbddaA9011B",rpc:["https://rpc.pulsechain.com"],explorer:{url:"https://scan.pulsechain.com/"},start:17657774,logo:"ipfs://QmWUsiEWdejtHZ9B9981TYXn7Ds8C7fkB1S4h5rP3kCCZR"},416:{key:"416",name:"SX Network",shortName:"SX",chainId:416,network:"mainnet",multicall:"0x834a005DDCF990Ba1a79f259e840e58F2D14F49a",rpc:["https://rpc.sx.technology"],ws:["wss://rpc.sx.technology/ws"],explorer:{url:"https://explorer.sx.technology"},start:2680605,logo:"ipfs://QmSXLXqyr2H6Ja5XrmznXbWTEvF2gFaL8RXNXgyLmDHjAF"},592:{key:"592",name:"Astar Network",shortName:"Astar",chainId:592,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://astar.api.onfinality.io/public","https://rpc.astar.network:8545"],explorer:{url:"https://blockscout.com/astar"},start:366482,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},813:{key:"813",name:"Qitmeer",shortName:"MEER",chainId:813,network:"mainnet",multicall:"0x55034b2cF530ae3A8fC1e2e4523F58496796610F",rpc:["https://evm-dataseed1.meerscan.io","https://evm-dataseed.meerscan.com","https://evm-dataseed2.meerscan.io","https://evm-dataseed3.meerscan.io"],explorer:{url:"https://evm.meerscan.io"},start:43317,logo:"ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"},841:{key:"841",name:"Taraxa",shortName:"841",chainId:841,network:"mainnet",multicall:"0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",rpc:["https://rpc.mainnet.taraxa.io"],ws:["wss://ws.mainnet.taraxa.io"],explorer:{url:"https://mainnet.explorer.taraxa.io"},start:1515906,logo:"ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"},888:{key:"888",name:"Wanchain",chainId:888,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:{url:"https://www.wanscan.org"},start:11302663,logo:"ipfs://QmewFFN44rkxESFsHG8edaLt1znr62hjvZhGynfXqruzX3"},1001:{key:"1001",name:"Klaytn Baobab Testnet",shortName:"Boabab",chainId:1001,network:"testnet",testnet:!0,multicall:"0x40643B8Aeaaca0b87Ea1A1E596e64a0e14B1d244",rpc:["https://archive-en.baobab.klaytn.net"],ws:["wss://archive-en.baobab.klaytn.net/ws"],explorer:{url:"https://baobab.scope.klaytn.com"},start:87232478,logo:"ipfs://QmYACyZcidcFtMo4Uf9H6ZKUxTP2TQPjGzNjcUjqYa64dt"},1072:{key:"1072",name:"Shimmer EVM Testnet",shortName:"ShimmerEVM",chainId:1072,network:"testnet",testnet:!0,multicall:"0x751d21047C116413895c259f3f305e38C10B7cF6",rpc:["https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"],explorer:{url:"https://explorer.evm.testnet.shimmer.network/"},start:10614,logo:"ipfs://bafkreihtwfwrue7klzedwx4rqlk6agklz4lbbk7owsyw6xzn6c2m4t5tgy"},1088:{key:"1088",name:"Metis",shortName:"metis",chainId:1088,network:"mainnet",multicall:"0xc39aBB6c4451089dE48Cffb013c39d3110530e5C",rpc:["https://andromeda.metis.io/?owner=1088"],explorer:{url:"https://andromeda-explorer.metis.io"},start:451,logo:"ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"},1101:{key:"1101",name:"Polygon zkEVM",shortName:"mainnet",chainId:1101,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://zkevm.polygonscan.com"},start:57746,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm"},1116:{key:"1116",name:"Core Chain",shortName:"Core",chainId:1116,network:"mainnet",multicall:"0x024f0041b76B598c2A0a75004F8447FaF67BD004",rpc:["https://rpcar.coredao.org/"],explorer:{url:"https://scan.coredao.org"},start:853908,logo:"ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"},1284:{key:"1284",name:"Moonbeam",shortName:"GLMR",chainId:1284,network:"mainnet",multicall:"0x83e3b61886770de2F64AAcaD2724ED4f08F7f36B",rpc:["https://rpc.api.moonbeam.network"],explorer:{url:"https://moonscan.io/"},start:171135,logo:"ipfs://QmWKTEK2pj5sBBbHnMHQbWgw6euVdBrk2Ligpi2chrWASk"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.api.moonriver.moonbeam.network"],explorer:{url:"https://blockscout.moonriver.moonbeam.network"},start:413539,logo:"ipfs://QmXtgPesL87Ejhq2Y7yxsaPYpf4RcnoTYPJWPcv6iiYhoi"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",testnet:!0,multicall:"0xf09FD6B6FF3f41614b9d6be2166A0D07045A3A97",rpc:["https://rpc.testnet.moonbeam.network"],explorer:{url:"https://moonbase-blockscout.testnet.moonbeam.network"},start:859041,logo:"ipfs://QmeGbNTU2Jqwg8qLTMGW8n8HSi2VdgCncAaeGzLx6gYnD7"},1328:{key:"1328",name:"Sei atlantic testnet",shortName:"testnet",chainId:1328,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://seitrace.com"},start:96978658,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},1329:{key:"1329",name:"Sei",shortName:"mainnet",chainId:1329,network:"mainnet",multicall:"0xe033Bed7cae4114Af84Be1e9F1CA7DEa07Dfe1Cf",rpc:[],explorer:{url:"https://seitrace.com/"},start:79164574,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq"},1559:{key:"1559",name:"Tenet",shortName:"tenet",chainId:1559,network:"mainnet",multicall:"0xcCB3F00bE353950E4C08501ac8Af48765EAAa738",rpc:[],explorer:{url:"https://tenetscan.io"},start:944415,logo:"ipfs://Qmc1gqjWTzNo4pyFSGtQuCu7kRSZZBUVybtTjHn2nNEEPA"},1663:{key:"1663",name:"Horizen Gobi Testnet",shortName:"Gobi",chainId:1663,network:"testnet",testnet:!0,multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:["https://gobi-testnet.horizenlabs.io/ethv1"],explorer:{url:"https://gobi-explorer.horizen.io"},start:1,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},2e3:{key:"2000",name:"Doge Chain",shortName:"dogechain",chainId:2e3,network:"mainnet",multicall:"0x6f9D3f3932B417bd4957585D236Cbc32b32C0BDc",rpc:["https://rpc.dogechain.dog"],explorer:{url:"https://explorer.dogechain.dog"},start:877115,logo:"ipfs://bafkreigovfh3pinsdih777issfgaflwu2yjzroljs2642gbvwikcd3nm4i"},2109:{key:"2109",name:"Exosama Network",shortName:"EXN",chainId:2109,network:"mainnet",multicall:"0x2feFC828e2fEfdE0C9f7740919c6A9139F886067",rpc:["https://rpc.exosama.com"],explorer:{url:"https://explorer.exosama.com"},start:94085,logo:"ipfs://QmaQxfwpXYTomUd24PMx5tKjosupXcm99z1jL1XLq9LWBS"},2152:{key:"2152",name:"Findora",shortName:"Findora",chainId:2152,network:"mainnet",multicall:"0xCF7D1e21CBe9bdEF235aef06C5d8051B3d4DF0f5",rpc:["https://archive.prod.findora.org:8545/"],explorer:{url:"https://evm.findorascan.io"},start:4219343,logo:"ipfs://QmXkneyRB6HbHTHRLCZpZqSsawiyJY7b2kZ2V8ydvKYAgv"},2221:{key:"2221",name:"Kava Testnet",shortName:"testnet",chainId:2221,network:"testnet",multicall:"0xc7193EFE367DF0C9349a1149F4E95A2A35604262",rpc:[],explorer:{url:"https://testnet.kavascan.com"},start:6193104,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4",testnet:!0},2222:{key:"2222",name:"Kava",shortName:"mainnet",chainId:2222,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://kavascan.com/"},start:3661165,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4"},2400:{key:"2400",name:"TCG Verse",shortName:"TCGV",chainId:2400,network:"mainnet",multicall:"0xceC65DEE0b5012F1b7321b2647681F997c7204FC",rpc:["https://rpc.tcgverse.xyz"],explorer:{url:"https://explorer.tcgverse.xyz"},start:57500,logo:"ipfs://bafkreidg4wpewve5mdxrofneqblydkrjl3oevtgpdf3fk3z3vjqam6ocoe"},4200:{key:"4200",name:"Merlin",shortName:"merlin",chainId:4200,network:"mainnet",multicall:"0x830E7E548F4D80947a40A7Cf3a2a53166a0C3980",rpc:[],explorer:{url:"https://scan.merlinchain.io"},start:589494,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe"},4337:{key:"4337",name:"Beam",shortName:"Beam",chainId:4337,network:"mainnet",multicall:"0x4956F15eFdc3dC16645e90Cc356eAFA65fFC65Ec",rpc:[],explorer:{url:"https://subnets.avax.network/beam/"},start:1,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF"},4689:{key:"4689",name:"IoTeX",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:{url:"https://iotexscan.io"},start:11533283,logo:"ipfs://QmNkr1UPcBYbvLp7d7Pk4eF3YCsHpaNkfusKZNtykL2EQC"},5e3:{key:"5000",name:"Mantle",chainId:5e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.mantle.xyz"],explorer:{url:"https://explorer.mantle.xyz"},start:304717,logo:"ipfs://bafkreidkucwfn4mzo2gtydrt2wogk3je5xpugom67vhi4h4comaxxjzoz4"},5555:{key:"5555",name:"Chain Verse",shortName:"ChainVerse",chainId:5555,network:"ChainVerse",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.chainverse.info"],explorer:{url:"https://explorer.chainverse.info"},start:6334180,logo:"ipfs://QmQyJt28h4wN3QHPXUQJQYQqGiFUD77han3zibZPzHbitk"},6102:{key:"6102",name:"Cascadia Testnet",shortName:"Cascadia",chainId:6102,network:"testnet",multicall:"0x728989819bAD588F193563008E0a03E8cD6a3e4a",rpc:["https://testnet.cascadia.foundation"],explorer:{url:"https://explorer.cascadia.foundation"},testnet:!0,start:370457,logo:"ipfs://QmWkhZYhReYyaa5pQXj32hEGxoRcBqarFMcfQScELmjYQj"},7332:{key:"7332",name:"Horizen EON",shortName:"EON",chainId:7332,network:"mainnet",multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:[],explorer:{url:"https://eon-explorer.horizenlabs.io"},start:85108,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},7341:{key:"7341",name:"Shyft",shortName:"Shyft",chainId:7341,network:"mainnet",multicall:"0xceb10e9133D771cA93c8002Be527A465E85381a2",rpc:["https://rpc.shyft.network"],explorer:{url:"https://bx.shyft.network"},start:3673983,logo:"ipfs://bafkreifwxnnfk6koabzmxgcxcwlrwt6b5gijdain2gyqee77q4ajfb7fu4"},7560:{key:"7560",name:"Cyber",shortName:"mainnet",chainId:7560,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://cyberscan.co"},start:1731707,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm"},8217:{key:"8217",name:"Klaytn Cypress",shortName:"Cypress",chainId:8217,network:"mainnet",multicall:"0x5f5f0d1b9ff8b3dcace308e39b13b203354906e9",rpc:["https://archive-en.cypress.klaytn.net"],ws:["wss://archive-en.cypress.klaytn.net/ws"],explorer:{url:"https://scope.klaytn.com"},start:91582357,logo:"ipfs://QmYACyZcidcFtMo4Uf9H6ZKUxTP2TQPjGzNjcUjqYa64dt"},8453:{key:"8453",name:"Base",shortName:"mainnet",chainId:8453,network:"mainnet",multicall:"0xca11bde05977b3631167028862be2a173976ca11",rpc:[],explorer:{url:"https://basescan.org/"},start:5022,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"},9001:{key:"9001",name:"Evmos Network",shortName:"Evmos",chainId:9001,network:"mainnet",multicall:"0x37763d16f8dBf6F185368E0f256350cAb7E24b26",rpc:["https://eth.bd.evmos.org:8545"],ws:["wss://eth.bd.evmos.org:8546"],explorer:{url:"https://escan.live"},start:13959539,logo:"ipfs://bafkreif4obrdoiretpozdd56seziywc6clha7wwkbldng3ovry2bpzly34"},1e4:{key:"10000",name:"smartBCH",shortName:"BCH",chainId:1e4,network:"mainnet",multicall:"0x1b38EBAd553f218e2962Cb1C0539Abb5d6A37774",rpc:["https://smartbch.greyh.at/"],explorer:{url:"https://smartbch-explorer.web.app"},start:268248,logo:"ipfs://QmWG1p7om4hZ4Yi4uQvDpxg4si7qVYhtppGbcDGrhVFvMd"},10243:{key:"10243",name:"Arthera Testnet",shortName:"Arthera_",chainId:10243,network:"testnet",testnet:!0,multicall:"0x27c7FC597aD2E81C4c1cA1769972f79DaF042Da7",rpc:["https://rpc-test.arthera.net"],explorer:{url:"https://explorer-test.arthera.net"},start:10523,logo:"ipfs://QmYQp3e52KjkT4bYdAvB6ACEEpXs2D8DozsDitaADRY2Ak"},13337:{key:"13337",name:"Beam Testnet",shortName:"testnet",chainId:13337,network:"testnet",multicall:"0x9BF49b704EE2A095b95c1f2D4EB9010510c41C9E",rpc:[],explorer:{url:"https://subnets-test.avax.network/beam/"},start:3,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF",testnet:!0},13371:{key:"13371",name:"Immutable zkEVM",shortName:"mainnet",chainId:13371,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.immutable.com"},start:3680945,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi"},13473:{key:"13473",name:"Immutable zkEVM Testnet",shortName:"testnet",chainId:13473,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.testnet.immutable.com"},start:5307209,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi",testnet:!0},16718:{key:"16718",name:"AirDAO",chainId:16718,network:"mainnet",multicall:"0x25e81aC81A8B03389D78CB45faB78353aB528574",rpc:["https://network-archive.ambrosus.io"],ws:["wss://network-archive.ambrosus.io/ws"],explorer:{url:"https://airdao.io/explorer"},start:22922566,logo:"ipfs://QmSxXjvWng3Diz4YwXDV2VqSPgMyzLYBNfkjJcr7rzkxom"},29548:{key:"29548",name:"MCH Verse",shortName:"mainnet",chainId:29548,network:"mainnet",multicall:"0x1d39652386488CE1fE4254E105F5A42a04d43dB2",rpc:[],explorer:{url:"https://explorer.oasys.mycryptoheroes.net"},start:27458402,logo:"ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU"},42161:{key:"42161",name:"Arbitrum One",chainId:42161,network:"Arbitrum mainnet",multicall:"0x7A7443F8c577d537f1d8cD4a629d40a3148Dd7ee",rpc:["https://rpc.ankr.com/arbitrum","https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/arbitrum/mainnet","https://arb-mainnet.g.alchemy.com/v2/JDvtNGwnHhTltIwfnxQocKwKkCTKA1DL"],explorer:{url:"https://arbiscan.io"},start:256508,logo:"ipfs://QmWZ5SMRfvcK8tycsDqojQaSiKedgtVkS7CkZdxPgeCVsZ"},42170:{key:"42170",name:"Arbitrum Nova",chainId:42170,network:"Arbitrum Nova",multicall:"0x4E74EBd9CABff51cE9a43EFe059bA8c5A28E4A14",rpc:["https://nova.arbitrum.io/rpc","https://arbitrum-nova.public.blastapi.io"],explorer:{url:"https://nova.arbiscan.io/"},start:6006607,logo:"ipfs://bafkreie5xsqt3mrrwu7v32qpmmctibhzhgxf4emfzzddsdhdlfsa7fmplu"},42220:{key:"42220",name:"Celo",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo.snapshot.org","https://forno.celo.org","https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:{url:"https://explorer.celo.org"},start:6599803,logo:"ipfs://QmS2tVJ7rdJRe1NHXAi2L86yCbUwVVrmB2mHQeNdJxvQti"},43113:{key:"43113",name:"Avalanche FUJI Testnet",chainId:43113,network:"testnet",testnet:!0,multicall:"0x984476ea55e32e785A9D8FF14329f99D74E3d2A2",rpc:["https://api.avax-test.network/ext/bc/C/rpc"],explorer:{url:"https://testnet.snowtrace.io"},start:10528153,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},43114:{key:"43114",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://nd-784-543-849.p2pify.com/aa7b29fc5fed65b34f0ee6b8de33f8c0/ext/bc/C/rpc","https://rpc.ankr.com/avalanche","https://api.avax.network/ext/bc/C/rpc"],explorer:{url:"https://snowtrace.io"},start:536483,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},47805:{key:"47805",name:"REI Mainnet",chainId:47805,network:"mainnet",multicall:"0x9eE9904815B80C39C1a27294E69a8626EAa7952d",rpc:["https://rpc.rei.network"],explorer:{url:"https://scan.rei.network/"},start:1715902,logo:"ipfs://QmTogMDLmDgJjDjUKDHDuc2KVTVDbXf8bXJLFiVe8PRxgo"},53935:{key:"53935",name:"DFK Chain",chainId:53935,network:"mainnet",multicall:"0x5b24224dC16508DAD755756639E420817DD4c99E",rpc:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"],explorer:{url:"https://subnets.avax.network/defi-kingdoms/"},start:62,logo:"ipfs://QmZNkpVgPbuVbDcsi6arwH1om3456FGnwfDqYQJWUfHDEx"},59141:{key:"59141",name:"Linea Sepolia",shortName:"testnet",chainId:59141,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.lineascan.build/"},start:227427,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce",testnet:!0},59144:{key:"59144",name:"Linea",shortName:"linea",chainId:59144,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://lineascan.build/"},start:42,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce"},80001:{key:"80001",name:"Polygon Mumbai",chainId:80001,network:"testnet",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:{url:"https://mumbai.polygonscan.com",apiUrl:"https://api-mumbai.polygonscan.com"},start:12011090,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},81457:{key:"81457",name:"Blast",shortName:"mainnet",chainId:81457,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://blastscan.io"},start:88189,logo:"ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce"},84532:{key:"84532",name:"Base Sepolia",shortName:"testnet",chainId:84532,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://base-sepolia.blockscout.com/"},start:1059647,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv",testnet:!0},686868:{key:"686868",name:"Merlin Testnet",shortName:"merlin",chainId:686868,network:"testnet",multicall:"0x758BC6321b7c68F4986d62a4D46E83A2DCb58c80",rpc:[],explorer:{url:"https://testnet-scan.merlinchain.io"},start:3562021,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe",testnet:!0},713715:{key:"713715",name:"Sei EVM Devnet",shortName:"devnet",chainId:713715,network:"testnet",multicall:"0xEe8d287B844959ADe40d718Dc23077ba920e2f07",rpc:[],explorer:{url:"https://seitrace.com"},start:1463669,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},810180:{key:"810180",name:"zkLink Nova",shortName:"zlink",chainId:810180,network:"mainnet",multicall:"0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",rpc:[],explorer:{url:"https://explorer.zklink.io"},start:146055,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"},810181:{key:"810181",name:"zkLink Nova Sepolia",shortName:"testnet",chainId:810181,network:"testnet",multicall:"0x97148F8fDdd9A1620f72EC1Bb2932916623d9da5",rpc:[],explorer:{url:"https://sepolia.explorer.zklink.io/"},start:43723,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",testnet:!0},11155111:{key:"11155111",name:"Sepolia testnet",shortName:"Sepolia",chainId:11155111,network:"sepolia",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://sepolia.infura.io/v3/d26b4fd748814fe994b05899fd89e667"],ensResolvers:["0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"],ensNameWrapper:"0x0635513f179D50A207757E05759CbD106d7dFcE8",ensSubgraph:"https://api.studio.thegraph.com/proxy/49574/enssepolia/version/latest",explorer:{url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io"},start:751532,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},11155420:{key:"11155420",name:"OP Sepolia",shortName:"testnet",chainId:11155420,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia-optimism.etherscan.io"},start:1620204,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb",testnet:!0},111557560:{key:"111557560",name:"Cyber Testnet",shortName:"testnet",chainId:111557560,network:"testnet",multicall:"0xffc391F0018269d4758AEA1a144772E8FB99545E",rpc:[],explorer:{url:"https://testnet.cyberscan.co/"},start:304545,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm",testnet:!0},168587773:{key:"168587773",name:"Blast Sepolia",shortName:"testnet",chainId:168587773,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.blastexplorer.io"},start:756690,logo:"ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce",testnet:!0},245022926:{key:"245022926",name:"Neon Devnet",shortName:"devnet",chainId:245022926,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://devnet.neonscan.org/"},start:205206112,logo:"ipfs://QmecRPQGa4bU7tybg1sUQY48Md9rWnmhrT6WW5ueqvhg6P",testnet:!0},1313161554:{key:"1313161554",name:"Aurora",shortName:"Aurora",chainId:1313161554,network:"mainnet",multicall:"0x32b50c286DEFd2932a0247b8bb940b78c063F16c",rpc:["https://mainnet.aurora.dev"],explorer:{url:"https://explorer.mainnet.aurora.dev"},start:57190533,logo:"ipfs://QmeRhsR1UPRTQCizdhmgr2XxphXebVKU5di97uCV2UMFpa"},16666e5:{key:"1666600000",name:"Harmony",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:{url:"https://explorer.harmony.one"},start:10911984,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",testnet:!0,multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:{url:"https://explorer.pops.one"},start:7521509,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"}};class sN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return"number"==typeof t&&void 0!==(null==e?void 0:e[t-1])}getValidVotes(){return this.votes.filter((t=>sN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>{const r=this.getValidVotes().filter((t=>t.choice===e+1));return r.reduce(((t,e)=>t+e.balance),0)}))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>{const r=this.strategies.map(((t,r)=>{const n=this.getValidVotes().filter((t=>t.choice===e+1));return n.reduce(((t,e)=>t+e.scores[r]),0)}));return r}))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices[this.selected-1]}}class aN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size}getValidVotes(){return this.votes.filter((t=>aN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.balance),0)))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.scores[r]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected?this.proposal.choices.filter(((t,e)=>this.selected.includes(e+1))).join(", "):""}}function hN(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function uN(t,e){return Math.sqrt(t*e)}function lN(t){return t*t}function cN(t,e){return t.map((t=>e*t))}class fN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>fN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>{const n=t.map((t=>uN(hN(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return lN(n)}));return cN(r.map(((t,e)=>hN(r[e],r))),e)}getScoresByStrategy(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>this.strategies.map(((e,n)=>t.map((t=>uN(hN(t.choice[r+1],Object.values(t.choice)),t.scores[n]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[lN(t)]))));return r.map(((t,n)=>cN(this.strategies.map(((t,e)=>hN(r[n][e][0],r.flat(2)))),e)))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1]){const r=hN(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function dN(t,e){const r=[...new Set(t.map((t=>t[0])).flat())],n=Object.entries(t.reduce(((t,[e],r,n)=>{const i=n[r][1];t[e[0]][0]+=i;const o=n[r][2];return o.length>1?t[e[0]][1]=o.map(((r,n)=>r+t[e[0]][1][n]||r)):t[e[0]][1]=[t[e[0]][1].concat(o).reduce(((t,e)=>t+e),0)],t}),Object.assign({},...r.map((t=>({[t]:[0,[]]})))))),i=n.map((t=>[t[0],t[1][0]])),[o,s]=i.reduce((([t,e],[r,n])=>n>e?[r,n]:[t,e]),["?",-1/0]),[a,h]=i.reduce((([t,e],[r,n])=>n<e?[r,n]:[t,e]),["?",1/0]),u=n.sort(((t,e)=>e[1][0]-t[1][0])),l=t.map((t=>t[1])).reduce(((t,e)=>t+e),0);return e.push({round:e.length+1,sortedByHighest:u}),s>l/2||u.length<3?e:dN(t.map((t=>[t[0].filter((t=>t!=a)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function pN(t){const e=dN(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class mN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size&&t.length>0&&t.length===e.length}getValidVotes(){return this.votes.filter((t=>mN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=pN(t);return e.choices.map(((t,e)=>r.filter((t=>Number(t[0])===e+1)).reduce(((t,e)=>t+e[1][0]),0)))}(this.getValidVotes(),this.proposal)}getScoresByStrategy(){const t=pN(this.getValidVotes());return this.proposal.choices.map(((e,r)=>this.strategies.map(((e,n)=>t.filter((t=>Number(t[0])===r+1)).reduce(((t,e)=>t+e[1][1][n]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>{if(this.proposal.choices[t-1])return this.proposal.choices[t-1]})).map(((t,e)=>`(${LN(e+1)}) ${t}`)).join(", ")}}function gN(t,e,r){const n=r.reduce(((t,e)=>t+e),0),i=e[t]/n*100;return isNaN(i)?0:i}function yN(t,e,r){return gN(t+1,e,Object.values(e))/100*r}class vN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>vN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>yN(e,t.choice,t.balance))).reduce(((t,e)=>t+e),0))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((e,r)=>gN(r,t,t))).map((t=>e/100*t))}getScoresByStrategy(){const t=this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().map((t=>yN(e,t.choice,t.scores[r]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[t])))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((r,n)=>this.strategies.map(((e,r)=>gN(0,t[n][r],t.flat(2)))).map((t=>[e/100*t])).flat()))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1])return`${Math.round(10*gN(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var wN={"single-choice":sN,approval:aN,quadratic:fN,"ranked-choice":mN,weighted:vN,basic:sN};const bN={1:"https://subgrapher.snapshot.org/delegation/1",10:"https://subgrapher.snapshot.org/delegation/10",56:"https://subgrapher.snapshot.org/delegation/56",100:"https://subgrapher.snapshot.org/delegation/100",137:"https://subgrapher.snapshot.org/delegation/137",250:"https://subgrapher.snapshot.org/delegation/250",42161:"https://subgrapher.snapshot.org/delegation/42161",11155111:"https://subgrapher.snapshot.org/delegation/11155111"},_N=1e3;function EN(t){return t.length===_N&&t[0].timestamp===t[t.length-1].timestamp}function AN(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function kN(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function MN(t){return e(this,arguments,void 0,(function*({url:t,spaces:e,pivot:r,snapshot:n}){const i={delegations:{__args:{where:{space_in:e,timestamp_gte:r},first:_N,skip:0,orderBy:"timestamp",orderDirection:"asc"},delegator:!0,space:!0,delegate:!0,timestamp:!0}};return"latest"!==n&&(i.delegations.__args.block={number:n}),(yield BN(t,i)).delegations||[]}))}const xN=["function text(bytes32 node, string calldata key) external view returns (string memory)"],SN={Accept:"application/json","Content-Type":"application/json"},NN="https://score.snapshot.org";function IN(t=NN,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const n=r.searchParams.get("apiKey");let i=Object.assign({},SN);return n&&(r.searchParams.delete("apiKey"),i=Object.assign(Object.assign({},SN),{"X-API-KEY":n})),{url:r.toString(),headers:i}}function CN(t){return e(this,void 0,void 0,(function*(){let e=yield t.text();try{e=JSON.parse(e)}catch(r){return Promise.reject({code:t.status||500,message:"Failed to parse response from score API",data:e})}return e.error?Promise.reject(e.error):e}))}const TN=new Ef({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});xf(TN),Nf(TN),TN.addFormat("address",{validate:t=>{try{return Re(t)}catch(t){return!1}}}),TN.addFormat("starknetAddress",{validate:t=>{try{return HN(t)}catch(t){return!1}}}),TN.addFormat("long",{validate:()=>!0}),TN.addFormat("ethValue",{validate:t=>{if(!t.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/))return!1;try{return function(t,e){if("string"!=typeof t&&Ya.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Wa.indexOf(e);-1!==t&&(e=3*t)}Ga(t,null!=e?e:18)}(t,18),!0}catch(t){return!1}}});const PN=Object.keys(oN),RN=Object.keys(oN).filter((t=>!oN[t].testnet));function ON(t,r,n,i){return e(this,void 0,void 0,(function*(){const e=new sa(n[0],r,t);try{const t=n[2]||[];return yield e[n[1]](...t,i||{})}catch(t){return Promise.reject(t)}}))}function $N(t,r,n,i,o){return e(this,void 0,void 0,(function*(){const e=(null==o?void 0:o.multicallAddress)||oN[t].multicall,s=new sa(e,["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"],r),a=new Yn(n);try{const t=(null==o?void 0:o.limit)||500;(null==o?void 0:o.limit)&&delete o.limit;const e=Math.ceil(i.length/t),r=[];Array.from(Array(e)).forEach(((e,n)=>{const h=i.slice(t*n,t*(n+1));r.push(s.aggregate(h.map((t=>[t[0].toLowerCase(),a.encodeFunctionData(t[1],t[2])])),o||{}))}));let n=yield Promise.all(r);return n=n.reduce(((t,[,e])=>t.concat(e)),[]),n.map(((t,e)=>a.decodeFunctionResult(i[e][1],t)))}catch(t){return Promise.reject(t)}}))}function BN(t,r){return e(this,arguments,void 0,(function*(t,e,r={}){const n=yield a(t,{method:"POST",headers:Object.assign({Accept:"application/json","Content-Type":"application/json"},null==r?void 0:r.headers),body:JSON.stringify({query:Ku.jsonToGraphQLQuery({query:e})})});let i=yield n.text();try{i=JSON.parse(i)}catch(e){throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${i.substring(0,400)}`)}if(i.errors)throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${JSON.stringify(i.errors).substring(0,400)}`);const{data:o}=i;return o||{}}))}function DN(t,e=iN[0]){const r=`https://${e}`;if(!t)return null;if(!(t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("https://")||t.startsWith("http://")))return`${r}/ipfs/${t}`;const n=t.split("://")[0];return"ipfs"===n?t.replace("ipfs://",`${r}/ipfs/`):"ipns"===n?t.replace("ipns://",`${r}/ipns/`):t}function FN(r,n){return e(this,arguments,void 0,(function*(e,r,n="1",i={}){const{ensResolvers:o,broviderUrl:s}=i,a=t(i,["ensResolvers","broviderUrl"]),h=o||oN[n].ensResolvers||oN[1].ensResolvers,u=du(fu(e)),l=cm(n,{broviderUrl:s});return(yield $N(n,l,xN,h.map((t=>[t,"text",[u,r]])),a)).flat().find((t=>t))||""}))}function UN(t){return e(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield FN(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function jN(t){return e(this,arguments,void 0,(function*(t,e="1",r={}){const n=cm(e,r),i=new sa("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",["function owner(bytes32) view returns (address)"],n),o=r.ensNameWrapper||oN[e].ensNameWrapper,s=du(fu(t));let a=yield i.owner(s);if(a===o){const t=new sa(o,["function ownerOf(uint256) view returns (address)"],n);a=yield t.ownerOf(s)}return a}))}function LN(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function zN(t){return!!oN[t]}function qN(t){return Re(t)&&"0x0000000000000000000000000000000000000000"!==t}function VN(t,e){return"latest"===t||"number"==typeof t&&t>=oN[e].start}function HN(t){if(!t)return!1;try{return NS(t),!0}catch(t){return!1}}function GN(t){return Re(t)}function KN(t){return Promise.reject(new Error(t))}TN.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?RN.includes(e):PN.includes(e)},error:{message:"network not allowed"}}),TN.addKeyword({keyword:"maxLengthWithSpaceType",validate:function t(e,r){const n=this.spaceType||"default",i=r.length<=e[n];return i||(t.errors=[{keyword:"maxLengthWithSpaceType",message:`must NOT have more than ${e[n]} characters`,params:{limit:e[n]}}]),i},errors:!0}),TN.addKeyword({keyword:"maxItemsWithSpaceType",validate:function t(e,r){const n=this.spaceType||"default",i=r.length<=e[n];return i||(t.errors=[{keyword:"maxItemsWithSpaceType",message:`must NOT have more than ${e[n]} items`,params:{limit:e[n]}}]),i},errors:!0}),TN.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))});var ZN={call:ON,multicall:$N,subgraphRequest:BN,ipfsGet:function(t,r){return e(this,arguments,void 0,(function*(t,e,r="ipfs"){return a(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:DN,getJSON:function(t){return e(this,arguments,void 0,(function*(t,e={}){const r=DN(t,e.gateways);return a(r).then((t=>t.json()))}))},sendTransaction:function(t,r,n,i,o){return e(this,arguments,void 0,(function*(t,e,r,n,i,o={}){const s=t.getSigner(),a=new sa(e,r,t).connect(s);return yield a[n](...i,o)}))},getScores:function(t,r,n,i){return e(this,arguments,void 0,(function*(t,e,r,n,i="latest",o=NN,s={}){if(!Array.isArray(n))return KN("addresses should be an array of addresses");if(0===n.length)return KN("addresses can not be empty");const h=n.find((t=>!qN(t)));if(h)return KN(`Invalid address: ${h}`);if(!zN(r))return KN(`Invalid network: ${r}`);const u=e.find((t=>t.network&&!zN(t.network)));if(u)return KN(`Invalid network (${u.network}) in strategy ${u.name}`);if(!VN(i,r))return KN(`Snapshot (${i}) must be 'latest' or greater than network start block (${oN[r].start})`);new URL(o).pathname="/api/scores";const{url:l,headers:c}=IN(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:i,strategies:e,addresses:n},h=yield a(l,{method:"POST",headers:c,body:JSON.stringify({params:o})}),u=yield CN(h);return"all"===s.returnValue?u.result:u.result[s.returnValue||"scores"]}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},getVp:function(t,r,n,i,o,s,h){return e(this,void 0,void 0,(function*(){const{url:e,headers:u}=IN(null==h?void 0:h.url);if(!qN(t))return KN(`Invalid voter address: ${t}`);if(!zN(r))return KN(`Invalid network: ${r}`);const l=n.find((t=>t.network&&!zN(t.network)));if(l)return KN(`Invalid network (${l.network}) in strategy ${l.name}`);if(!VN(i,r))return KN(`Snapshot (${i}) must be 'latest' or greater than network start block (${oN[r].start})`);const c={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"get_vp",params:{address:t,network:r,strategies:n,snapshot:i,space:o,delegation:s}})};try{const t=yield a(e,c);return(yield CN(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},validateSchema:function(t,e,r={snapshotEnv:"default",spaceType:"default"}){const n=TN.compile(t),i=n.call(r,e);return i||n.errors},getEnsTextRecord:FN,getSpaceUri:UN,getEnsOwner:jN,getSpaceController:function(t){return e(this,arguments,void 0,(function*(t,e="1",r={}){const n=yield UN(t,e,r);if(n){let t=Re(n);if(t)return n;const e=n.split("/"),r=e.includes("testnet")?5:4,i=e[r];if(t=Re(i),t)return i}return yield jN(t,e,r)}))},getDelegatesBySpace:function(t,r){return e(this,arguments,void 0,(function*(t,e,r="latest",n={}){const i=n.subgraphUrl||bN[t];if(!i)return Promise.reject(`Delegation subgraph not available for network ${t}`);let o=0;const s=new Map,a=kN(e);for(;;){const t=yield MN({url:i,spaces:a,pivot:o,snapshot:r});if(EN(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{AN(s,t),o=t.timestamp})),t.length<_N)break}return[...s.values()]}))},clone:function(t){return JSON.parse(JSON.stringify(t))},sleep:function(t){return e(this,void 0,void 0,(function*(){return new Promise((e=>{setTimeout(e,t)}))}))},getNumberWithOrdinal:LN,voting:wN,getProvider:cm,signMessage:function(t,r,n){return e(this,void 0,void 0,(function*(){return r=I(new Buffer(r,"utf8")),yield t.send("personal_sign",[r,n])}))},getBlockNumber:function(t){return e(this,void 0,void 0,(function*(){try{const e=yield t.getBlockNumber();return parseInt(e)}catch(t){return Promise.reject()}}))},Multicaller:class{constructor(t,e,r,n){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=n||{}}call(t,e,r,n){return this.calls.push([e,r,n]),this.paths.push(t),this}execute(t){return e(this,void 0,void 0,(function*(){const e=t||{};return(yield $N(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>_d(e,this.paths[r],t.length>1?t:t[0]))),this.calls=[],this.paths=[],e}))}},getSnapshots:function(t,r,n,i){return e(this,arguments,void 0,(function*(t,e,r,n,i={}){const o={};if(n.forEach((t=>o[t]="latest")),"latest"===e)return o;const s=`${t}-${e}-${n.join("-")}`,a=Ed[s],h=Date.now();if(a&&Ad>h)return a;Ad<h&&(Ed={},Ad=h+36e5-h%36e5),o[t]=e;const u=Object.keys(o).filter((e=>t!==e));if(0===u.length)return o;const l={blocks:{__args:{where:{ts:(yield r.getBlock(e)).timestamp,network_in:u}},network:!0,number:!0}},c=i.blockFinderUrl||"https://blockfinder.snapshot.org";return(yield BN(c,l)).blocks.forEach((t=>o[t.network]=t.number)),Ed[s]=o,o}))},getHash:function(t,e){return(PS(t)?OS:nN).getHash(t,e)},verify:function(t,r,n){return e(this,arguments,void 0,(function*(t,e,r,n="1",i={}){if(!HN(t)&&!GN(t))throw new Error("Invalid address");const o=PS(r)?OS:nN;return yield o.default(t,e,r,n,i)}))},validate:function(t,r,n,i,o,s,h){return e(this,void 0,void 0,(function*(){if(!qN(r))return KN(`Invalid author: ${r}`);if(!zN(i))return KN(`Invalid network: ${i}`);if(!VN(o,i))return KN(`Snapshot (${o}) must be 'latest' or greater than network start block (${oN[i].start})`);h||(h={});const{url:e,headers:u}=IN(h.url),l={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"validate",params:{validation:t,author:r,space:n,network:i,snapshot:o,params:s}})};try{const t=yield a(e,l);return(yield CN(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:HN,isEvmAddress:GN,getFormattedAddress:function(t,e){if("evm"===e&&GN(t))return Pe(t);if("starknet"===e&&HN(t))return NS(t);throw new Error(`Invalid address: ${t}`)},SNAPSHOT_SUBGRAPH_URL:bN};return{Client:or,Client712:or,schemas:dr,utils:ZN}}));
|
|
32
|
+
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */(r);return o("function"==typeof e?e.call({"":t},"",t):t,"");function o(t,s){if(Array.isArray(n)){var a=n.find((function(e){return e.test(t)}));if(a){var h=a.stringify(t);if("string"!=typeof h||!iv(h))throw new Error("Invalid JSON number: output of a number stringifier must be a string containing a JSON number "+"(output: ".concat(h,")"));return h}}return"boolean"==typeof t||"number"==typeof t||"string"==typeof t||null===t||t instanceof Date||t instanceof Boolean||t instanceof Number||t instanceof String?JSON.stringify(t):t&&t.isLosslessNumber||"bigint"==typeof t?t.toString():Array.isArray(t)?function(t,r){if(0===t.length)return"[]";for(var n=i?r+i:void 0,s=i?"[\n":"[",a=0;a<t.length;a++){var h="function"==typeof e?e.call(t,String(a),t[a]):t[a];i&&(s+=n),s+=void 0!==h&&"function"!=typeof h?o(h,n):"null",a<t.length-1&&(s+=i?",\n":",")}return s+=i?"\n"+r+"]":"]"}(t,s):t&&"object"===iw(t)?function(t,n){if("function"==typeof t.toJSON)return ow(t.toJSON(),e,r,void 0);var s=Array.isArray(e)?e.map(String):Object.keys(t);if(0===s.length)return"{}";var a=i?n+i:void 0,h=!0,u=i?"{\n":"{";return s.forEach((function(r){var n="function"==typeof e?e.call(t,r,t[r]):t[r];if(function(t,e){return void 0!==e&&"function"!=typeof e&&"symbol"!==iw(e)}(0,n)){h?h=!1:u+=i?",\n":",";var s=JSON.stringify(r);u+=i?a+s+": ":s+":",u+=o(n,a)}})),u+=i?"\n"+n+"}":"}"}(t,s):void 0}}function sw(t){let e=t.length;for(;--e>=0;)t[e]=0}const aw=256,hw=286,uw=30,lw=15,cw=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),fw=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),dw=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),pw=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mw=new Array(576);sw(mw);const gw=new Array(60);sw(gw);const yw=new Array(512);sw(yw);const vw=new Array(256);sw(vw);const ww=new Array(29);sw(ww);const bw=new Array(uw);function _w(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}let Ew,Aw,kw;function Mw(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}sw(bw);const xw=t=>t<256?yw[t]:yw[256+(t>>>7)],Sw=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Nw=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,Sw(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Iw=(t,e,r)=>{Nw(t,r[2*e],r[2*e+1])},Cw=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},Tw=(t,e,r)=>{const n=new Array(16);let i,o,s=0;for(i=1;i<=lw;i++)s=s+r[i-1]<<1,n[i]=s;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=Cw(n[e]++,e))}},Pw=t=>{let e;for(e=0;e<hw;e++)t.dyn_ltree[2*e]=0;for(e=0;e<uw;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Rw=t=>{t.bi_valid>8?Sw(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Ow=(t,e,r,n)=>{const i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]},$w=(t,e,r)=>{const n=t.heap[r];let i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&Ow(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Ow(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},Bw=(t,e,r)=>{let n,i,o,s,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,i=t.pending_buf[t.sym_buf+a++],0===n?Iw(t,i,e):(o=vw[i],Iw(t,o+aw+1,e),s=cw[o],0!==s&&(i-=ww[o],Nw(t,i,s)),n--,o=xw(n),Iw(t,o,r),s=fw[o],0!==s&&(n-=bw[o],Nw(t,n,s)))}while(a<t.sym_next);Iw(t,256,e)},Dw=(t,e)=>{const r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let s,a,h,u=-1;for(t.heap_len=0,t.heap_max=573,s=0;s<o;s++)0!==r[2*s]?(t.heap[++t.heap_len]=u=s,t.depth[s]=0):r[2*s+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=u<2?++u:0,r[2*h]=1,t.depth[h]=0,t.opt_len--,i&&(t.static_len-=n[2*h+1]);for(e.max_code=u,s=t.heap_len>>1;s>=1;s--)$w(t,r,s);h=o;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],$w(t,r,1),a=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=a,r[2*h]=r[2*s]+r[2*a],t.depth[h]=(t.depth[s]>=t.depth[a]?t.depth[s]:t.depth[a])+1,r[2*s+1]=r[2*a+1]=h,t.heap[1]=h++,$w(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,h=e.stat_desc.max_length;let u,l,c,f,d,p,m=0;for(f=0;f<=lw;f++)t.bl_count[f]=0;for(r[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)l=t.heap[u],f=r[2*r[2*l+1]+1]+1,f>h&&(f=h,m++),r[2*l+1]=f,l>n||(t.bl_count[f]++,d=0,l>=a&&(d=s[l-a]),p=r[2*l],t.opt_len+=p*(f+d),o&&(t.static_len+=p*(i[2*l+1]+d)));if(0!==m){do{for(f=h-1;0===t.bl_count[f];)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[h]--,m-=2}while(m>0);for(f=h;0!==f;f--)for(l=t.bl_count[f];0!==l;)c=t.heap[--u],c>n||(r[2*c+1]!==f&&(t.opt_len+=(f-r[2*c+1])*r[2*c],r[2*c+1]=f),l--)}})(t,e),Tw(r,u,t.bl_count)},Fw=(t,e,r)=>{let n,i,o=-1,s=e[1],a=0,h=7,u=4;for(0===s&&(h=138,u=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=e[2*(n+1)+1],++a<h&&i===s||(a<u?t.bl_tree[2*i]+=a:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,a=0,o=i,0===s?(h=138,u=3):i===s?(h=6,u=3):(h=7,u=4))},Uw=(t,e,r)=>{let n,i,o=-1,s=e[1],a=0,h=7,u=4;for(0===s&&(h=138,u=3),n=0;n<=r;n++)if(i=s,s=e[2*(n+1)+1],!(++a<h&&i===s)){if(a<u)do{Iw(t,i,t.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(Iw(t,i,t.bl_tree),a--),Iw(t,16,t.bl_tree),Nw(t,a-3,2)):a<=10?(Iw(t,17,t.bl_tree),Nw(t,a-3,3)):(Iw(t,18,t.bl_tree),Nw(t,a-11,7));a=0,o=i,0===s?(h=138,u=3):i===s?(h=6,u=3):(h=7,u=4)}};let jw=!1;const Lw=(t,e,r,n)=>{Nw(t,0+(n?1:0),3),Rw(t),Sw(t,r),Sw(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r};var zw=t=>{jw||((()=>{let t,e,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(ww[n]=r,t=0;t<1<<cw[n];t++)vw[r++]=n;for(vw[r-1]=n,i=0,n=0;n<16;n++)for(bw[n]=i,t=0;t<1<<fw[n];t++)yw[i++]=n;for(i>>=7;n<uw;n++)for(bw[n]=i<<7,t=0;t<1<<fw[n]-7;t++)yw[256+i++]=n;for(e=0;e<=lw;e++)o[e]=0;for(t=0;t<=143;)mw[2*t+1]=8,t++,o[8]++;for(;t<=255;)mw[2*t+1]=9,t++,o[9]++;for(;t<=279;)mw[2*t+1]=7,t++,o[7]++;for(;t<=287;)mw[2*t+1]=8,t++,o[8]++;for(Tw(mw,287,o),t=0;t<uw;t++)gw[2*t+1]=5,gw[2*t]=Cw(t,5);Ew=new _w(mw,cw,257,hw,lw),Aw=new _w(gw,fw,0,uw,lw),kw=new _w(new Array(0),dw,0,19,7)})(),jw=!0),t.l_desc=new Mw(t.dyn_ltree,Ew),t.d_desc=new Mw(t.dyn_dtree,Aw),t.bl_desc=new Mw(t.bl_tree,kw),t.bi_buf=0,t.bi_valid=0,Pw(t)},qw=(t,e,r,n)=>{let i,o,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<aw;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Dw(t,t.l_desc),Dw(t,t.d_desc),s=(t=>{let e;for(Fw(t,t.dyn_ltree,t.l_desc.max_code),Fw(t,t.dyn_dtree,t.d_desc.max_code),Dw(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*pw[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?Lw(t,e,r,n):4===t.strategy||o===i?(Nw(t,2+(n?1:0),3),Bw(t,mw,gw)):(Nw(t,4+(n?1:0),3),((t,e,r,n)=>{let i;for(Nw(t,e-257,5),Nw(t,r-1,5),Nw(t,n-4,4),i=0;i<n;i++)Nw(t,t.bl_tree[2*pw[i]+1],3);Uw(t,t.dyn_ltree,e-1),Uw(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Bw(t,t.dyn_ltree,t.dyn_dtree)),Pw(t),n&&Rw(t)},Vw=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(vw[r]+aw+1)]++,t.dyn_dtree[2*xw(e)]++),t.sym_next===t.sym_end),Hw=t=>{Nw(t,2,3),Iw(t,256,mw),(t=>{16===t.bi_valid?(Sw(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)},Gw={_tr_init:zw,_tr_stored_block:Lw,_tr_flush_block:qw,_tr_tally:Vw,_tr_align:Hw};var Kw=(t,e,r,n)=>{let i=65535&t|0,o=t>>>16&65535|0,s=0;for(;0!==r;){s=r>2e3?2e3:r,r-=s;do{i=i+e[n++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const Zw=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})());var Jw=(t,e,r,n)=>{const i=Zw,o=n+r;t^=-1;for(let r=n;r<o;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},Qw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Yw={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ww,_tr_stored_block:Xw,_tr_flush_block:tb,_tr_tally:eb,_tr_align:rb}=Gw,{Z_NO_FLUSH:nb,Z_PARTIAL_FLUSH:ib,Z_FULL_FLUSH:ob,Z_FINISH:sb,Z_BLOCK:ab,Z_OK:hb,Z_STREAM_END:ub,Z_STREAM_ERROR:lb,Z_DATA_ERROR:cb,Z_BUF_ERROR:fb,Z_DEFAULT_COMPRESSION:db,Z_FILTERED:pb,Z_HUFFMAN_ONLY:mb,Z_RLE:gb,Z_FIXED:yb,Z_DEFAULT_STRATEGY:vb,Z_UNKNOWN:wb,Z_DEFLATED:bb}=Yw,_b=258,Eb=262,Ab=42,kb=113,Mb=666,xb=(t,e)=>(t.msg=Qw[e],e),Sb=t=>2*t-(t>4?9:0),Nb=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Ib=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do{r=t.head[--n],t.head[n]=r>=i?r-i:0}while(--e);e=i,n=e;do{r=t.prev[--n],t.prev[n]=r>=i?r-i:0}while(--e)};let Cb=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const Tb=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},Pb=(t,e)=>{tb(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Tb(t.strm)},Rb=(t,e)=>{t.pending_buf[t.pending++]=e},Ob=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},$b=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),1===t.state.wrap?t.adler=Kw(t.adler,e,i,r):2===t.state.wrap&&(t.adler=Jw(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},Bb=(t,e)=>{let r,n,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match;const h=t.strstart>t.w_size-Eb?t.strstart-(t.w_size-Eb):0,u=t.window,l=t.w_mask,c=t.prev,f=t.strstart+_b;let d=u[o+s-1],p=u[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(r=e,u[r+s]===p&&u[r+s-1]===d&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<f);if(n=_b-(f-o),o=f-_b,n>s){if(t.match_start=e,s=n,n>=a)break;d=u[o+s-1],p=u[o+s]}}}while((e=c[e&l])>h&&0!=--i);return s<=t.lookahead?s:t.lookahead},Db=t=>{const e=t.w_size;let r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Eb)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Ib(t),n+=e),0===t.strm.avail_in)break;if(r=$b(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Cb(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Cb(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Eb&&0!==t.strm.avail_in)},Fb=(t,e)=>{let r,n,i,o=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,s=0,a=t.strm.avail_in;do{if(r=65535,i=t.bi_valid+42>>3,t.strm.avail_out<i)break;if(i=t.strm.avail_out-i,n=t.strstart-t.block_start,r>n+t.strm.avail_in&&(r=n+t.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&e!==sb||e===nb||r!==n+t.strm.avail_in))break;s=e===sb&&r===n+t.strm.avail_in?1:0,Xw(t,0,0,s),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,Tb(t.strm),n&&(n>r&&(n=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,r-=n),r&&($b(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===s);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),s?4:e!==nb&&e!==sb&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(i=t.window_size-t.strstart,t.strm.avail_in>i&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&($b(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water<t.strstart&&(t.high_water=t.strstart),i=t.bi_valid+42>>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,o=i>t.w_size?t.w_size:i,n=t.strstart-t.block_start,(n>=o||(n||e===sb)&&e!==nb&&0===t.strm.avail_in&&n<=i)&&(r=n>i?i:n,s=e===sb&&0===t.strm.avail_in&&r===n?1:0,Xw(t,t.block_start,r,s),t.block_start+=r,Tb(t.strm)),s?3:1)},Ub=(t,e)=>{let r,n;for(;;){if(t.lookahead<Eb){if(Db(t),t.lookahead<Eb&&e===nb)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-Eb&&(t.match_length=Bb(t,r)),t.match_length>=3)if(n=eb(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+1]);else n=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Pb(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2},jb=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<Eb){if(Db(t),t.lookahead<Eb&&e===nb)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Eb&&(t.match_length=Bb(t,r),t.match_length<=5&&(t.strategy===pb||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=eb(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=Cb(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Pb(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=eb(t,0,t.window[t.strstart-1]),n&&Pb(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=eb(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2};function Lb(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}const zb=[new Lb(0,0,0,0,Fb),new Lb(4,4,8,4,Ub),new Lb(4,5,16,8,Ub),new Lb(4,6,32,32,Ub),new Lb(4,4,16,16,jb),new Lb(8,16,32,32,jb),new Lb(8,16,128,128,jb),new Lb(8,32,128,256,jb),new Lb(32,128,258,1024,jb),new Lb(32,258,258,4096,jb)];function qb(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=bb,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Nb(this.dyn_ltree),Nb(this.dyn_dtree),Nb(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Nb(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Nb(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Vb=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ab&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==kb&&e.status!==Mb?1:0},Hb=t=>{if(Vb(t))return xb(t,lb);t.total_in=t.total_out=0,t.data_type=wb;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ab:kb,t.adler=2===e.wrap?0:1,e.last_flush=-2,Ww(e),hb},Gb=t=>{const e=Hb(t);return e===hb&&(t=>{t.window_size=2*t.w_size,Nb(t.head),t.max_lazy_match=zb[t.level].max_lazy,t.good_match=zb[t.level].good_length,t.nice_match=zb[t.level].nice_length,t.max_chain_length=zb[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0})(t.state),e},Kb=(t,e,r,n,i,o)=>{if(!t)return lb;let s=1;if(e===db&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||r!==bb||n<8||n>15||e<0||e>9||o<0||o>yb||8===n&&1!==s)return xb(t,lb);8===n&&(n=9);const a=new qb;return t.state=a,a.strm=t,a.status=Ab,a.wrap=s,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=e,a.strategy=o,a.method=r,Gb(t)};var Zb=(t,e)=>{if(Vb(t)||e>ab||e<0)return t?xb(t,lb):lb;const r=t.state;if(!t.output||0!==t.avail_in&&!t.input||r.status===Mb&&e!==sb)return xb(t,0===t.avail_out?fb:lb);const n=r.last_flush;if(r.last_flush=e,0!==r.pending){if(Tb(t),0===t.avail_out)return r.last_flush=-1,hb}else if(0===t.avail_in&&Sb(e)<=Sb(n)&&e!==sb)return xb(t,fb);if(r.status===Mb&&0!==t.avail_in)return xb(t,fb);if(r.status===Ab&&0===r.wrap&&(r.status=kb),r.status===Ab){let e=bb+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=mb||r.level<2?0:r.level<6?1:6===r.level?2:3,e|=n<<6,0!==r.strstart&&(e|=32),e+=31-e%31,Ob(r,e),0!==r.strstart&&(Ob(r,t.adler>>>16),Ob(r,65535&t.adler)),t.adler=1,r.status=kb,Tb(t),0!==r.pending)return r.last_flush=-1,hb}if(57===r.status)if(t.adler=0,Rb(r,31),Rb(r,139),Rb(r,8),r.gzhead)Rb(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Rb(r,255&r.gzhead.time),Rb(r,r.gzhead.time>>8&255),Rb(r,r.gzhead.time>>16&255),Rb(r,r.gzhead.time>>24&255),Rb(r,9===r.level?2:r.strategy>=mb||r.level<2?4:0),Rb(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Rb(r,255&r.gzhead.extra.length),Rb(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Jw(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Rb(r,0),Rb(r,0),Rb(r,0),Rb(r,0),Rb(r,0),Rb(r,9===r.level?2:r.strategy>=mb||r.level<2?4:0),Rb(r,3),r.status=kb,Tb(t),0!==r.pending)return r.last_flush=-1,hb;if(69===r.status){if(r.gzhead.extra){let e=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>e&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex+=i,Tb(t),0!==r.pending)return r.last_flush=-1,hb;e=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>e&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n)),Tb(t),0!==r.pending)return r.last_flush=-1,hb;n=0}e=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Rb(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n)),Tb(t),0!==r.pending)return r.last_flush=-1,hb;n=0}e=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Rb(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Jw(t.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Tb(t),0!==r.pending))return r.last_flush=-1,hb;Rb(r,255&t.adler),Rb(r,t.adler>>8&255),t.adler=0}if(r.status=kb,Tb(t),0!==r.pending)return r.last_flush=-1,hb}if(0!==t.avail_in||0!==r.lookahead||e!==nb&&r.status!==Mb){let n=0===r.level?Fb(r,e):r.strategy===mb?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(Db(t),0===t.lookahead)){if(e===nb)return 1;break}if(t.match_length=0,r=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Pb(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2})(r,e):r.strategy===gb?((t,e)=>{let r,n,i,o;const s=t.window;for(;;){if(t.lookahead<=_b){if(Db(t),t.lookahead<=_b&&e===nb)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){o=t.strstart+_b;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<o);t.match_length=_b-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=eb(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Pb(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===sb?(Pb(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Pb(t,!1),0===t.strm.avail_out)?1:2})(r,e):zb[r.level].func(r,e);if(3!==n&&4!==n||(r.status=Mb),1===n||3===n)return 0===t.avail_out&&(r.last_flush=-1),hb;if(2===n&&(e===ib?rb(r):e!==ab&&(Xw(r,0,0,!1),e===ob&&(Nb(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Tb(t),0===t.avail_out))return r.last_flush=-1,hb}return e!==sb?hb:r.wrap<=0?ub:(2===r.wrap?(Rb(r,255&t.adler),Rb(r,t.adler>>8&255),Rb(r,t.adler>>16&255),Rb(r,t.adler>>24&255),Rb(r,255&t.total_in),Rb(r,t.total_in>>8&255),Rb(r,t.total_in>>16&255),Rb(r,t.total_in>>24&255)):(Ob(r,t.adler>>>16),Ob(r,65535&t.adler)),Tb(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?hb:ub)},Jb=(t,e)=>{let r=e.length;if(Vb(t))return lb;const n=t.state,i=n.wrap;if(2===i||1===i&&n.status!==Ab||n.lookahead)return lb;if(1===i&&(t.adler=Kw(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){0===i&&(Nb(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(r-n.w_size,r),0),e=t,r=n.w_size}const o=t.avail_in,s=t.next_in,a=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Db(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=Cb(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Db(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=s,t.input=a,t.avail_in=o,n.wrap=i,hb},Qb={deflateInit:(t,e)=>Kb(t,e,bb,15,8,vb),deflateInit2:Kb,deflateReset:Gb,deflateResetKeep:Hb,deflateSetHeader:(t,e)=>Vb(t)||2!==t.state.wrap?lb:(t.state.gzhead=e,hb),deflate:Zb,deflateEnd:t=>{if(Vb(t))return lb;const e=t.state.status;return t.state=null,e===kb?xb(t,cb):hb},deflateSetDictionary:Jb,deflateInfo:"pako deflate (from Nodeca project)"};const Yb=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Wb=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const e in r)Yb(r,e)&&(t[e]=r[e])}}return t},Xb=t=>{let e=0;for(let r=0,n=t.length;r<n;r++)e+=t[r].length;const r=new Uint8Array(e);for(let e=0,n=0,i=t.length;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r};let t_=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){t_=!1}const e_=new Uint8Array(256);for(let t=0;t<256;t++)e_[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;e_[254]=e_[254]=1;var r_=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,n,i,o,s=t.length,a=0;for(i=0;i<s;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),a+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(a),o=0,i=0;o<a;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[o++]=r:r<2048?(e[o++]=192|r>>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},n_=(t,e)=>{const r=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let e=t[n++];if(e<128){o[i++]=e;continue}let s=e_[e];if(s>4)o[i++]=65533,n+=s-1;else{for(e&=2===s?31:3===s?15:7;s>1&&n<r;)e=e<<6|63&t[n++],s--;s>1?o[i++]=65533:e<65536?o[i++]=e:(e-=65536,o[i++]=55296|e>>10&1023,o[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&t_)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r})(o,i)},i_=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+e_[t[r]]>e?r:e};var o_=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const s_=Object.prototype.toString,{Z_NO_FLUSH:a_,Z_SYNC_FLUSH:h_,Z_FULL_FLUSH:u_,Z_FINISH:l_,Z_OK:c_,Z_STREAM_END:f_,Z_DEFAULT_COMPRESSION:d_,Z_DEFAULT_STRATEGY:p_,Z_DEFLATED:m_}=Yw;function g_(t){this.options=Wb({level:d_,method:m_,chunkSize:16384,windowBits:15,memLevel:8,strategy:p_},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o_,this.strm.avail_out=0;let r=Qb.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==c_)throw new Error(Qw[r]);if(e.header&&Qb.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?r_(e.dictionary):"[object ArrayBuffer]"===s_.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=Qb.deflateSetDictionary(this.strm,t),r!==c_)throw new Error(Qw[r]);this._dict_set=!0}}function y_(t,e){const r=new g_(e);if(r.push(t,!0),r.err)throw r.msg||Qw[r.err];return r.result}g_.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?l_:a_,"string"==typeof t?r.input=r_(t):"[object ArrayBuffer]"===s_.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===h_||o===u_)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=Qb.deflate(r,o),i===f_)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Qb.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===c_;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},g_.prototype.onData=function(t){this.chunks.push(t)},g_.prototype.onEnd=function(t){t===c_&&(this.result=Xb(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var v_={Deflate:g_,deflate:y_,deflateRaw:function(t,e){return(e=e||{}).raw=!0,y_(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,y_(t,e)},constants:Yw};const w_=16209;var b_=function(t,e){let r,n,i,o,s,a,h,u,l,c,f,d,p,m,g,y,v,w,b,_,E,A,k,M;const x=t.state;r=t.next_in,k=t.input,n=r+(t.avail_in-5),i=t.next_out,M=t.output,o=i-(e-t.avail_out),s=i+(t.avail_out-257),a=x.dmax,h=x.wsize,u=x.whave,l=x.wnext,c=x.window,f=x.hold,d=x.bits,p=x.lencode,m=x.distcode,g=(1<<x.lenbits)-1,y=(1<<x.distbits)-1;t:do{d<15&&(f+=k[r++]<<d,d+=8,f+=k[r++]<<d,d+=8),v=p[f&g];e:for(;;){if(w=v>>>24,f>>>=w,d-=w,w=v>>>16&255,0===w)M[i++]=65535&v;else{if(!(16&w)){if(0==(64&w)){v=p[(65535&v)+(f&(1<<w)-1)];continue e}if(32&w){x.mode=16191;break t}t.msg="invalid literal/length code",x.mode=w_;break t}b=65535&v,w&=15,w&&(d<w&&(f+=k[r++]<<d,d+=8),b+=f&(1<<w)-1,f>>>=w,d-=w),d<15&&(f+=k[r++]<<d,d+=8,f+=k[r++]<<d,d+=8),v=m[f&y];r:for(;;){if(w=v>>>24,f>>>=w,d-=w,w=v>>>16&255,!(16&w)){if(0==(64&w)){v=m[(65535&v)+(f&(1<<w)-1)];continue r}t.msg="invalid distance code",x.mode=w_;break t}if(_=65535&v,w&=15,d<w&&(f+=k[r++]<<d,d+=8,d<w&&(f+=k[r++]<<d,d+=8)),_+=f&(1<<w)-1,_>a){t.msg="invalid distance too far back",x.mode=w_;break t}if(f>>>=w,d-=w,w=i-o,_>w){if(w=_-w,w>u&&x.sane){t.msg="invalid distance too far back",x.mode=w_;break t}if(E=0,A=c,0===l){if(E+=h-w,w<b){b-=w;do{M[i++]=c[E++]}while(--w);E=i-_,A=M}}else if(l<w){if(E+=h+l-w,w-=l,w<b){b-=w;do{M[i++]=c[E++]}while(--w);if(E=0,l<b){w=l,b-=w;do{M[i++]=c[E++]}while(--w);E=i-_,A=M}}}else if(E+=l-w,w<b){b-=w;do{M[i++]=c[E++]}while(--w);E=i-_,A=M}for(;b>2;)M[i++]=A[E++],M[i++]=A[E++],M[i++]=A[E++],b-=3;b&&(M[i++]=A[E++],b>1&&(M[i++]=A[E++]))}else{E=i-_;do{M[i++]=M[E++],M[i++]=M[E++],M[i++]=M[E++],b-=3}while(b>2);b&&(M[i++]=M[E++],b>1&&(M[i++]=M[E++]))}break}}break}}while(r<n&&i<s);b=d>>3,r-=b,d-=b<<3,f&=(1<<d)-1,t.next_in=r,t.next_out=i,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=i<s?s-i+257:257-(i-s),x.hold=f,x.bits=d};const __=15,E_=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),A_=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),k_=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),M_=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var x_=(t,e,r,n,i,o,s,a)=>{const h=a.bits;let u,l,c,f,d,p,m=0,g=0,y=0,v=0,w=0,b=0,_=0,E=0,A=0,k=0,M=null;const x=new Uint16Array(16),S=new Uint16Array(16);let N,I,C,T=null;for(m=0;m<=__;m++)x[m]=0;for(g=0;g<n;g++)x[e[r+g]]++;for(w=h,v=__;v>=1&&0===x[v];v--);if(w>v&&(w=v),0===v)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(y=1;y<v&&0===x[y];y++);for(w<y&&(w=y),E=1,m=1;m<=__;m++)if(E<<=1,E-=x[m],E<0)return-1;if(E>0&&(0===t||1!==v))return-1;for(S[1]=0,m=1;m<__;m++)S[m+1]=S[m]+x[m];for(g=0;g<n;g++)0!==e[r+g]&&(s[S[e[r+g]]++]=g);if(0===t?(M=T=s,p=20):1===t?(M=E_,T=A_,p=257):(M=k_,T=M_,p=0),k=0,g=0,m=y,d=o,b=w,_=0,c=-1,A=1<<w,f=A-1,1===t&&A>852||2===t&&A>592)return 1;for(;;){N=m-_,s[g]+1<p?(I=0,C=s[g]):s[g]>=p?(I=T[s[g]-p],C=M[s[g]-p]):(I=96,C=0),u=1<<m-_,l=1<<b,y=l;do{l-=u,i[d+(k>>_)+l]=N<<24|I<<16|C|0}while(0!==l);for(u=1<<m-1;k&u;)u>>=1;if(0!==u?(k&=u-1,k+=u):k=0,g++,0==--x[m]){if(m===v)break;m=e[r+s[g]]}if(m>w&&(k&f)!==c){for(0===_&&(_=w),d+=y,b=m-_,E=1<<b;b+_<v&&(E-=x[b+_],!(E<=0));)b++,E<<=1;if(A+=1<<b,1===t&&A>852||2===t&&A>592)return 1;c=k&f,i[c]=w<<24|b<<16|d-o|0}}return 0!==k&&(i[d+k]=m-_<<24|64<<16|0),a.bits=w,0};const{Z_FINISH:S_,Z_BLOCK:N_,Z_TREES:I_,Z_OK:C_,Z_STREAM_END:T_,Z_NEED_DICT:P_,Z_STREAM_ERROR:R_,Z_DATA_ERROR:O_,Z_MEM_ERROR:$_,Z_BUF_ERROR:B_,Z_DEFLATED:D_}=Yw,F_=16180,U_=16190,j_=16191,L_=16192,z_=16194,q_=16199,V_=16200,H_=16206,G_=16209,K_=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Z_(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const J_=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<F_||e.mode>16211?1:0},Q_=t=>{if(J_(t))return R_;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=F_,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,C_},Y_=t=>{if(J_(t))return R_;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Q_(t)},W_=(t,e)=>{let r;if(J_(t))return R_;const n=t.state;return e<0?(r=0,e=-e):(r=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?R_:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,Y_(t))},X_=(t,e)=>{if(!t)return R_;const r=new Z_;t.state=r,r.strm=t,r.window=null,r.mode=F_;const n=W_(t,e);return n!==C_&&(t.state=null),n};let tE,eE,rE=!0;const nE=t=>{if(rE){tE=new Int32Array(512),eE=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(x_(1,t.lens,0,288,tE,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;x_(2,t.lens,0,32,eE,0,t.work,{bits:5}),rE=!1}t.lencode=tE,t.lenbits=9,t.distcode=eE,t.distbits=5},iE=(t,e,r,n)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(e.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(e.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(e.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var oE=(t,e)=>{let r,n,i,o,s,a,h,u,l,c,f,d,p,m,g,y,v,w,b,_,E,A,k=0;const M=new Uint8Array(4);let x,S;const N=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(J_(t)||!t.output||!t.input&&0!==t.avail_in)return R_;r=t.state,r.mode===j_&&(r.mode=L_),s=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,u=r.hold,l=r.bits,c=a,f=h,A=C_;t:for(;;)switch(r.mode){case F_:if(0===r.wrap){r.mode=L_;break}for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=G_;break}if((15&u)!==D_){t.msg="unknown compression method",r.mode=G_;break}if(u>>>=4,l-=4,E=8+(15&u),0===r.wbits&&(r.wbits=E),E>15||E>r.wbits){t.msg="invalid window size",r.mode=G_;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=512&u?16189:j_,u=0,l=0;break;case 16181:for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==D_){t.msg="unknown compression method",r.mode=G_;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=G_;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,M[2]=u>>>16&255,M[3]=u>>>24&255,r.check=Jw(r.check,M,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(M[0]=255&u,M[1]=u>>>8&255,r.check=Jw(r.check,M,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(d=r.length,d>a&&(d=a),d&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+d),E)),512&r.flags&&4&r.wrap&&(r.check=Jw(r.check,n,d,o)),a-=d,o+=d,r.length-=d),r.length))break t;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===a)break t;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&d<a);if(512&r.flags&&4&r.wrap&&(r.check=Jw(r.check,n,d,o)),a-=d,o+=d,E)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===a)break t;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&d<a);if(512&r.flags&&4&r.wrap&&(r.check=Jw(r.check,n,d,o)),a-=d,o+=d,E)break t}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){t.msg="header crc mismatch",r.mode=G_;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=j_;break;case 16189:for(;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}t.adler=r.check=K_(u),u=0,l=0,r.mode=U_;case U_:if(0===r.havedict)return t.next_out=s,t.avail_out=h,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=l,P_;t.adler=r.check=1,r.mode=j_;case j_:if(e===N_||e===I_)break t;case L_:if(r.last){u>>>=7&l,l-=7&l,r.mode=H_;break}for(;l<3;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(nE(r),r.mode=q_,e===I_){u>>>=2,l-=2;break t}break;case 2:r.mode=16196;break;case 3:t.msg="invalid block type",r.mode=G_}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=G_;break}if(r.length=65535&u,u=0,l=0,r.mode=z_,e===I_)break t;case z_:r.mode=16195;case 16195:if(d=r.length,d){if(d>a&&(d=a),d>h&&(d=h),0===d)break t;i.set(n.subarray(o,o+d),s),a-=d,o+=d,h-=d,s+=d,r.length-=d;break}r.mode=j_;break;case 16196:for(;l<14;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=G_;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.lens[N[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[N[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,x={bits:r.lenbits},A=x_(0,r.lens,0,19,r.lencode,0,r.work,x),r.lenbits=x.bits,A){t.msg="invalid code lengths set",r.mode=G_;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;k=r.lencode[u&(1<<r.lenbits)-1],g=k>>>24,y=k>>>16&255,v=65535&k,!(g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(v<16)u>>>=g,l-=g,r.lens[r.have++]=v;else{if(16===v){for(S=g+2;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(u>>>=g,l-=g,0===r.have){t.msg="invalid bit length repeat",r.mode=G_;break}E=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===v){for(S=g+3;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=g,l-=g,E=0,d=3+(7&u),u>>>=3,l-=3}else{for(S=g+7;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=g,l-=g,E=0,d=11+(127&u),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=G_;break}for(;d--;)r.lens[r.have++]=E}}if(r.mode===G_)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=G_;break}if(r.lenbits=9,x={bits:r.lenbits},A=x_(1,r.lens,0,r.nlen,r.lencode,0,r.work,x),r.lenbits=x.bits,A){t.msg="invalid literal/lengths set",r.mode=G_;break}if(r.distbits=6,r.distcode=r.distdyn,x={bits:r.distbits},A=x_(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,x),r.distbits=x.bits,A){t.msg="invalid distances set",r.mode=G_;break}if(r.mode=q_,e===I_)break t;case q_:r.mode=V_;case V_:if(a>=6&&h>=258){t.next_out=s,t.avail_out=h,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=l,b_(t,f),s=t.next_out,i=t.output,h=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,u=r.hold,l=r.bits,r.mode===j_&&(r.back=-1);break}for(r.back=0;k=r.lencode[u&(1<<r.lenbits)-1],g=k>>>24,y=k>>>16&255,v=65535&k,!(g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(y&&0==(240&y)){for(w=g,b=y,_=v;k=r.lencode[_+((u&(1<<w+b)-1)>>w)],g=k>>>24,y=k>>>16&255,v=65535&k,!(w+g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=w,l-=w,r.back+=w}if(u>>>=g,l-=g,r.back+=g,r.length=v,0===y){r.mode=16205;break}if(32&y){r.back=-1,r.mode=j_;break}if(64&y){t.msg="invalid literal/length code",r.mode=G_;break}r.extra=15&y,r.mode=16201;case 16201:if(r.extra){for(S=r.extra;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;k=r.distcode[u&(1<<r.distbits)-1],g=k>>>24,y=k>>>16&255,v=65535&k,!(g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(0==(240&y)){for(w=g,b=y,_=v;k=r.distcode[_+((u&(1<<w+b)-1)>>w)],g=k>>>24,y=k>>>16&255,v=65535&k,!(w+g<=l);){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}u>>>=w,l-=w,r.back+=w}if(u>>>=g,l-=g,r.back+=g,64&y){t.msg="invalid distance code",r.mode=G_;break}r.offset=v,r.extra=15&y,r.mode=16203;case 16203:if(r.extra){for(S=r.extra;l<S;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=G_;break}r.mode=16204;case 16204:if(0===h)break t;if(d=f-h,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=G_;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=s-r.offset,d=r.length;d>h&&(d=h),h-=d,r.length-=d;do{i[s++]=m[p++]}while(--d);0===r.length&&(r.mode=V_);break;case 16205:if(0===h)break t;i[s++]=r.length,h--,r.mode=V_;break;case H_:if(r.wrap){for(;l<32;){if(0===a)break t;a--,u|=n[o++]<<l,l+=8}if(f-=h,t.total_out+=f,r.total+=f,4&r.wrap&&f&&(t.adler=r.check=r.flags?Jw(r.check,i,f,s-f):Kw(r.check,i,f,s-f)),f=h,4&r.wrap&&(r.flags?u:K_(u))!==r.check){t.msg="incorrect data check",r.mode=G_;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===a)break t;a--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=G_;break}u=0,l=0}r.mode=16208;case 16208:A=T_;break t;case G_:A=O_;break t;case 16210:return $_;default:return R_}return t.next_out=s,t.avail_out=h,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=l,(r.wsize||f!==t.avail_out&&r.mode<G_&&(r.mode<H_||e!==S_))&&iE(t,t.output,t.next_out,f-t.avail_out),c-=t.avail_in,f-=t.avail_out,t.total_in+=c,t.total_out+=f,r.total+=f,4&r.wrap&&f&&(t.adler=r.check=r.flags?Jw(r.check,i,f,t.next_out-f):Kw(r.check,i,f,t.next_out-f)),t.data_type=r.bits+(r.last?64:0)+(r.mode===j_?128:0)+(r.mode===q_||r.mode===z_?256:0),(0===c&&0===f||e===S_)&&A===C_&&(A=B_),A},sE={inflateReset:Y_,inflateReset2:W_,inflateResetKeep:Q_,inflateInit:t=>X_(t,15),inflateInit2:X_,inflate:oE,inflateEnd:t=>{if(J_(t))return R_;let e=t.state;return e.window&&(e.window=null),t.state=null,C_},inflateGetHeader:(t,e)=>{if(J_(t))return R_;const r=t.state;return 0==(2&r.wrap)?R_:(r.head=e,e.done=!1,C_)},inflateSetDictionary:(t,e)=>{const r=e.length;let n,i,o;return J_(t)?R_:(n=t.state,0!==n.wrap&&n.mode!==U_?R_:n.mode===U_&&(i=1,i=Kw(i,e,r,0),i!==n.check)?O_:(o=iE(t,e,r,r),o?(n.mode=16210,$_):(n.havedict=1,C_)))},inflateInfo:"pako inflate (from Nodeca project)"};var aE=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const hE=Object.prototype.toString,{Z_NO_FLUSH:uE,Z_FINISH:lE,Z_OK:cE,Z_STREAM_END:fE,Z_NEED_DICT:dE,Z_STREAM_ERROR:pE,Z_DATA_ERROR:mE,Z_MEM_ERROR:gE}=Yw;function yE(t){this.options=Wb({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o_,this.strm.avail_out=0;let r=sE.inflateInit2(this.strm,e.windowBits);if(r!==cE)throw new Error(Qw[r]);if(this.header=new aE,sE.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=r_(e.dictionary):"[object ArrayBuffer]"===hE.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=sE.inflateSetDictionary(this.strm,e.dictionary),r!==cE)))throw new Error(Qw[r])}function vE(t,e){const r=new yE(e);if(r.push(t),r.err)throw r.msg||Qw[r.err];return r.result}yE.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=e===~~e?e:!0===e?lE:uE,"[object ArrayBuffer]"===hE.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=sE.inflate(r,s),o===dE&&i&&(o=sE.inflateSetDictionary(r,i),o===cE?o=sE.inflate(r,s):o===mE&&(o=dE));r.avail_in>0&&o===fE&&r.state.wrap>0&&0!==t[r.next_in];)sE.inflateReset(r),o=sE.inflate(r,s);switch(o){case pE:case mE:case dE:case gE:return this.onEnd(o),this.ended=!0,!1}if(a=r.avail_out,r.next_out&&(0===r.avail_out||o===fE))if("string"===this.options.to){let t=i_(r.output,r.next_out),e=r.next_out-t,i=n_(r.output,t);r.next_out=e,r.avail_out=n-e,e&&r.output.set(r.output.subarray(t,t+e),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==cE||0!==a){if(o===fE)return o=sE.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},yE.prototype.onData=function(t){this.chunks.push(t)},yE.prototype.onEnd=function(t){t===cE&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Xb(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var wE={Inflate:yE,inflate:vE,inflateRaw:function(t,e){return(e=e||{}).raw=!0,vE(t,e)},ungzip:vE,constants:Yw};const{Deflate:bE,deflate:_E,deflateRaw:EE,gzip:AE}=v_,{Inflate:kE,inflate:ME,inflateRaw:xE,ungzip:SE}=wE;var NE=AE,IE=SE,CE="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==B&&B||{},TE="URLSearchParams"in CE,PE="Symbol"in CE&&"iterator"in Symbol,RE="FileReader"in CE&&"Blob"in CE&&function(){try{return new Blob,!0}catch(t){return!1}}(),OE="FormData"in CE,$E="ArrayBuffer"in CE;if($E)var BE=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],DE=ArrayBuffer.isView||function(t){return t&&BE.indexOf(Object.prototype.toString.call(t))>-1};function FE(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function UE(t){return"string"!=typeof t&&(t=String(t)),t}function jE(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return PE&&(e[Symbol.iterator]=function(){return e}),e}function LE(t){this.map={},t instanceof LE?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function zE(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function qE(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function VE(t){var e=new FileReader,r=qE(e);return e.readAsArrayBuffer(t),r}function HE(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function GE(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:RE&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:OE&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:TE&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():$E&&RE&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=HE(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):$E&&(ArrayBuffer.prototype.isPrototypeOf(t)||DE(t))?this._bodyArrayBuffer=HE(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,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):TE&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},RE&&(this.blob=function(){var t=zE(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(){if(this._bodyArrayBuffer){var t=zE(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(RE)return this.blob().then(VE);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,n,i,o=zE(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=qE(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),i=n?n[1]:"utf-8",e.readAsText(t,i),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},OE&&(this.formData=function(){return this.text().then(JE)}),this.json=function(){return this.text().then(JSON.parse)},this}LE.prototype.append=function(t,e){t=FE(t),e=UE(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},LE.prototype.delete=function(t){delete this.map[FE(t)]},LE.prototype.get=function(t){return t=FE(t),this.has(t)?this.map[t]:null},LE.prototype.has=function(t){return this.map.hasOwnProperty(FE(t))},LE.prototype.set=function(t,e){this.map[FE(t)]=UE(e)},LE.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},LE.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),jE(t)},LE.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),jE(t)},LE.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),jE(t)},PE&&(LE.prototype[Symbol.iterator]=LE.prototype.entries);var KE=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function ZE(t,e){if(!(this instanceof ZE))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,i=(e=e||{}).body;if(t instanceof ZE){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new LE(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=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 LE(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),KE.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in CE)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function JE(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function QE(t,e){if(!(this instanceof QE))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new LE(e.headers),this.url=e.url||"",this._initBody(t)}ZE.prototype.clone=function(){return new ZE(this,{body:this._bodyInit})},GE.call(ZE.prototype),GE.call(QE.prototype),QE.prototype.clone=function(){return new QE(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new LE(this.headers),url:this.url})},QE.error=function(){var t=new QE(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var YE=[301,302,303,307,308];QE.redirect=function(t,e){if(-1===YE.indexOf(e))throw new RangeError("Invalid status code");return new QE(null,{status:e,headers:{location:t}})};var WE=CE.DOMException;try{new WE}catch(xb){WE=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},WE.prototype=Object.create(Error.prototype),WE.prototype.constructor=WE}function XE(t,e){return new Promise((function(r,n){var i=new ZE(t,e);if(i.signal&&i.signal.aborted)return n(new WE("Aborted","AbortError"));var o=new XMLHttpRequest;function s(){o.abort()}if(o.onload=function(){var t,e,n={statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new LE,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();try{e.append(n,i)}catch(t){console.warn("Response "+t.message)}}})),e)};0===i.url.indexOf("file://")&&(o.status<200||o.status>599)?n.status=200:n.status=o.status,n.url="responseURL"in o?o.responseURL:n.headers.get("X-Request-URL");var s="response"in o?o.response:o.responseText;setTimeout((function(){r(new QE(s,n))}),0)},o.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request timed out"))}),0)},o.onabort=function(){setTimeout((function(){n(new WE("Aborted","AbortError"))}),0)},o.open(i.method,function(t){try{return""===t&&CE.location.href?CE.location.href:t}catch(e){return t}}(i.url),!0),"include"===i.credentials?o.withCredentials=!0:"omit"===i.credentials&&(o.withCredentials=!1),"responseType"in o&&(RE?o.responseType="blob":$E&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof LE||CE.Headers&&e.headers instanceof CE.Headers)){var a=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){a.push(FE(t)),o.setRequestHeader(t,UE(e.headers[t]))})),i.headers.forEach((function(t,e){-1===a.indexOf(e)&&o.setRequestHeader(e,t)}))}else i.headers.forEach((function(t,e){o.setRequestHeader(e,t)}));i.signal&&(i.signal.addEventListener("abort",s),o.onreadystatechange=function(){4===o.readyState&&i.signal.removeEventListener("abort",s)}),o.send(void 0===i._bodyInit?null:i._bodyInit)}))}XE.polyfill=!0,CE.fetch||(CE.fetch=XE,CE.Headers=LE,CE.Request=ZE,CE.Response=QE);var tA=self.fetch.bind(self),eA=o((function(t){var e,n;e=r,n=function(){function t(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var r=t.shift();t[0]=r+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<t.length;n++){var i=t[n];if("string"!=typeof i)throw new TypeError("Url must be a string. Received "+i);""!==i&&(n>0&&(i=i.replace(/^[\/]+/,"")),i=n<t.length-1?i.replace(/[\/]+$/,""):i.replace(/[\/]+$/,"/"),e.push(i))}var o=e.join("/"),s=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return o=s.shift()+(s.length>0?"?":"")+s.join("&")}return function(){return t("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=n():e.urljoin=n()})),rA=Object.defineProperty,nA=(t,e)=>{for(var r in e)rA(t,r,{get:e[r],enumerable:!0})};nA({},{API_VERSION:()=>NA,BN_FEE_TRANSACTION_VERSION_1:()=>AA,BN_FEE_TRANSACTION_VERSION_2:()=>kA,BN_TRANSACTION_VERSION_1:()=>_A,BN_TRANSACTION_VERSION_2:()=>EA,BaseUrl:()=>IA,HEX_STR_TRANSACTION_VERSION_1:()=>wA,HEX_STR_TRANSACTION_VERSION_2:()=>bA,IS_BROWSER:()=>iA,MASK_250:()=>xA,MASK_251:()=>SA,NetworkName:()=>CA,RPC_GOERLI_NODES:()=>OA,RPC_MAINNET_NODES:()=>$A,StarknetChainId:()=>TA,TEXT_TO_FELT_MAX_LEN:()=>vA,TransactionHashPrefix:()=>PA,UDC:()=>RA,ZERO:()=>MA});nA({},{IS_BROWSER:()=>iA,addHexPrefix:()=>fA,arrayBufferToString:()=>oA,atobUniversal:()=>hA,btoaUniversal:()=>uA,buf2hex:()=>lA,calcByteLength:()=>pA,padLeft:()=>dA,pascalToSnake:()=>yA,removeHexPrefix:()=>cA,sanitizeBytes:()=>mA,sanitizeHex:()=>gA,stringToArrayBuffer:()=>aA,utf8ToArray:()=>sA});var iA="undefined"!=typeof window;function oA(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function sA(t){return(new TextEncoder).encode(t)}function aA(t){return sA(t)}function hA(t){return Em.decode(t)}function uA(t){return Em.encode(new Uint8Array(t))}function lA(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function cA(t){return t.replace(/^0x/i,"")}function fA(t){return`0x${cA(t)}`}function dA(t,e,r="0"){return function(t,e,r,n="0"){const i=e-t.length;let o=t;if(i>0){const e=n.repeat(i);o=r?e+t:t+e}return o}(t,e,!0,r)}function pA(t,e=8){const{length:r}=t,n=r%e;return n?(r-n)/e*e+e:r}function mA(t,e=8,r="0"){return dA(t,pA(t,e),r)}function gA(t){return(t=mA(t=cA(t),2))&&(t=fA(t)),t}var yA=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t,vA=31,wA="0x1",bA="0x2",_A=1n,EA=2n,AA=2n**128n+_A,kA=2n**128n+EA,MA=0n,xA=2n**250n-1n,SA=2n**251n,NA=MA,IA=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_GOERLI="https://alpha4.starknet.io",t))(IA||{}),CA=(t=>(t.SN_MAIN="SN_MAIN",t.SN_GOERLI="SN_GOERLI",t))(CA||{}),TA=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_GOERLI="0x534e5f474f45524c49",t))(TA||{}),PA=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(PA||{}),RA={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},OA=["https://starknet-testnet.public.blastapi.io/rpc/v0.5","https://limited-rpc.nethermind.io/goerli-juno/v0_5"],$A=["https://starknet-mainnet.public.blastapi.io/rpc/v0.5","https://limited-rpc.nethermind.io/mainnet-juno/v0_5"];nA({},{BlockStatus:()=>HA,BlockTag:()=>GA,EntryPointType:()=>jA,Litteral:()=>UA,RPC:()=>KA,SIMULATION_FLAG:()=>BA,Sequencer:()=>ik,TransactionExecutionStatus:()=>VA,TransactionFinalityStatus:()=>qA,TransactionStatus:()=>zA,TransactionType:()=>LA,Uint:()=>FA,ValidateType:()=>DA});var BA=(t=>(t.SKIP_VALIDATE="SKIP_VALIDATE",t.SKIP_EXECUTE="SKIP_EXECUTE",t))(BA||{}),DA=(t=>(t.DEPLOY="DEPLOY",t.CALL="CALL",t.INVOKE="INVOKE",t))(DA||{}),FA=(t=>(t.u8="core::integer::u8",t.u16="core::integer::u16",t.u32="core::integer::u32",t.u64="core::integer::u64",t.u128="core::integer::u128",t.u256="core::integer::u256",t))(FA||{}),UA=(t=>(t.ClassHash="core::starknet::class_hash::ClassHash",t.ContractAddress="core::starknet::contract_address::ContractAddress",t))(UA||{}),jA=(t=>(t.EXTERNAL="EXTERNAL",t.L1_HANDLER="L1_HANDLER",t.CONSTRUCTOR="CONSTRUCTOR",t))(jA||{}),LA=(t=>(t.DECLARE="DECLARE",t.DEPLOY="DEPLOY",t.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",t.INVOKE="INVOKE_FUNCTION",t))(LA||{}),zA=(t=>(t.NOT_RECEIVED="NOT_RECEIVED",t.RECEIVED="RECEIVED",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t.REJECTED="REJECTED",t.REVERTED="REVERTED",t))(zA||{}),qA=(t=>(t.NOT_RECEIVED="NOT_RECEIVED",t.RECEIVED="RECEIVED",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t))(qA||{}),VA=(t=>(t.REJECTED="REJECTED",t.REVERTED="REVERTED",t.SUCCEEDED="SUCCEEDED",t))(VA||{}),HA=(t=>(t.PENDING="PENDING",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.REJECTED="REJECTED",t))(HA||{}),GA=(t=>(t.pending="pending",t.latest="latest",t))(GA||{}),KA={};nA(KA,{EBlockTag:()=>rk,EDataAvailabilityMode:()=>nk,ESimulationFlag:()=>WA,ETransactionExecutionStatus:()=>ek,ETransactionFinalityStatus:()=>tk,ETransactionStatus:()=>XA,ETransactionType:()=>YA,Errors:()=>JA,JRPC:()=>ZA,SPEC:()=>QA});var ZA={},JA={},QA={},YA=(t=>(t.DECLARE="DECLARE",t.DEPLOY="DEPLOY",t.DEPLOY_ACCOUNT="DEPLOY_ACCOUNT",t.INVOKE="INVOKE",t.L1_HANDLER="L1_HANDLER",t))(YA||{}),WA=(t=>(t.SKIP_VALIDATE="SKIP_VALIDATE",t.SKIP_FEE_CHARGE="SKIP_FEE_CHARGE",t))(WA||{}),XA=(t=>(t.RECEIVED="RECEIVED",t.REJECTED="REJECTED",t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t))(XA||{}),tk=(t=>(t.ACCEPTED_ON_L2="ACCEPTED_ON_L2",t.ACCEPTED_ON_L1="ACCEPTED_ON_L1",t))(tk||{}),ek=(t=>(t.SUCCEEDED="SUCCEEDED",t.REVERTED="REVERTED",t))(ek||{}),rk=(t=>(t.LATEST="latest",t.PENDING="pending",t))(rk||{}),nk=(t=>(t.L1="L1",t.L2="L2",t))(nk||{}),ik={};function ok(t,e){if(!t)throw new Error(e||"Assertion failure")}function sk(t){return/^0x[0-9a-f]*$/i.test(t)}function ak(t){return BigInt(t)}function hk(t){return"bigint"==typeof t}function uk(t){return fA(ak(t).toString(16))}nA({},{assertInRange:()=>pk,bigNumberishArrayToDecimalStringArray:()=>mk,bigNumberishArrayToHexadecimalStringArray:()=>gk,cleanHex:()=>dk,getDecimalString:()=>vk,getHexString:()=>wk,getHexStringArray:()=>bk,hexToBytes:()=>Ek,hexToDecimalString:()=>fk,isBigInt:()=>hk,isHex:()=>sk,isStringWholeNumber:()=>yk,toBigInt:()=>ak,toCairoBool:()=>_k,toHex:()=>uk,toHexString:()=>lk,toStorageKey:()=>ck});var lk=uk;function ck(t){return fA(ak(t).toString(16).padStart(64,"0"))}function fk(t){return BigInt(fA(t)).toString(10)}var dk=t=>t.toLowerCase().replace(/^(0x)0+/,"$1");function pk(t,e,r,n=""){const i=""===n?"invalid length":`invalid ${n} length`,o=BigInt(t),s=BigInt(e),a=BigInt(r);ok(o>=s&&o<=a,`Message not signable, ${i}.`)}function mk(t){return t.map((t=>ak(t).toString(10)))}function gk(t){return t.map((t=>uk(t)))}var yk=t=>/^\d+$/.test(t);function vk(t){if(sk(t))return fk(t);if(yk(t))return t;throw new Error(`${t} need to be hex-string or whole-number-string`)}function wk(t){if(sk(t))return t;if(yk(t))return lk(t);throw new Error(`${t} need to be hex-string or whole-number-string`)}function bk(t){return t.map((t=>wk(t)))}var _k=t=>(+t).toString();function Ek(t){if(!sk(t))throw new Error(`${t} need to be a hex-string`);let e=cA(t);return e.length%2!=0&&(e=`0${e}`),Tm(e)}function Ak(t){const e=cA(uk(BigInt(t))),r=e.length%2==0?e:`0${e}`;return fA(Gy(Ek(fA(r))).toString(16))}function kk(t){const e=BigInt(function(t){return fA(Gy(sA(t)).toString(16))}(t));return e&xA}function Mk(t){return uk(kk(t))}function xk(t){return sk(t)?t:yk(t)?lk(t):Mk(t)}nA({},{getSelector:()=>xk,getSelectorFromName:()=>Mk,keccakBn:()=>Ak,starknetKeccak:()=>kk});function Sk(t){return/^[\x00-\x7F]*$/.test(t)}function Nk(t){return t.length<=vA}function Ik(t){return/^[0-9]*$/i.test(t)}function Ck(t){return"string"==typeof t&&!sk(t)&&!yk(t)}nA({},{decodeShortString:()=>$k,encodeShortString:()=>Ok,isASCII:()=>Sk,isDecimalString:()=>Ik,isLongText:()=>Pk,isShortString:()=>Nk,isShortText:()=>Tk,isText:()=>Ck,splitLongString:()=>Rk});var Tk=t=>Ck(t)&&Nk(t),Pk=t=>Ck(t)&&!Nk(t);function Rk(t){const e=RegExp(`[^]{1,${vA}}`,"g");return t.match(e)||[]}function Ok(t){if(!Sk(t))throw new Error(`${t} is not an ASCII string`);if(!Nk(t))throw new Error(`${t} is too long`);return fA(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function $k(t){if(!Sk(t))throw new Error(`${t} is not an ASCII string`);if(sk(t))return cA(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(Ik(t))return $k("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}var Bk={};nA(Bk,{felt:()=>uM,getAbiContractVersion:()=>sM,getArrayType:()=>iM,isCairo1Abi:()=>oM,isCairo1Type:()=>nM,isLen:()=>zk,isTypeArray:()=>Vk,isTypeBool:()=>tM,isTypeContractAddress:()=>eM,isTypeEnum:()=>Zk,isTypeEthAddress:()=>rM,isTypeFelt:()=>qk,isTypeLitteral:()=>Wk,isTypeNamedTuple:()=>Gk,isTypeOption:()=>Jk,isTypeResult:()=>Qk,isTypeStruct:()=>Kk,isTypeTuple:()=>Hk,isTypeUint:()=>Yk,isTypeUint256:()=>Xk,tuple:()=>hM,uint256:()=>aM});nA({},{UINT_128_MAX:()=>Dk,UINT_256_MAX:()=>Fk,bnToUint256:()=>Lk,isUint256:()=>jk,uint256ToBN:()=>Uk});var Dk=(1n<<128n)-1n,Fk=(1n<<256n)-1n;function Uk(t){return(ak(t.high)<<128n)+ak(t.low)}function jk(t){return ak(t)<=Fk}function Lk(t){const e=ak(t);if(!jk(e))throw new Error("Number is too large");return{low:fA((e&Dk).toString(16)),high:fA((e>>128n).toString(16))}}var zk=t=>/_len$/.test(t),qk=t=>"felt"===t||"core::felt252"===t,Vk=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),Hk=t=>/^\(.*\)$/i.test(t),Gk=t=>/\(.*\)/i.test(t)&&t.includes(":"),Kk=(t,e)=>t in e,Zk=(t,e)=>t in e,Jk=t=>t.startsWith("core::option::Option::"),Qk=t=>t.startsWith("core::result::Result::"),Yk=t=>Object.values(FA).includes(t),Wk=t=>Object.values(UA).includes(t),Xk=t=>"core::integer::u256"===t,tM=t=>"core::bool"===t,eM=t=>"core::starknet::contract_address::ContractAddress"===t,rM=t=>"core::starknet::eth_address::EthAddress"===t,nM=t=>t.includes("::"),iM=t=>nM(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function oM(t){const{cairo:e}=sM(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function sM(t){if(t.find((t=>"interface"===t.type)))return{cairo:"1",compiler:"2"};const e=t.find((t=>"function"===t.type&&(t.inputs.length||t.outputs.length)));if(!e)return{cairo:void 0,compiler:void 0};const r=e.inputs.length?e.inputs:e.outputs;return nM(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var aM=t=>{const e=BigInt(t);if(!jk(e))throw new Error("Number is too large");return{low:(e&Dk).toString(10),high:(e>>128n).toString(10)}},hM=(...t)=>({...t});function uM(t){if(hk(t)||"number"==typeof t&&Number.isInteger(t))return t.toString();if(Ck(t)){if(!Nk(t))throw new Error(`${t} is a long string > 31 chars, felt can store short strings, split it to array of short strings`);const e=Ok(t);return BigInt(e).toString()}if("string"==typeof t&&sk(t))return BigInt(t).toString();if("string"==typeof t&&yk(t))return t;if("boolean"==typeof t)return""+ +t;throw new Error(`${t} can't be computed by felt()`)}var lM=class{constructor(t){const e=Object.values(t);if(0===e.length)throw new Error("This Enum must have a least 1 variant");if(1!==e.filter((t=>void 0!==t)).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){const t=Object.entries(this.variant).find((t=>void 0!==t[1]));if(void 0!==t)return t[1]}activeVariant(){const t=Object.entries(this.variant).find((t=>void 0!==t[1]));return void 0===t?"":t[0]}},cM=(t=>(t[t.Some=0]="Some",t[t.None=1]="None",t))(cM||{}),fM=class{constructor(t,e){if(!(t in cM))throw new Error("Wrong variant : should be CairoOptionVariant.Some or .None.");if(0===t){if(void 0===e)throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=e,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){if(!this.None)return this.Some}isSome(){return!(void 0===this.Some)}isNone(){return!0===this.None}},dM=(t=>(t[t.Ok=0]="Ok",t[t.Err=1]="Err",t))(dM||{}),pM=class{constructor(t,e){if(!(t in dM))throw new Error("Wrong variant : should be CairoResultVariant.Ok or .Err.");0===t?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(void 0!==this.Ok)return this.Ok;if(void 0!==this.Err)return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!(void 0===this.Ok)}isErr(){return!(void 0===this.Err)}},mM=(t,e,r)=>{if(!hk(t[r]))throw new Error(`Data and formatter mismatch on ${r}:${e[r]}, expected response data ${r}:${t[r]} to be BN instead it is ${typeof t[r]}`)},gM=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function yM(t,e,r){return Object.entries(t).reduce(((n,[i,o])=>{const s=r??e[i];if(!(i in e)&&!r)return n[i]=o,n;if("string"===s){if(Array.isArray(t[i])){const e=yM(t[i],t[i].map((t=>s)));return n[i]=Object.values(e).join(""),n}return mM(t,e,i),n[i]=$k(o),n}if("number"===s)return mM(t,e,i),n[i]=Number(o),n;if("function"==typeof s)return n[i]=s(o),n;if(Array.isArray(s)){const e=yM(t[i],s,s[0]);return n[i]=Object.values(e),n}return"object"==typeof s?(n[i]=yM(t[i],s),n):(gM(t,e,i),n)}),{})}function vM(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:oM(t)?1:0}(t);if(0===e||1===e)return new class{constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.reduce(((t,e)=>zk(e.name)?t:t+1),0)}getMethod(t){return this.abi.find((e=>e.name===t))}getLegacyFormat(){return this.abi}}(t);if(2===e)return new class{constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.length}getMethod(t){return this.abi.find((t=>"interface"===t.type)).items.find((e=>e.name===t))}getLegacyFormat(){return this.abi.flatMap((t=>"interface"===t.type?t.items:t))}}(t);throw Error(`Unsupported ABI version ${e}`)}function wM(t,e,r){return"constructor"===t&&!r&&!e.length}function bM(t){if(!t.includes("("))return{subTuple:[],result:t};const e=[];let r="",n=0;for(;n<t.length;){if("("===t[n]){let i=1;const o=n;for(n++;i;)")"===t[n]&&i--,"("===t[n]&&i++,n++;e.push(t.substring(o,n)),r+=" ",n--}else r+=t[n];n++}return{subTuple:e,result:r}}function _M(t){return nM(t)?function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:n}=bM(e);return n.split(",").map((t=>r.length?t.replace(" ",r.shift()):t))}(t):function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:n}=bM(e);let i=n.split(",").map((t=>r.length?t.replace(" ",r.shift()):t));return Gk(t)&&(i=i.reduce(((t,e)=>t.concat(function(t){const e=t.substring(0,t.indexOf(":"));return{name:e,type:t.substring(e.length+":".length)}}(e))),[])),i}(t)}function EM(t,e,r,n){const i=(t,e)=>{if(Vk(e))return function(t,e){const r=iM(e);if("string"==typeof t)return t;return t.map((t=>i(t,r)))}(t,e);if(Zk(e,n)){const r=n[e];return s(t,r)}if(Hk(e))return function(t,e){const r=_M(e).reduce(((e,r,n)=>{const o=Object.keys(t),s=r=>Object.defineProperty(e,n.toString(),{enumerable:!0,value:r??t[o[n]]}),a=r?.type?r.type:r;return s(i(t[o[n]],a)),e}),{});return r}(t,e);if(rM(e))return t;if(Xk(e)){const r=t;if("object"!=typeof r)return r;if(!("low"in r)||!("high"in r))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint256 object without the 'low' and 'high' keys.`)}(e);return{low:r.low,high:r.high}}if(Kk(e,r)){const n=r[e].members;return o(t,n)}return t},o=(t,e)=>e.reduce(((e,r)=>{if("undefined"===t[r.name]&&(nM(r.type)||!zk(r.name)))throw Error(`Your object needs a property with key : ${r.name} .`);var n;return n=i(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:n??t[r.name]}),e}),{});const s=(t,e)=>{if(Qk(e.name)){const r=t,n=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(",")),o=e.name.substring(e.name.indexOf(",")+1,e.name.lastIndexOf(">"));return r.isOk()?new pM(0,i(t.unwrap(),n)):new pM(1,i(t.unwrap(),o))}if(Jk(e.name)){const r=t,n=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new fM(0,i(r.unwrap(),n)):new fM(1,{})}const r=t,n=Object.entries(r.variant).map((t=>{if(void 0===t[1])return t;const n=e.type.substring(e.type.lastIndexOf("<")+1,e.type.lastIndexOf(">"));return"()"===n?t:[t[0],i(r.unwrap(),n)]}));return new lM(Object.fromEntries(n))};return e.reduce(((e,r)=>{return zk(r.name)&&!nM(r.type)||(n=i(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:n})),e;var n}),{})}function AM(t,e){if(!0===Xk(t)){const t=aM(e);return[uM(t.low),uM(t.high)]}return uM(e)}function kM(t){if("object"==typeof t){const{low:e,high:r}=t;return[uM(e),uM(r)]}const e=aM(t);return[uM(e.low),uM(e.high)]}function MM(t,e,r,n){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(Array.isArray(t)){const i=[];i.push(uM(t.length));const o=iM(e);return t.reduce(((t,e)=>t.concat(MM(e,o,r,n))),i)}if(r[e]&&r[e].members.length){if(Xk(e))return kM(t);if("core::starknet::eth_address::EthAddress"===e)return AM(e,t);const{members:i}=r[e],o=t;return i.reduce(((t,e)=>t.concat(MM(o[e.name],e.type,r,n))),[])}if(Hk(e)){const i=function(t,e){const r=_M(e),n=Object.values(t);if(n.length!==r.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match.\n provided: ${n} \n expected: ${r}`);return r.map(((t,e)=>({element:n[e],type:t.type??t})))}(t,e);return i.reduce(((t,e)=>{const i=MM(e.element,e.type,r,n);return t.concat(i)}),[])}if(Xk(e))return kM(t);if(Zk(e,n)){const{variants:i}=n[e];if(Jk(e)){const e=t;if(e.isSome()){const t=i.find((t=>"Some"===t.name));if(void 0===t)throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return(0).toString();const s=MM(e.unwrap(),o,r,n);return Array.isArray(s)?[(0).toString(),...s]:[(0).toString(),s]}return 1..toString()}if(Qk(e)){const e=t;if(e.isOk()){const t=i.find((t=>"Ok"===t.name));if(void 0===t)throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return(0).toString();const s=MM(e.unwrap(),o,r,n);return Array.isArray(s)?[(0).toString(),...s]:[(0).toString(),s]}const o=i.find((t=>"Err"===t.name));if(void 0===o)throw Error("Error in abi : Result has no 'Err' variant.");const s=o.type;if("()"===s)return 1..toString();const a=MM(e.unwrap(),s,r,n);return Array.isArray(a)?[1..toString(),...a]:[1..toString(),a]}const o=t,s=o.activeVariant(),a=i.find((t=>t.name===s));if(void 0===a)throw Error(`Not find in abi : Enum has no '${s}' variant.`);const h=a.type,u=i.findIndex((t=>t.name===s));if("()"===h)return u.toString();const l=MM(o.unwrap(),h,r,n);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return AM(e,t)}function xM(t,e){let r;switch(!0){case tM(t):return r=e.next().value,Boolean(BigInt(r));case Xk(t):return Uk({low:e.next().value,high:e.next().value});default:return r=e.next().value,BigInt(r)}}function SM(t,e,r,n){if("()"===e.type)return{};if(Xk(e.type)){return Uk({low:t.next().value,high:t.next().value})}if(Vk(e.type)){const i=[],o={name:"",type:iM(e.type)},s=BigInt(t.next().value);for(;i.length<s;)i.push(SM(t,o,r,n));return i}if(r&&e.type in r&&r[e.type])return"core::starknet::eth_address::EthAddress"===e.type?xM(e.type,t):r[e.type].members.reduce(((e,i)=>(e[i.name]=SM(t,i,r,n),e)),{});if(n&&e.type in n&&n[e.type]){const i=Number(t.next().value),o=n[e.type].variants.reduce(((e,o,s)=>s===i?(e[o.name]=SM(t,{name:"",type:o.type},r,n),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=0===i?o.Some:void 0;return new fM(i,t)}if(e.type.startsWith("core::result::Result")){let t;return t=0===i?o.Ok:o.Err,new pM(i,t)}return new lM(o)}if(Hk(e.type)){return _M(e.type).reduce(((e,i,o)=>{const s=i?.name?i.name:o,a={name:s,type:i?.type?i.type:i};return e[s]=SM(t,a,r,n),e}),{})}if(Vk(e.type)){const i=[],o={name:"",type:iM(e.type)},s=BigInt(t.next().value);for(;i.length<s;)i.push(SM(t,o,r,n));return i}return xM(e.type,t)}function NM(t,e,r,n,i){const{name:o,type:s}=e;let a;switch(!0){case zk(o):return a=t.next().value,BigInt(a);case r&&s in r||Hk(s):case n&&Zk(s,n):return SM(t,e,r,n);case Vk(s):if(nM(s))return SM(t,e,r,n);const h=[];if(i&&i[`${o}_len`]){const s=i[`${o}_len`];for(;h.length<s;)h.push(SM(t,{name:o,type:e.type.replace("*","")},r,n))}return h;default:return xM(s,t)}}var IM=(t,e)=>{if(ok("string"==typeof t||"number"==typeof t||"bigint"==typeof t,`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),"string"==typeof t&&!sk(t))return;const r=BigInt(t.toString(10));ok(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},CM=(t,e)=>{"number"==typeof t&&ok(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is to large to be typed as Number use (BigInt or String)"),ok("string"==typeof t||"number"==typeof t||"bigint"==typeof t||"object"==typeof t&&"low"in t&&"high"in t,`Validate: arg ${e.name} of cairo type ${e.type} should be type (String, Number or BigInt), but is ${typeof t} ${t}.`);const r="object"==typeof t?Uk(t):ak(t);switch(e.type){case"core::integer::u8":ok(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case"core::integer::u16":ok(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case"core::integer::u32":ok(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case"core::integer::u64":ok(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case"core::integer::u128":ok(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case"core::integer::u256":ok(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} 0 - 2^256-1`);break;case"core::starknet::class_hash::ClassHash":case"core::starknet::contract_address::ContractAddress":ok(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)}},TM=(t,e)=>{ok("boolean"==typeof t,`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},PM=(t,e,r)=>{if("core::integer::u256"!==e.type)if("core::starknet::eth_address::EthAddress"!==e.type)ok("object"==typeof t&&!Array.isArray(t),`Validate: arg ${e.name} is cairo type struct (${e.type}), and should be defined as js object (not array)`),r[e.type].members.forEach((({name:r})=>{ok(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else{ok("object"!=typeof t,`EthAdress type is waiting a BigNumberish. Got ${t}`);const r=BigInt(t.toString(10));ok(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else CM(t,e)},RM=(t,e)=>{ok("object"==typeof t&&!Array.isArray(t),`Validate: arg ${e.name} is cairo type Enum (${e.type}), and should be defined as js object (not array)`);const r=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),n=[...Object.getOwnPropertyNames(t),...r];if(!(Jk(e.type)&&n.includes("isSome")&&n.includes("isNone")||Qk(e.type)&&n.includes("isOk")&&n.includes("isErr")||n.includes("variant")&&n.includes("activeVariant")))throw new Error(`Validate Enum: argument ${e.name}, type ${e.type}, value received ${t}, is not an Enum.`)},OM=(t,e)=>{ok("object"==typeof t&&!Array.isArray(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},$M=(t,e,r,n)=>{const i=iM(e.type);if(!qk(i)||!Pk(t))switch(ok(Array.isArray(t),`Validate: arg ${e.name} should be an Array`),!0){case qk(i):t.forEach((t=>IM(t,e)));break;case Hk(i):t.forEach((t=>OM(t,{name:e.name,type:i})));break;case Vk(i):t.forEach((t=>$M(t,{name:"",type:i},r,n)));break;case Kk(i,r):t.forEach((t=>PM(t,{name:e.name,type:i},r)));break;case Zk(i,n):t.forEach((t=>RM(t,{name:e.name,type:i})));break;case Yk(i)||Wk(i):t.forEach((t=>CM(t,e)));break;case tM(i):t.forEach((t=>TM(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${t}`)}};function BM(t,e,r,n){t.inputs.reduce(((t,i)=>{const o=e[t];switch(!0){case zk(i.name):return t;case qk(i.type):IM(o,i);break;case Yk(i.type)||Wk(i.type):CM(o,i);break;case tM(i.type):TM(o,i);break;case Vk(i.type):$M(o,i,r,n);break;case Kk(i.type,r):PM(o,i,r);break;case Zk(i.type,n):RM(o,i);break;case Hk(i.type):OM(o,i);break;default:throw new Error(`Validate Unhandled: argument ${i.name}, type ${i.type}, value ${o}`)}return t+1}),0)}var DM=class{constructor(t){this.structs=DM.getAbiStruct(t),this.enums=DM.getAbiEnum(t),this.parser=vM(t),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if("DEPLOY"!==t){ok(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return"INVOKE"===t?!r:r})).map((t=>t.name)).includes(e),("INVOKE"===t?"invocable":"viewable")+" method not found in abi")}const n=this.abi.find((r=>"DEPLOY"===t?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(wM(e,r,n))return;const i=this.parser.methodInputsLength(n);if(r.length!==i)throw Error(`Invalid number of arguments, expected ${i} arguments, but got ${r.length}`);BM(n,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(wM(t,e,r))return[];let n;if(Array.isArray(e))n=e;else{const t=EM(e,r.inputs,this.structs,this.enums);n=Object.values(t),BM(r,n,this.structs,this.enums)}const i=n[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>zk(e.name)&&!nM(e.type)?t:t.concat(function(t,e,r,n){const{name:i,type:o}=e;let{value:s}=t.next();switch(!0){case Vk(o):if(!Array.isArray(s)&&!Ck(s))throw Error(`ABI expected parameter ${i} to be array or long string, got ${s}`);return"string"==typeof s&&(s=Rk(s)),MM(s,e.type,r,n);case"core::starknet::eth_address::EthAddress"===o:return AM(o,s);case Kk(o,r)||Hk(o)||Xk(o):case Zk(o,n):return MM(s,o,r,n);default:return AM(o,s)}}(i,e,this.structs,this.enums))),[]);return Object.defineProperty(o,"__compiled__",{enumerable:!1,writable:!1,value:!0}),o}static compile(t){const e=t=>{const e=(t,r=".")=>{const n=Array.isArray(t)?[t.length.toString(),...t]:t;return Object.entries(n).flatMap((([t,i])=>{let o=i;Pk(o)&&(o=Rk(o)),"entrypoint"===t&&(o=Mk(o));const s=Array.isArray(n)&&"0"===t?"$$len":t;if(hk(o))return[[`${r}${s}`,uM(o)]];if(Object(o)===o){const t=Object.getOwnPropertyNames(Object.getPrototypeOf(o)),n=[...Object.getOwnPropertyNames(o),...t];if(n.includes("isSome")&&n.includes("isNone")){const t=o,n=t.isSome()?0:1;return t.isSome()?e({0:n,1:t.unwrap()},`${r}${s}.`):[[`${r}${s}`,uM(n)]]}if(n.includes("isOk")&&n.includes("isErr")){const t=o,n=t.isOk()?0:1;return e({0:n,1:t.unwrap()},`${r}${s}.`)}if(n.includes("variant")&&n.includes("activeVariant")){const t=o,n=t.activeVariant(),i=Object.keys(t.variant).findIndex((t=>t===n));return"object"==typeof t.unwrap()&&0===Object.keys(t.unwrap()).length?[[`${r}${s}`,uM(i)]]:e({0:i,1:t.unwrap()},`${r}${s}.`)}return e(o,`${r}${s}.`)}return[[`${r}${s}`,uM(o)]]}))};return Object.fromEntries(e(t))};let r;if(Array.isArray(t)){const n=e({...t});r=Object.values(n)}else{const n=e(t);r=Object.values(n)}return Object.defineProperty(r,"__compiled__",{enumerable:!1,writable:!1,value:!0}),r}parse(t,e){const{outputs:r}=this.abi.find((e=>e.name===t)),n=e.flat()[Symbol.iterator](),i=r.flat().reduce(((t,e,r)=>{const i=e.name??r;return t[i]=NM(n,e,this.structs,this.enums,t),t[i]&&t[`${i}_len`]&&delete t[`${i}_len`],t}),{});return 1===Object.keys(i).length&&0 in i?i[0]:i}format(t,e,r){return yM(this.parse(t,e),r)}static getAbiStruct(t){return t.filter((t=>"struct"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{})}static getAbiEnum(t){const e=t.filter((t=>"enum"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{});return delete e["core::bool"],e}static toCalldata(t=[]){return DM.compile(t)}static toHex(t=[]){return DM.compile(t).map((t=>uk(t)))}};nA({},{calculateContractAddressFromHash:()=>tx,calculateDeclareTransactionHash:()=>YM,calculateDeployAccountTransactionHash:()=>WM,calculateDeployTransactionHash:()=>QM,calculateTransactionHash:()=>XM,calculateTransactionHashCommon:()=>JM,computeCompiledClassHash:()=>sx,computeContractClassHash:()=>ux,computeHashOnElements:()=>ZM,computeLegacyContractClassHash:()=>ix,computeSierraContractClassHash:()=>hx,default:()=>nx,feeTransactionVersion:()=>HM,feeTransactionVersion_2:()=>GM,formatSpaces:()=>rx,getSelector:()=>xk,getSelectorFromName:()=>Mk,getVersionsByType:()=>KM,keccakBn:()=>Ak,poseidon:()=>Zg,starknetKeccak:()=>kk,transactionVersion:()=>qM,transactionVersion_2:()=>VM});nA({},{starkCurve:()=>ev,weierstrass:()=>uy});nA({},{parse:()=>UM,parseAlwaysAsBig:()=>jM,stringify:()=>LM,stringifyAlwaysAsBig:()=>zM});var FM=t=>{if(!rv(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},UM=t=>Mv(String(t),void 0,FM),jM=t=>Mv(String(t),void 0,vv),LM=(t,e,r,n)=>ow(t,e,r,n),zM=LM,qM=_A,VM=EA,HM=AA,GM=kA;function KM(t){return"fee"===t?{v1:HM,v2:GM}:{v1:qM,v2:VM}}function ZM(t){return[...t,t.length].reduce(((t,e)=>Vy(ak(t),ak(e))),0).toString()}function JM(t,e,r,n,i,o,s,a=[]){const h=ZM(i);return ZM([t,e,r,n,h,o,s,...a])}function QM(t,e,r,n,i="constructor"){return JM("0x6465706c6f79",r,t,Mk(i),e,0,n)}function YM(t,e,r,n,i,o,s){return JM("0x6465636c617265",r,e,0,[t],n,i,[o,...s?[s]:[]])}function WM(t,e,r,n,i,o,s,a){return JM("0x6465706c6f795f6163636f756e74",i,t,0,[e,n,...r],o,s,[a])}function XM(t,e,r,n,i,o){return JM("0x696e766f6b65",e,t,0,r,n,i,[o])}function tx(t,e,r,n){const i=ZM(DM.compile(r));return ZM([uM("0x535441524b4e45545f434f4e54524143545f41444452455353"),n,t,e,i])}function ex(t,e){return"attributes"===t||"accessible_scopes"===t?Array.isArray(e)&&0===e.length?void 0:e:"debug_info"===t?null:null===e?void 0:e}function rx(t){let e=!1;const r=[];for(const n of t)'"'===n&&!1==(r.length>0&&"\\"===r.slice(-1)[0])&&(e=!e),e?r.push(n):r.push(":"===n?": ":","===n?", ":n);return r.join("")}function nx(t){const{abi:e,program:r}=t,n=rx(LM({abi:e,program:r},ex));return fA(Gy(sA(n)).toString(16))}function ix(t){const e="string"==typeof t?UM(t):t,r=uk(NA),n=ZM(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),i=ZM(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=ZM(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),s=ZM(e.program.builtins.map((t=>Ok(t)))),a=nx(e),h=ZM(e.program.data);return ZM([r,n,i,o,s,a,h])}function ox(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,tv(e.flatMap((t=>BigInt(Ok(t))))))];var e}));return tv(e)}function sx(t){const e=BigInt(Ok("COMPILED_CLASS_V1")),r=ox(t.entry_points_by_type.EXTERNAL),n=ox(t.entry_points_by_type.L1_HANDLER),i=ox(t.entry_points_by_type.CONSTRUCTOR),o=tv(t.bytecode.map((t=>BigInt(t))));return uk(tv([e,r,n,i,o]))}function ax(t){return tv(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function hx(t){const e=BigInt(Ok("CONTRACT_CLASS_V0.1.0")),r=ax(t.entry_points_by_type.EXTERNAL),n=ax(t.entry_points_by_type.L1_HANDLER),i=ax(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=rx(LM(t.abi,null));return BigInt(fA(Gy(sA(e)).toString(16)))}(t),s=tv(t.sierra_program.map((t=>BigInt(t))));return uk(tv([e,r,n,i,o,s]))}function ux(t){const e="string"==typeof t?UM(t):t;return"sierra_program"in e?hx(e):ix(e)}function lx(t){const e="string"==typeof t?t:LM(t);return uA(NE(e))}function cx(t){if(Array.isArray(t))return t;const e=oA(IE(hA(t)));return UM(e)}function fx(){return By(Py.randomPrivateKey())}function dx(t){return fA(t).toLowerCase()}function px(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>uk(t)));try{const{r:e,s:r}=t;return[uk(e),uk(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function mx(t){return mk(px(t))}function gx(t){return gk(px(t))}function yx(t,e=.5){const r=Math.round(100*(1+e));return ak(t)*ak(r)/100n}function vx(t){return"sierra_program"in("string"==typeof t?UM(t):t)}nA({},{compressProgram:()=>lx,decompressProgram:()=>cx,estimatedFeeToMaxFee:()=>yx,formatSignature:()=>px,makeAddress:()=>dx,randomAddress:()=>fx,signatureToDecimalArray:()=>mx,signatureToHexArray:()=>gx});var wx="undefined"!=typeof window&&window.fetch||"undefined"!=typeof global&&global.fetch||tA;function bx(t){return new Promise((e=>{setTimeout(e,t)}))}function _x(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=rx(LM(t.abi)),e.sierra_program=rx(LM(t.sierra_program)),e.sierra_program=lx(e.sierra_program),e}function Ex(t){const e="string"==typeof t?UM(t):t;return vx(t)?_x(e):{...e,..."program"in e&&{program:lx(e.program)}}}nA({},{createSierraContractClass:()=>_x,parseContract:()=>Ex,wait:()=>bx});var Ax=class extends Error{constructor(t){super(t),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),function(t,e){const{setPrototypeOf:r}=Object;r?r(t,e):t.__proto__=e}(this,new.target.prototype),function(t,e=t.constructor){const{captureStackTrace:r}=Error;r&&r(t,e)}(this)}},kx=class extends Ax{},Mx=class extends kx{constructor(t,e){super(t),this.errorCode=e}},xx=class extends kx{constructor(t,e){super(t),this.errorCode=e}};nA({},{StarknetIdContract:()=>Bx,getStarknetIdContract:()=>Dx,useDecoded:()=>Ox,useEncoded:()=>$x});var Sx="abcdefghijklmnopqrstuvwxyz0123456789-",Nx=BigInt(Sx.length+1),Ix="这来",Cx=BigInt(Sx.length),Tx=BigInt(Ix.length),Px=BigInt(Ix.length+1);function Rx(t){let e=0;for(;t.endsWith(Ix[Ix.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function Ox(t){let e="";return t.forEach((t=>{for(;t!==MA;){const r=t%Nx;if(t/=Nx,r===BigInt(Sx.length)){const r=t/Px;if(r===MA){const n=t%Px;t=r,e+=n===MA?Sx[0]:Ix[Number(n)-1]}else{e+=Ix[Number(t%Tx)],t/=Tx}}else e+=Sx[Number(r)]}const[r,n]=Rx(e);n&&(e=r+(n%2==0?Ix[Ix.length-1].repeat(n/2-1)+Ix[0]+Sx[1]:Ix[Ix.length-1].repeat((n-1)/2+1))),e+="."})),e?e.concat("stark"):e}function $x(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(Ix[0]+Sx[1])){const[e,r]=Rx(t.substring(0,t.length-2));t=e+Ix[Ix.length-1].repeat(2*(r+1))}else{const[e,r]=Rx(t);r&&(t=e+Ix[Ix.length-1].repeat(1+2*(r-1)))}for(let n=0;n<t.length;n+=1){const i=t[n],o=Sx.indexOf(i),s=BigInt(Sx.indexOf(i));if(-1!==o)n===t.length-1&&t[n]===Sx[0]?(e+=r*Cx,r*=Nx,r*=Nx):(e+=r*s,r*=Nx);else if(-1!==Ix.indexOf(i)){e+=r*Cx,r*=Nx;const o=(n===t.length-1?1:0)+Ix.indexOf(i);e+=r*BigInt(o),r*=Tx}}return e}var Bx=(t=>(t.MAINNET="0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",t.TESTNET="0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce",t))(Bx||{});function Dx(t){switch(t){case"0x534e5f4d41494e":return"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678";case"0x534e5f474f45524c49":return"0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce";default:throw new Error("Starknet.id is not yet deployed on this network")}}async function Fx(t,e,r){const n=await t.getChainId(),i=r??Dx(n);try{const r=await t.callContract({contractAddress:i,entrypoint:"address_to_domain",calldata:DM.compile({address:e})}),n=Ox(r.result.map((t=>BigInt(t))).slice(1));if(!n)throw Error("Starkname not found");return n}catch(t){if(t instanceof Error&&"Starkname not found"===t.message)throw t;throw Error("Could not get stark name")}}async function Ux(t,e,r){const n=await t.getChainId(),i=r??Dx(n);try{return(await t.callContract({contractAddress:i,entrypoint:"domain_to_address",calldata:DM.compile({domain:[$x(e.replace(".stark","")).toString(10)]})})).result[0]}catch{throw Error("Could not get address from stark name")}}var jx=Object.values(GA),Lx=class{constructor(t){this.hash=null,this.number=null,this.tag=null,this.valueOf=()=>this.number,this.toString=()=>this.hash,this.setIdentifier(t)}setIdentifier(t){"string"==typeof t&&sk(t)?this.hash=t:"bigint"==typeof t?this.hash=uk(t):"number"==typeof t?this.number=t:"string"==typeof t&&jx.includes(t)?this.tag=t:this.tag="pending"}get queryIdentifier(){return null!==this.number?`blockNumber=${this.number}`:null!==this.hash?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return null!==this.number?{block_number:this.number}:null!==this.hash?{block_hash:this.hash}:this.tag}set identifier(t){this.setIdentifier(t)}get sequencerIdentifier(){return null!==this.hash?{blockHash:this.hash}:{blockNumber:this.number??this.tag}}},zx=(t,e=!1)=>{e||console.warn("Using default public node url, please provide nodeUrl in provider options!");const r="SN_MAIN"===t?$A:OA;return r[Math.floor(Math.random()*r.length)]},qx={"Content-Type":"application/json"},Vx="pending",Hx=200,Gx=class{constructor(t){this.responseParser=new class{parseGetBlockResponse(t){return{timestamp:t.timestamp,block_hash:"block_hash"in t?t.block_hash:"",block_number:"block_number"in t?t.block_number:-1,new_root:"new_root"in t?t.new_root:"",parent_hash:t.parent_hash,status:"status"in t?t.status:"PENDING",transactions:t.transactions}}parseGetTransactionResponse(t){return{calldata:"calldata"in t?t.calldata:[],contract_address:"contract_address"in t?t.contract_address:"",sender_address:"sender_address"in t?t.sender_address:"",max_fee:"max_fee"in t?t.max_fee:"",nonce:"nonce"in t?t.nonce:"",signature:"signature"in t?t.signature:[],transaction_hash:t.transaction_hash,version:t.version}}parseFeeEstimateResponse(t){return{overall_fee:ak(t[0].overall_fee),gas_consumed:ak(t[0].gas_consumed),gas_price:ak(t[0].gas_price)}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:ak(t.overall_fee),gas_consumed:ak(t.gas_consumed),gas_price:ak(t.gas_price)})))}parseCallContractResponse(t){return{result:t}}parseSimulateTransactionResponse(t){return t.map((t=>({...t,suggestedMaxFee:yx(BigInt(t.fee_estimation.overall_fee))})))}parseContractClassResponse(t){return{...t,abi:"string"==typeof t.abi?JSON.parse(t.abi):t.abi}}},this.getBlockHashAndNumber=this.getBlockLatestAccepted,this.getStateUpdate=this.getBlockStateUpdate,this.traceBlockTransactions=this.getBlockTransactionsTraces,this.getTransactionCount=this.getBlockTransactionCount,this.traceTransaction=this.getTransactionTrace,this.getSimulateTransaction=this.simulateTransaction;const{nodeUrl:e,retries:r,headers:n,blockIdentifier:i,chainId:o}=t||{};Object.values(CA).includes(e)?this.nodeUrl=zx(e,t?.default):this.nodeUrl=e||zx(void 0,t?.default),this.retries=r||Hx,this.headers={...qx,...n},this.blockIdentifier=i||Vx,this.chainId=o}fetch(t,e,r=0){const n={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return wx(this.nodeUrl,{method:"POST",body:LM(n),headers:this.headers})}errorHandler(t,e,r,n){if(r){const{code:n,message:i,data:o}=r;throw new kx(`RPC: ${t} with params ${LM(e)}\n ${n}: ${i}: ${LM(o)}`)}if(n instanceof kx)throw n;if(n)throw Error(n.message)}async fetchEndpoint(t,e){try{const r=await this.fetch(t,e),{error:n,result:i}=await r.json();return this.errorHandler(t,e,n),i}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??(this.chainId=await this.fetchEndpoint("starknet_chainId")),this.chainId}async getSpecVersion(){return this.fetchEndpoint("starknet_specVersion")}async getNonceForAddress(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:n})}async getBlock(t=this.blockIdentifier){return this.getBlockWithTxHashes(t).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}async getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}async getBlockWithTxHashes(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}async getBlockWithTxs(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}async getBlockStateUpdate(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}async getBlockTransactionsTraces(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}async getBlockTransactionCount(t=this.blockIdentifier){const e=new Lx(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}async getPendingTransactions(){const{transactions:t}=await this.getBlock("pending");return Promise.all(t.map((t=>this.getTransactionByHash(t))))}async getTransaction(t){return this.getTransactionByHash(t).then(this.responseParser.parseGetTransactionResponse)}async getTransactionByHash(t){const e=uk(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}async getTransactionByBlockIdAndIndex(t,e){const r=new Lx(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}async getTransactionReceipt(t){const e=uk(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}async getTransactionTrace(t){const e=uk(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}async getTransactionStatus(t){const e=uk(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}async simulateTransaction(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1,skipFeeCharge:n=!0}){const i=new Lx(e).identifier,o=[];return r&&o.push(KA.ESimulationFlag.SKIP_VALIDATE),n&&o.push(KA.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:i,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:o}).then(this.responseParser.parseSimulateTransactionResponse)}async waitForTransaction(t,e){const r=uk(t);let{retries:n}=this,i=!1,o=!1;const s=e?.retryInterval??5e3,a=e?.errorStates??[KA.ETransactionStatus.REJECTED,KA.ETransactionExecutionStatus.REVERTED],h=e?.successStates??[KA.ETransactionExecutionStatus.SUCCEEDED,KA.ETransactionStatus.ACCEPTED_ON_L2,KA.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!i;){await bx(s);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(h.includes(t)||h.includes(e))i=!0;else if(a.includes(t)||a.includes(e)){const r=`${t}: ${e}`,n=new Error(r);throw n.response=u,o=!0,n}}catch(t){if(t instanceof Error&&o)throw t;if(n<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}n-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(n<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}n-=1,await bx(s)}return l}async getStorageAt(t,e,r=this.blockIdentifier){const n=uk(t),i=ck(e),o=new Lx(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:n,key:i,block_id:o})}async getClassHashAt(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:n,contract_address:r})}async getClassByHash(t){return this.getClass(t)}async getClass(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:n}).then(this.responseParser.parseContractClassResponse)}async getClassAt(t,e=this.blockIdentifier){const r=uk(t),n=new Lx(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:n,contract_address:r}).then(this.responseParser.parseContractClassResponse)}async getCode(t,e){throw new Error("RPC does not implement getCode function")}async getContractVersion(t,e,{blockIdentifier:r=this.blockIdentifier,compiler:n=!0}={}){let i;if(t)i=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");i=await this.getClass(e,r)}if(vx(i)){if(n){return{cairo:"1",compiler:sM(i.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async getEstimateFee(t,e,r=this.blockIdentifier){return this.getInvokeEstimateFee(t,e,r)}async getInvokeEstimateFee(t,e,r=this.blockIdentifier){const n=new Lx(r).identifier,i=this.buildTransaction({type:"INVOKE_FUNCTION",...t,...e},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[i],block_id:n}).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(t,e,r=this.blockIdentifier){const n=new Lx(r).identifier,i=this.buildTransaction({type:"DECLARE",...t,...e},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[i],block_id:n}).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(t,e,r=this.blockIdentifier){const n=new Lx(r).identifier,i=this.buildTransaction({type:"DEPLOY_ACCOUNT",...t,...e},"fee");return this.fetchEndpoint("starknet_estimateFee",{request:[i],block_id:n}).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1}){r&&console.warn("getEstimateFeeBulk RPC does not support skipValidate");const n=new Lx(e).identifier;return this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:n}).then(this.responseParser.parseFeeEstimateBulkResponse)}async invokeFunction(t,e){return this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:DM.toHex(t.calldata),type:KA.ETransactionType.INVOKE,max_fee:uk(e.maxFee||0),version:"0x1",signature:gx(t.signature),nonce:uk(e.nonce)}})}async declareContract({contract:t,signature:e,senderAddress:r,compiledClassHash:n},i){return vx(t)?this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:KA.ETransactionType.DECLARE,contract_class:{sierra_program:cx(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:n||"",version:bA,max_fee:uk(i.maxFee||0),signature:gx(e),sender_address:r,nonce:uk(i.nonce)}}):this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:KA.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:wA,max_fee:uk(i.maxFee||0),signature:gx(e),sender_address:r,nonce:uk(i.nonce)}})}async deployAccountContract({classHash:t,constructorCalldata:e,addressSalt:r,signature:n},i){return this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:DM.toHex(e||[]),class_hash:uk(t),contract_address_salt:uk(r||0),type:KA.ETransactionType.DEPLOY_ACCOUNT,max_fee:uk(i.maxFee||0),version:uk(i.version||0),signature:gx(n),nonce:uk(i.nonce)}})}async callContract(t,e=this.blockIdentifier){const r=new Lx(e).identifier,n=await this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:Mk(t.entrypoint),calldata:DM.toHex(t.calldata)},block_id:r});return this.responseParser.parseCallContractResponse(n)}async estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:n,entry_point_selector:i,payload:o}=t,s={from_address:uk(r),to_address:uk(n),entry_point_selector:xk(i),payload:bk(o)},a=new Lx(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:s,block_id:a})}async getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}async getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}async getStarkName(t,e){return Fx(this,t,e)}async getAddressFromStarkName(t,e){return Ux(this,t,e)}buildTransaction(t,e){const r=KM(e),n={signature:gx(t.signature),nonce:uk(t.nonce),max_fee:uk(t.maxFee||0)};if("INVOKE_FUNCTION"===t.type)return{type:KA.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:DM.toHex(t.calldata),version:uk(t.version||r.v1),...n};if("DECLARE"===t.type)return vx(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:cx(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:uk(t.version||r.v2),...n}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:uk(t.version||r.v1),...n};if("DEPLOY_ACCOUNT"===t.type)return{type:t.type,constructor_calldata:DM.toHex(t.constructorCalldata||[]),class_hash:uk(t.classHash),contract_address_salt:uk(t.addressSalt||0),version:uk(t.version||r.v1),...n};throw Error("RPC buildTransaction received unknown TransactionType")}},Kx=/^(?:\w+:)?\/\/(\S+)$/,Zx=/^localhost[:?\d]*(?:[^:?\d]\S*)?$/,Jx=/^[^\s.]+\.\S{2,}$/;function Qx(t,e,r){return function(t){if(!t)return!1;if("string"!=typeof t)return!1;const e=t.match(Kx);if(!e)return!1;const r=e[1];return!(!r||!Zx.test(r)&&!Jx.test(r))}(r)?r:eA(t,r??e)}var Yx={network:"SN_GOERLI",blockIdentifier:"pending"},Wx=class{constructor(t=Yx){this.responseParser=new class extends class{}{parseGetBlockResponse(t){return{...t,new_root:t.state_root,parent_hash:t.parent_block_hash,transactions:Object.values(t.transactions).map((t=>"transaction_hash"in t&&t.transaction_hash)).filter(Boolean)}}parseGetTransactionResponse(t){if("NOT_RECEIVED"===t.status&&"NOT_RECEIVED"===t.finality_status)throw new kx;return{...t,calldata:"calldata"in t.transaction?t.transaction.calldata:[],contract_class:"contract_class"in t.transaction?t.transaction.contract_class:void 0,entry_point_selector:"entry_point_selector"in t.transaction?t.transaction.entry_point_selector:void 0,max_fee:"max_fee"in t.transaction?t.transaction.max_fee:void 0,nonce:t.transaction.nonce,sender_address:"sender_address"in t.transaction?t.transaction.sender_address:void 0,signature:"signature"in t.transaction?t.transaction.signature:void 0,transaction_hash:"transaction_hash"in t.transaction?t.transaction.transaction_hash:void 0,version:"version"in t.transaction?t.transaction.version:void 0}}parseGetTransactionReceiptResponse(t){return{...t,messages_sent:t.l2_to_l1_messages,..."revert_error"in t&&{revert_reason:t.revert_error}}}parseFeeEstimateResponse(t){if("overall_fee"in t){let e={};try{e={gas_consumed:ak(t.gas_usage),gas_price:ak(t.gas_price)}}catch{}return{overall_fee:ak(t.overall_fee),...e}}return{overall_fee:ak(t.amount)}}parseFeeEstimateBulkResponse(t){return[].concat(t).map((t=>{if("overall_fee"in t){let e={};try{e={gas_consumed:ak(t.gas_usage),gas_price:ak(t.gas_price)}}catch{}return{overall_fee:ak(t.overall_fee),...e}}return{overall_fee:ak(t.amount)}}))}parseSimulateTransactionResponse(t){const e="overall_fee"in t.fee_estimation?t.fee_estimation.overall_fee:t.fee_estimation.amount;return[{transaction_trace:t.trace,fee_estimation:t.fee_estimation,suggestedMaxFee:yx(BigInt(e))}]}parseCallContractResponse(t){return{result:t.result}}parseInvokeFunctionResponse(t){return{transaction_hash:t.transaction_hash}}parseDeployContractResponse(t){return{transaction_hash:t.transaction_hash,contract_address:t.address}}parseDeclareContractResponse(t){return{transaction_hash:t.transaction_hash,class_hash:t.class_hash}}parseGetStateUpdateResponse(t){const e=Object.entries(t.state_diff.nonces).map((([t,e])=>({contract_address:t,nonce:e}))),r=Object.entries(t.state_diff.storage_diffs).map((([t,e])=>({address:t,storage_entries:e})));return{...t,state_diff:{...t.state_diff,storage_diffs:r,nonces:e}}}parseContractClassResponse(t){const e=vx(t)?t:Ex(t);return{...e,abi:"string"==typeof e.abi?JSON.parse(e.abi):e.abi}}},"network"in t?(this.baseUrl=Wx.getNetworkFromName(t.network),this.feederGatewayUrl=Qx(this.baseUrl,"feeder_gateway"),this.gatewayUrl=Qx(this.baseUrl,"gateway")):(this.baseUrl=t.baseUrl,this.feederGatewayUrl=Qx(this.baseUrl,"feeder_gateway",t.feederGatewayUrl),this.gatewayUrl=Qx(this.baseUrl,"gateway",t.gatewayUrl)),this.chainId=t?.chainId??Wx.getChainIdFromBaseUrl(this.baseUrl),this.headers=t.headers,this.blockIdentifier=t?.blockIdentifier||Yx.blockIdentifier}static getNetworkFromName(t){switch(t){case"SN_MAIN":case"0x534e5f4d41494e":return"https://alpha-mainnet.starknet.io";case"SN_GOERLI":case"0x534e5f474f45524c49":return"https://alpha4.starknet.io";default:throw new Error("Could not detect base url from NetworkName")}}static getChainIdFromBaseUrl(t){try{return new URL(t).host.includes("mainnet.starknet.io")?"0x534e5f4d41494e":"0x534e5f474f45524c49"}catch{return console.error(`Could not parse baseUrl: ${t}`),"0x534e5f474f45524c49"}}getFetchUrl(t){return["add_transaction"].includes(t)?this.gatewayUrl:this.feederGatewayUrl}getFetchMethod(t){return["add_transaction","call_contract","estimate_fee","estimate_message_fee","estimate_fee_bulk","simulate_transaction"].includes(t)?"POST":"GET"}getQueryString(t){if(void 0===(e=t)||0===Object.keys(e).length||1===Object.keys(e).length&&Object.entries(e).every((([t,e])=>"blockIdentifier"===t&&null===e)))return"";var e;const r=Object.entries(t).map((([t,e])=>{if("blockIdentifier"===t){return`${new Lx(e).queryIdentifier}`}return`${t}=${e}`})).join("&");return`?${r}`}getHeaders(t){return"POST"===t?{"Content-Type":"application/json",...this.headers}:this.headers}async fetchEndpoint(t,...[e,r]){const n=this.getFetchUrl(t),i=this.getFetchMethod(t),o=this.getQueryString(e),s=eA(n,t,o);return this.fetch(s,{method:i,body:r})}async fetch(t,e){const r=Qx(this.baseUrl,"",t),n=e?.method??"GET",i=this.getHeaders(n),o=LM(e?.body);try{const t=await wx(r,{method:n,body:o,headers:i}),s=await t.text();if(!t.ok){let e;try{e=UM(s)}catch{throw new xx(t.statusText,t.status)}throw new Mx(e.message,e.code)}return(e?.parseAlwaysAsBigInt?jM:UM)(s)}catch(t){if(t instanceof Error&&!(t instanceof kx))throw Error(`Could not ${n} from endpoint \`${r}\`: ${t.message}`);throw t}}async getChainId(){return Promise.resolve(this.chainId)}async callContract({contractAddress:t,entrypoint:e,calldata:r=[]},n=this.blockIdentifier){return this.fetchEndpoint("call_contract",{blockIdentifier:n},{contract_address:t,entry_point_selector:Mk(e),calldata:DM.compile(r)}).then(this.responseParser.parseCallContractResponse)}async getBlock(t=this.blockIdentifier){return this.fetchEndpoint("get_block",{blockIdentifier:t}).then(this.responseParser.parseGetBlockResponse)}async getNonceForAddress(t,e=this.blockIdentifier){return this.fetchEndpoint("get_nonce",{contractAddress:t,blockIdentifier:e})}async getStorageAt(t,e,r=this.blockIdentifier){const n=ak(e).toString(10);return this.fetchEndpoint("get_storage_at",{blockIdentifier:r,contractAddress:t,key:n})}async getTransaction(t){const e=uk(t);return this.fetchEndpoint("get_transaction",{transactionHash:e}).then((t=>{if(1===Object.values(t).length)throw new kx(t.status);return this.responseParser.parseGetTransactionResponse(t)}))}async getTransactionReceipt(t){const e=uk(t);return this.fetchEndpoint("get_transaction_receipt",{transactionHash:e}).then(this.responseParser.parseGetTransactionReceiptResponse)}async getClassAt(t,e=this.blockIdentifier){return this.fetchEndpoint("get_full_contract",{blockIdentifier:e,contractAddress:t}).then(this.responseParser.parseContractClassResponse)}async getClassHashAt(t,e=this.blockIdentifier){return this.fetchEndpoint("get_class_hash_at",{blockIdentifier:e,contractAddress:t})}async getClassByHash(t,e=this.blockIdentifier){return this.fetchEndpoint("get_class_by_hash",{classHash:t,blockIdentifier:e}).then(this.responseParser.parseContractClassResponse)}async getCompiledClassByClassHash(t,e=this.blockIdentifier){return this.fetchEndpoint("get_compiled_class_by_class_hash",{classHash:t,blockIdentifier:e})}async getContractVersion(t,e,{blockIdentifier:r=this.blockIdentifier,compiler:n=!0}={}){let i;if(t)i=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");i=await this.getClassByHash(e,r)}if(vx(i)){if(n){return{cairo:"1",compiler:sM(i.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async invokeFunction(t,e){return this.fetchEndpoint("add_transaction",void 0,{type:"INVOKE_FUNCTION",sender_address:t.contractAddress,calldata:DM.compile(t.calldata??[]),signature:mx(t.signature),nonce:uk(e.nonce),max_fee:uk(e.maxFee||0),version:"0x1"}).then(this.responseParser.parseInvokeFunctionResponse)}async deployAccountContract({classHash:t,constructorCalldata:e,addressSalt:r,signature:n},i){return this.fetchEndpoint("add_transaction",void 0,{type:"DEPLOY_ACCOUNT",contract_address_salt:r??fx(),constructor_calldata:DM.compile(e??[]),class_hash:uk(t),max_fee:uk(i.maxFee||0),version:uk(i.version||0),nonce:uk(i.nonce),signature:mx(n)}).then(this.responseParser.parseDeployContractResponse)}async declareContract({senderAddress:t,contract:e,signature:r,compiledClassHash:n},i){return vx(e)?this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",sender_address:t,compiled_class_hash:n,contract_class:e,nonce:uk(i.nonce),signature:mx(r),max_fee:uk(i.maxFee||0),version:uk(VM)}).then(this.responseParser.parseDeclareContractResponse):this.fetchEndpoint("add_transaction",void 0,{type:"DECLARE",contract_class:e,nonce:uk(i.nonce),signature:mx(r),sender_address:t,max_fee:uk(i.maxFee||0),version:uk(qM)}).then(this.responseParser.parseDeclareContractResponse)}async getEstimateFee(t,e,r=this.blockIdentifier,n=!1){return this.getInvokeEstimateFee(t,e,r,n)}async getInvokeEstimateFee(t,e,r=this.blockIdentifier,n=!1){const i=this.buildTransaction({type:"INVOKE_FUNCTION",...t,...e},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:r,skipValidate:n},i).then(this.responseParser.parseFeeEstimateResponse)}async getDeclareEstimateFee(t,e,r=this.blockIdentifier,n=!1){const i=this.buildTransaction({type:"DECLARE",...t,...e},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:r,skipValidate:n},i).then(this.responseParser.parseFeeEstimateResponse)}async getDeployAccountEstimateFee(t,e,r=this.blockIdentifier,n=!1){const i=this.buildTransaction({type:"DEPLOY_ACCOUNT",...t,...e},"fee");return this.fetchEndpoint("estimate_fee",{blockIdentifier:r,skipValidate:n},i).then(this.responseParser.parseFeeEstimateResponse)}async getEstimateFeeBulk(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1}){const n=t.map((t=>this.buildTransaction(t,"fee")));return this.fetchEndpoint("estimate_fee_bulk",{blockIdentifier:e,skipValidate:r},n).then(this.responseParser.parseFeeEstimateBulkResponse)}async getCode(t,e=this.blockIdentifier){return this.fetchEndpoint("get_code",{contractAddress:t,blockIdentifier:e})}async waitForTransaction(t,e){let r,n=!1,i=0;const o=e?.retryInterval??5e3,s=e?.errorStates??["REJECTED","NOT_RECEIVED","REVERTED"],a=e?.successStates??["SUCCEEDED","ACCEPTED_ON_L1","ACCEPTED_ON_L2"];for(;!n;)if(await bx(o),r=await this.getTransactionStatus(t),"NOT_RECEIVED"===r.finality_status&&i<3)i+=1;else if(a.includes(r.finality_status)||a.includes(r.execution_status))n=!0;else if(s.includes(r.finality_status)||s.includes(r.execution_status)){let t;t=r.tx_failure_reason?`${r.tx_status}: ${r.tx_failure_reason.code}\n${r.tx_failure_reason.error_message}`:r.tx_revert_reason?`${r.tx_status}: ${r.tx_revert_reason}`:r.tx_status;const e=new Error(t);throw e.response=r,e}return await this.getTransactionReceipt(t)}async getTransactionStatus(t){const e=uk(t);return this.fetchEndpoint("get_transaction_status",{transactionHash:e})}async getContractAddresses(){return this.fetchEndpoint("get_contract_addresses")}async getTransactionTrace(t){const e=uk(t);return this.fetchEndpoint("get_transaction_trace",{transactionHash:e})}async estimateMessageFee({from_address:t,to_address:e,entry_point_selector:r,payload:n},i=this.blockIdentifier){const o={from_address:vk(t),to_address:wk(e),entry_point_selector:xk(r),payload:bk(n)};return this.fetchEndpoint("estimate_message_fee",{blockIdentifier:i},o)}async getSimulateTransaction(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!1,skipExecute:n=!1}){t.length>1&&console.warn("Sequencer simulate process only first element from invocations list"),n&&console.warn("Sequencer can't skip account __execute__");const i=this.buildTransaction(t[0]);return this.fetchEndpoint("simulate_transaction",{blockIdentifier:e,skipValidate:r??!1},i).then(this.responseParser.parseSimulateTransactionResponse)}async getStateUpdate(t=this.blockIdentifier){const e=new Lx(t).sequencerIdentifier;return this.fetchEndpoint("get_state_update",{...e}).then(this.responseParser.parseGetStateUpdateResponse)}async getBlockTraces(t=this.blockIdentifier){const e=new Lx(t).sequencerIdentifier;return this.fetchEndpoint("get_block_traces",{...e})}async getStarkName(t,e){return Fx(this,t,e)}async getAddressFromStarkName(t,e){return Ux(this,t,e)}buildTransaction(t,e){const r=KM(e),n={signature:mx(t.signature),nonce:uk(t.nonce)};if("INVOKE_FUNCTION"===t.type)return{type:t.type,sender_address:t.contractAddress,calldata:DM.compile(t.calldata??[]),version:uk(t.version||r.v1),...n};if("DECLARE"===t.type)return vx(t.contract)?{type:t.type,contract_class:t.contract,compiled_class_hash:t.compiledClassHash,sender_address:t.senderAddress,version:uk(t.version||r.v2),...n}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:uk(t.version||r.v1),...n};if("DEPLOY_ACCOUNT"===t.type)return{type:t.type,constructor_calldata:DM.compile(t.constructorCalldata||[]),class_hash:uk(t.classHash),contract_address_salt:uk(t.addressSalt||0),version:uk(t.version||r.v1),...n};throw Error("Sequencer buildTransaction received unknown TransactionType")}},Xx=class{constructor(t){this.provider=t instanceof Xx?t.provider:t instanceof Gx||t instanceof Wx?t:t&&"rpc"in t?new Gx(t.rpc):t&&"sequencer"in t?new Wx(t.sequencer):new Gx}async getChainId(){return this.provider.getChainId()}async getBlock(t){return this.provider.getBlock(t)}async getClassAt(t,e){return this.provider.getClassAt(t,e)}async getClassHashAt(t,e){return this.provider.getClassHashAt(t,e)}getClassByHash(t){return this.provider.getClassByHash(t)}async getEstimateFee(t,e,r){return this.provider.getEstimateFee(t,e,r)}async getInvokeEstimateFee(t,e,r,n){return this.provider.getInvokeEstimateFee(t,e,r,n)}async getEstimateFeeBulk(t,e){return this.provider.getEstimateFeeBulk(t,e)}async getNonceForAddress(t,e){return this.provider.getNonceForAddress(t,e)}async getStorageAt(t,e,r){return this.provider.getStorageAt(t,e,r)}async getTransaction(t){return this.provider.getTransaction(t)}async getTransactionReceipt(t){return this.provider.getTransactionReceipt(t)}async callContract(t,e){return this.provider.callContract(t,e)}async invokeFunction(t,e){return this.provider.invokeFunction(t,e)}async deployAccountContract(t,e){return this.provider.deployAccountContract(t,e)}async declareContract(t,e){return this.provider.declareContract(t,e)}async getDeclareEstimateFee(t,e,r,n){return this.provider.getDeclareEstimateFee(t,e,r,n)}getDeployAccountEstimateFee(t,e,r,n){return this.provider.getDeployAccountEstimateFee(t,e,r,n)}async getCode(t,e){return this.provider.getCode(t,e)}async waitForTransaction(t,e){return this.provider.waitForTransaction(t,e)}async getSimulateTransaction(t,e){return this.provider.getSimulateTransaction(t,e)}async getStateUpdate(t){return this.provider.getStateUpdate(t)}async getStarkName(t,e){return Fx(this,t,e)}async getAddressFromStarkName(t,e){return Ux(this,t,e)}async getContractVersion(t,e,r){return this.provider.getContractVersion(t,e,r)}};nA({},{fromCallsToExecuteCalldata:()=>eS,fromCallsToExecuteCalldataWithNonce:()=>rS,fromCallsToExecuteCalldata_cairo1:()=>iS,getExecuteCalldata:()=>oS,transformCallsToMulticallArrays:()=>tS,transformCallsToMulticallArrays_cairo1:()=>nS});var tS=t=>{const e=[],r=[];return t.forEach((t=>{const n=DM.compile(t.calldata||[]);e.push({to:ak(t.contractAddress).toString(10),selector:ak(Mk(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:n.length.toString()}),r.push(...n)})),{callArray:e,calldata:DM.compile({calldata:r})}},eS=t=>{const{callArray:e,calldata:r}=tS(t);return[...DM.compile({callArray:e}),...r]},rS=(t,e)=>[...eS(t),ak(e).toString()],nS=t=>{const e=t.map((t=>({to:ak(t.contractAddress).toString(10),selector:ak(Mk(t.entrypoint)).toString(10),calldata:DM.compile(t.calldata||[])})));return e},iS=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:DM.compile(t.calldata)})));return DM.compile({orderCalls:e})},oS=(t,e="0")=>"1"===e?iS(t):eS(t),sS={};nA(sS,{encodeData:()=>gS,encodeType:()=>dS,encodeValue:()=>mS,getDependencies:()=>fS,getMessageHash:()=>vS,getStructHash:()=>yS,getTypeHash:()=>pS,isMerkleTreeType:()=>cS,prepareSelector:()=>lS});nA({},{MerkleTree:()=>aS,proofMerklePath:()=>hS});var aS=class{constructor(t){this.branches=[],this.leaves=t,this.root=this.build(t)}build(t){if(1===t.length)return t[0];t.length!==this.leaves.length&&this.branches.push(t);const e=[];for(let r=0;r<t.length;r+=2)r+1===t.length?e.push(aS.hash(t[r],"0x0")):e.push(aS.hash(t[r],t[r+1]));return this.build(e)}static hash(t,e){const[r,n]=[ak(t),ak(e)].sort(((t,e)=>t>=e?1:-1));return Vy(r,n)}getProof(t,e=this.leaves,r=[]){const n=e.indexOf(t);if(-1===n)throw new Error("leaf not found");if(1===e.length)return r;const i=n%2==0,o=(i?e[n+1]:e[n-1])??"0x0",s=[...r,o],a=this.leaves.length===e.length?-1:this.branches.findIndex((t=>t.length===e.length)),h=this.branches[a+1]??[this.root];return this.getProof(aS.hash(i?t:o,i?o:t),h,s)}};function hS(t,e,r){if(0===r.length)return t===e;const[n,...i]=r;return hS(t,aS.hash(e,n),i)}function uS(t){try{return uk(t)}catch(e){if("string"==typeof t)return uk(Ok(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function lS(t){return sk(t)?t:Mk(t)}function cS(t){return"merkletree"===t.type}var fS=(t,e,r=[])=>("*"===e[e.length-1]&&(e=e.slice(0,-1)),r.includes(e)?r:t[e]?[e,...t[e].reduce(((e,r)=>[...e,...fS(t,r.type,e).filter((t=>!e.includes(t)))]),[])]:r);var dS=(t,e)=>{const[r,...n]=fS(t,e);return(r?[r,...n.sort()]:[]).map((e=>`${e}(${t[e].map((t=>`${t.name}:${t.type}`))})`)).join("")},pS=(t,e)=>Mk(dS(t,e)),mS=(t,e,r,n={})=>{if(t[e])return[e,yS(t,e,r)];if(Object.keys(t).map((t=>`${t}*`)).includes(e)){const n=r.map((r=>yS(t,e.slice(0,-1),r)));return[e,ZM(n)]}if("merkletree"===e){const e=function(t,e){if(e.parent&&e.key){const r=t[e.parent].find((t=>t.name===e.key));if(!cS(r))throw new Error(`${e.key} is not a merkle tree`);if(r.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${e.key}`);return r.contains}return"raw"}(t,n),i=r.map((r=>mS(t,e,r)[1])),{root:o}=new aS(i);return["felt",o]}return"felt*"===e?["felt*",ZM(r)]:"selector"===e?["felt",lS(r)]:[e,uS(r)]},gS=(t,e,r)=>{const[n,i]=t[e].reduce((([n,i],o)=>{if(void 0===r[o.name]||null===r[o.name])throw new Error(`Cannot encode data: missing data for '${o.name}'`);const s=r[o.name],[a,h]=mS(t,o.type,s,{parent:e,key:o.name});return[[...n,a],[...i,h]]}),[["felt"],[pS(t,e)]]);return[n,i]},yS=(t,e,r)=>ZM(gS(t,e,r)[1]),vS=(t,e)=>{if(!(t=>{const e=t;return Boolean(e.types&&e.primaryType&&e.message)})(t))throw new Error("Typed data does not match JSON schema");return ZM([Ok("StarkNet Message"),yS(t.types,"StarkNetDomain",t.domain),e,yS(t.types,t.primaryType,t.message)])},wS=new Xx({rpc:{default:!0}});function bS(t){return t.filter((t=>"event"===t.type&&(t.size||"enum"!==t.kind))).reduce(((t,e)=>{const r=e.name.slice(e.name.lastIndexOf(":")+1),n={...e};return n.name=r,{...t,[fA(Gy(sA(r)).toString(16))]:n}}),{})}function _S(t,e,r,n){const i=t.flat().reduce(((t,i)=>{const o=e[i.keys[0]];if(!o)return t;const s={};s[o.name]={},i.keys.shift();const a=i.keys[Symbol.iterator](),h=i.data[Symbol.iterator](),u=o.members?.filter((t=>"key"===t.kind))||o.keys,l=o.members?.filter((t=>"data"===t.kind))||o.data;return u.forEach((t=>{s[o.name][t.name]=NM(a,t,r,n,s[o.name])})),l.forEach((t=>{s[o.name][t.name]=NM(h,t,r,n,s[o.name])})),t.push(s),t}),[]);return i}nA({},{getAbiEvents:()=>bS,parseEvents:()=>_S});var ES=t=>{const e=t[t.length-1];return"object"==typeof e&&["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"].some((t=>t in e))?{args:t,options:t.pop()}:{args:t}};function AS(t,e){return async function(...r){const n=ES(r);return t.call(e.name,n.args,{parseRequest:!0,parseResponse:!0,...n.options})}}function kS(t,e){return"view"===e.stateMutability||"view"===e.state_mutability?AS(t,e):function(t,e){return async function(...r){const n=ES(r);return t.invoke(e.name,n.args,{parseRequest:!0,...n.options})}}(t,e)}function MS(t,e){return function(...r){return t.estimate(e.name,r)}}function xS(t,e){return Array.isArray(t)&&"__compiled__"in t?t:Array.isArray(t)&&Array.isArray(t[0])&&"__compiled__"in t[0]?t[0]:e()}var SS=class{constructor(t,e,r=wS){this.address=e&&e.toLowerCase(),this.providerOrAccount=r,this.callData=new DM(t),this.structs=DM.getAbiStruct(t),this.events=bS(t);const n=vM(t);this.abi=n.getLegacyFormat();const i={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach((t=>{if("function"!==t.type)return;const e=t.name;var r,n;this[e]||Object.defineProperty(this,e,{...i,value:kS(this,t)}),this.functions[e]||Object.defineProperty(this.functions,e,{...i,value:kS(this,t)}),this.callStatic[e]||Object.defineProperty(this.callStatic,e,{...i,value:AS(this,t)}),this.populateTransaction[e]||Object.defineProperty(this.populateTransaction,e,{...i,value:(r=this,n=t,function(...t){return r.populate(n.name,t)})}),this.estimateFee[e]||Object.defineProperty(this.estimateFee,e,{...i,value:MS(this,t)})}))}attach(t){this.address=t}connect(t){this.providerOrAccount=t}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(t,e=[],{parseRequest:r=!0,parseResponse:n=!0,formatResponse:i,blockIdentifier:o}={}){ok(null!==this.address,"contract is not connected to an address");const s=xS(e,(()=>r?(this.callData.validate("CALL",t,e),this.callData.compile(t,e)):(console.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),e)));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:s,entrypoint:t},o).then((e=>n?i?this.callData.format(t,e.result,i):this.callData.parse(t,e.result):e.result))}invoke(t,e=[],{parseRequest:r=!0,maxFee:n,nonce:i,signature:o}={}){ok(null!==this.address,"contract is not connected to an address");const s=xS(e,(()=>r?(this.callData.validate("INVOKE",t,e),this.callData.compile(t,e)):(console.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),e))),a={contractAddress:this.address,calldata:s,entrypoint:t};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(a,void 0,{maxFee:n,nonce:i});if(!i)throw new Error("Nonce is required when invoking a function without an account");return console.warn(`Invoking ${t} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...a,signature:o},{nonce:i})}async estimate(t,e=[]){ok(null!==this.address,"contract is not connected to an address"),xS(e,(()=>!1))||this.callData.validate("INVOKE",t,e);const r=this.populate(t,e);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(r);throw Error("Contract must be connected to the account contract to estimate")}populate(t,e=[]){const r=xS(e,(()=>this.callData.compile(t,e)));return{contractAddress:this.address,entrypoint:t,calldata:r}}parseEvents(t){return _S(t.events?.filter((t=>dk(t.from_address)===dk(this.address)),[])||[],this.events,this.structs,DM.getAbiEnum(this.abi))}isCairo1(){return Bk.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typed(t){return this}};function NS(t){pk(t,MA,SA,"Starknet Address");const e=function(t){return fA(cA(uk(t)).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return e}const IS={SN_MAIN:"https://starknet-mainnet.public.blastapi.io",SN_SEPOLIA:"https://starknet-sepolia.public.blastapi.io"},CS=[{name:"argent::account::interface::IDeprecatedArgentAccount",type:"interface",items:[{name:"isValidSignature",type:"function",inputs:[{name:"hash",type:"core::felt252"},{name:"signatures",type:"core::array::Array::<core::felt252>"}],outputs:[{type:"core::felt252"}],state_mutability:"view"}]}];function TS(t,e){var r;if(!IS[t])throw new Error("Invalid network");return new Gx({nodeUrl:null!==(r=null==e?void 0:e.broviderUrl)&&void 0!==r?r:IS[t]})}function PS(t){return!!t.primaryType&&!!t.types.StarkNetDomain}function RS(t,e){const{domain:r,types:n,primaryType:i,message:o}=t;return sS.getMessageHash({types:n,primaryType:i,domain:r,message:o},e)}var OS=Object.freeze({__proto__:null,isStarknetMessage:PS,getHash:RS,default:function(t,r,n){return e(this,arguments,void 0,(function*(t,e,r,n="SN_MAIN",i={}){const o=new SS(CS,t,TS(n,i));return yield o.isValidSignature(RS(r,t),[e[0],e[1]]),!0}))}});function $S(t){return we(En(t))}var BS=window&&window.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{h(n.next(t))}catch(t){o(t)}}function a(t){try{h(n.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const DS=new y("hash/5.6.1"),FS=new Uint8Array(32);FS.fill(0);const US=qt.from(-1),jS=qt.from(0),LS=qt.from(1),zS=qt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const qS=O(LS.toHexString(),32),VS=O(jS.toHexString(),32),HS={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},GS=["name","version","chainId","verifyingContract","salt"];function KS(t){return function(e){return"string"!=typeof e&&DS.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const ZS={name:KS("name"),version:KS("version"),chainId:function(t){try{return qt.from(t).toString()}catch(t){}return DS.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Pe(t).toLowerCase()}catch(t){}return DS.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=k(t);if(32!==e.length)throw new Error("bad length");return I(e)}catch(t){}return DS.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function JS(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&DS.throwArgumentError("invalid numeric width","type",t);const i=zS.mask(r?n-1:n),o=r?i.add(LS).mul(US):jS;return function(e){const r=qt.from(e);return(r.lt(o)||r.gt(i))&&DS.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),O(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&DS.throwArgumentError("invalid bytes width","type",t),function(e){return k(e).length!==r&&DS.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=k(t),r=e.length%32;return r?P([e,FS.slice(r)]):I(e)}(e)}}}switch(t){case"address":return function(t){return O(Pe(t),32)};case"bool":return function(t){return t?qS:VS};case"bytes":return function(t){return we(t)};case"string":return function(t){return $S(t)}}return null}function QS(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class YS{constructor(t){gr(this,"types",Object.freeze(Ar(t))),gr(this,"_encoderCache",{}),gr(this,"_types",{});const e={},r={},n={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],n[t]={}}));for(const n in t){const i={};t[n].forEach((o=>{i[o.name]&&DS.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&DS.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);JS(s)||(r[s]||DS.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)}))}const i=Object.keys(r).filter((t=>0===r[t].length));0===i.length?DS.throwArgumentError("missing primary type","types",t):i.length>1&&DS.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),gr(this,"primaryType",i[0]),function i(o,s){s[o]&&DS.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(i(t,s),Object.keys(s).forEach((e=>{n[e][t]=!0})))})),delete s[o]}(this.primaryType,{});for(const e in n){const r=Object.keys(n[e]);r.sort(),this._types[e]=QS(e,t[e])+r.map((e=>QS(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=JS(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&DS.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(we)),we(P(i))}}const r=this.types[t];if(r){const e=$S(this._types[t]);return t=>{const n=r.map((({name:e,type:r})=>{const n=this.getEncoder(r)(t[e]);return this._types[r]?we(n):n}));return n.unshift(e),P(n)}}return DS.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||DS.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return we(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(JS(t))return r(t,e);const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&DS.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const i=this.types[t];return i?i.reduce(((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t)),{}):DS.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new YS(t)}static getPrimaryType(t){return YS.from(t).primaryType}static hashStruct(t,e,r){return YS.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const n=HS[r];n||DS.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort(((t,e)=>GS.indexOf(t.name)-GS.indexOf(e.name))),YS.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return P(["0x1901",YS.hashDomain(t),YS.from(e).hash(r)])}static hash(t,e,r){return we(YS.encode(t,e,r))}static resolveNames(t,e,r,n){return BS(this,void 0,void 0,(function*(){t=wr(t);const i={};t.verifyingContract&&!S(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=YS.from(e);o.visit(r,((t,e)=>("address"!==t||S(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield n(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){YS.hashDomain(t);const n={},i=[];GS.forEach((e=>{const r=t[e];null!=r&&(n[e]=ZS[e](r),i.push({name:e,type:HS[e]}))}));const o=YS.from(e),s=wr(e);return s.EIP712Domain?DS.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return I(k(e));if(t.match(/^u?int/))return qt.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&DS.throwArgumentError("invalid string","value",e),e}return DS.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new y("wallet/5.6.2");function WS(t,e,r,n){return Fs(YS.hash(t,e,r),n)}function XS(t,e){return t.toLowerCase()===e.toLowerCase()}function tN(t){const{domain:e,types:r,message:n}=t;return Lu.hash(e,r,n)}function eN(t,r,n,i){return e(this,void 0,void 0,(function*(){let e;try{e=yield $N(i,["function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[k(n),r]])}catch(t){if(t.message.startsWith("missing revert data in call exception"))return!1;throw t}return XS(e,"0x1626ba7e")}))}function rN(t,r,n,i){return e(this,void 0,void 0,(function*(){return XS(yield $N(i,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[k(n),r]]),"0x20c13b0b")}))}var nN=Object.freeze({__proto__:null,getHash:tN,default:function(t,r,n){return e(this,arguments,void 0,(function*(t,e,r,n="1",i={}){const{domain:o,types:s,message:a}=r;try{if(XS(t,WS(o,s,a,e)))return!0}catch(t){}const h=cm(n,i),u=tN(r);return!!(yield eN(t,e,u,h))||(yield rN(t,e,u,h))}))}});var iN=["snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"],oN={1:{key:"1",name:"Ethereum",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",ensResolvers:["0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63","0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"],ensNameWrapper:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH",rpc:["https://rpc.ankr.com/eth",{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],light:["https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:{url:"https://etherscan.io",apiUrl:"https://api.etherscan.io"},start:7929876,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},8:{key:"8",name:"Ubiq",chainId:8,network:"Ubiq",multicall:"0x6668750957e4083725926B71C41bDF1434C73262",rpc:["https://rpc.octano.dev"],ws:["wss://ws.octano.dev"],explorer:{url:"https://ubiqscan.io"},start:1,logo:"ipfs://Qmec3HLoN4QhwZAhw4XTi2aN8Wwmcko5hHN22sHARzb9tw"},10:{key:"10",name:"Optimism",chainId:10,network:"Optimism mainnet",multicall:"0x35A6Cdb2C9AD4a45112df4a04147EB07dFA01aB7",rpc:["https://opt-mainnet.g.alchemy.com/v2/JzmIL4Q3jBj7it2duxLFeuCa9Wobmm7D"],explorer:{url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io"},start:657806,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb"},19:{key:"19",name:"Songbird Canary-Network",shortName:"Songbird",chainId:19,network:"songbird",multicall:"0x17032Ea9c3a13Ed337665145364c0d2aD1108c91",rpc:["https://songbird-api.flare.network/ext/C/rpc"],explorer:{url:"https://songbird-explorer.flare.network"},start:21807126,logo:"ipfs://QmXyvnrZY8FUxSULfnKKA99sAEkjAHtvhRx5WeHixgaEdu"},24:{key:"24",name:"KardiaChain Mainnet",shortName:"KAI",chainId:24,network:"mainnet",multicall:"0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",rpc:["https://kai-internal.kardiachain.io"],explorer:{url:"https://explorer.kardiachain.io"},start:8260245,logo:"ipfs://bafkreig73yfyqzbxydv6e3dbj5nks3f57px2iez7tywayey4rilfhhrr34"},25:{key:"25",name:"Cronos",shortName:"Cronos",chainId:25,network:"mainnet",multicall:"0x6F522a3982e8F9A50A2EDc9E46ed1A3aE2B3FD3a",rpc:["https://evm-cronos.crypto.org"],explorer:{url:"https://cronos.crypto.org/explorer"},start:4067,logo:"ipfs://QmfSJbtirJoa3Pt7o5Fdm85wbyw9V1hpzqLr5PQbdnfsAj"},30:{key:"30",name:"RSK",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:{url:"https://explorer.rsk.co"},start:2516442,logo:"ipfs://QmXTwpE1SqoNZmyY4c3fYWy6qUgQELsyWKbgJo2Pg6K6V9"},46:{key:"46",name:"Darwinia Network",shortName:"Darwinia",chainId:46,network:"mainnet",multicall:"0x67f9ae42EaA9a8aBf065D60ec6Ab3C1A11370607",rpc:["https://rpc.darwinia.network"],explorer:{url:"https://darwinia.subscan.io"},start:141853,logo:"ipfs://bafkreicf55maidhx46pyu3mwsshlr43xbewr6tkckkonh4nesbkp7krwkm"},56:{key:"56",name:"BNB Smart Chain",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://rpc.ankr.com/bsc","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org"],explorer:{url:"https://bscscan.com"},start:461230,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},61:{key:"61",name:"Ethereum Classic",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"0x51be3a92C56ae7E207C5b5Fd87F7798Ce82C1AC2",rpc:["https://www.ethercluster.com/etc"],explorer:{url:"https://blockscout.com/etc/mainnet"},start:13307544,logo:"ipfs://QmVegc28DvA7LjKUFysab81c9BSuN4wQVDQkRXyAtuEBis"},66:{key:"66",name:"OKExChain",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:{url:"https://www.oklink.com/okexchain"},start:5076543,logo:"ipfs://Qmd7dKnNwHRZ4HRCbCXUbkNV7gP28fGqPdjbHtjRtT9sQF"},75:{key:"75",name:"Decimal",shortName:"mainnet",chainId:75,network:"mainnet",multicall:"0x949d1A0757803C51F2EfFFEb5472C861A898B8E8",rpc:[],explorer:{url:"https://explorer.decimalchain.com"},start:16031065,logo:"ipfs://bafkreihkdhbce5rkogl63xegaarlirjrvbfarxbtbf5mqme3s5grvbjyxm"},81:{key:"81",name:"Shibuya Network",shortName:"Shibuya",chainId:81,network:"testnet",testnet:!0,multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shibuya.astar.network:8545"],explorer:{url:"https://blockscout.com/shibuya"},start:856303,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},82:{key:"82",name:"Meter",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:{url:"https://scan.meter.io"},start:4992871,logo:"ipfs://QmSZvT9w9eUDvV1YVaq3BKKEbubtNVqu1Rin44FuN4wz11"},97:{key:"97",name:"BNB Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",testnet:!0,multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://data-seed-prebsc-1-s1.binance.org:8545","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive"],explorer:{url:"https://testnet.bscscan.com"},start:3599656,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},100:{key:"100",name:"Gnosis Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://gno.getblock.io/mainnet/6c1d1e6e-75d9-452f-a863-a694bff93d5c/","https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://rpc.gnosischain.com"],light:["https://rpc.gnosischain.com"],ws:["wss://rpc.xdaichain.com/wss"],explorer:{url:"https://gnosis.blockscout.com"},start:4108192,logo:"ipfs://QmZeiy8Ax4133wzxUQM9ky8z5XFVf6YLFjJMmTWbWVniZR"},108:{key:"108",name:"Thundercore",chainId:108,network:"mainnet",multicall:"0x3017086deef56679e267f67f66c4415109b7a97f",rpc:["https://mainnet-rpc.thundercore.com/archived/SNAPSHOTEuR82a75fLYA"],explorer:{url:"https://viewblock.io/thundercore"},start:94425385,logo:"ipfs://bafkreifc5z5vtvqx2luzgateyvoocwpd2ifv2hwufxdnyl2a767wa6icli"},122:{key:"122",name:"Fuse",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://explorer-node.fuse.io/","https://oefusefull1.liquify.info/"],explorer:{url:"https://explorer.fuse.io"},start:11923459,logo:"ipfs://QmXjWb64nako7voaVEifgdjAbDbswpTY8bghsiHpv8yWtb"},137:{key:"137",name:"Polygon PoS",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://rpc.ankr.com/polygon","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e"],ws:["wss://ws-mainnet.matic.network"],explorer:{url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com"},start:9834491,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},144:{key:"144",name:"PHI Network",shortName:"PHI",chainId:144,network:"mainnet",multicall:"0xc2f41B404a6757863AAeF49ff93039421acCd630",rpc:["https://connect.phi.network"],explorer:{url:"https://phiscan.com"},start:360030,logo:"ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"},148:{key:"148",name:"ShimmerEVM",shortName:"ShimmerEVM",chainId:148,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.evm.shimmer.network/"},start:1290,logo:"ipfs://bafkreib4xhbgbhrwkmizp4d4nz3wzbpyhdm6wpz2v2pbkk7jxsgg3hdt74"},169:{key:"169",name:"Manta Pacific",shortName:"Manta",chainId:169,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.oklink.com/manta"},start:332890,logo:"ipfs://bafkreibbrwgwdcfh755dqh4ndta6tja77qbaa36bfv4pstub6prhhore7a"},204:{key:"204",name:"opBNB",shortName:"mainnet",chainId:204,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"http://opbnbscan.com/"},start:512881,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:{url:"https://explorer.energyweb.org"},start:12086501,logo:"ipfs://Qmai7AGHgs8NpeGeXgbMZz7pS2i4kw44qubCJYGrZW2f3a"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ankr.com/fantom","https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:{url:"https://ftmscan.com"},start:2497732,logo:"ipfs://QmVEgNeQDKnXygeGxfY9FywZpNGQu98ktZtRJ9bToYF6g7"},269:{key:"269",name:"High Performance Blockchain",shortName:"HPB",chainId:269,network:"mainnet",multicall:"0x67D0f263aef2F6167FA77353695D75b582Ff4Bca",rpc:["https://hpbnode.com"],ws:["wss://ws.hpbnode.com"],explorer:{url:"https://hscan.org"},start:13960096,logo:"ipfs://QmU7f1MyRz8rLELFfypnWZQjGbDGYgZtC9rjw47jYMYrnu"},300:{key:"300",name:"zkSync Sepolia Testnet",shortName:"testnet",chainId:300,network:"testnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:[],explorer:{url:"https://sepolia.explorer.zksync.dev/"},start:2292,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy",testnet:!0},314:{key:"314",name:"Filecoin",shortName:"mainnet",chainId:314,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://filfox.io"},start:3328594,logo:"ipfs://bafybeibyvjfmk6aqlfdrczvth55jkmnoadtrch7ht3rdmvqmy2bfxynecm"},321:{key:"321",name:"KCC",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:{url:"https://explorer.kcc.io"},start:1487453,logo:"ipfs://QmRdzYGhFRG8QLzMJahHrw3vETE2YZ9sywQbEkenSjKEvb"},324:{key:"324",name:"zkSync Era",shortName:"zkSync-era",chainId:324,network:"zkSync Era Mainnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:["https://mainnet.era.zksync.io"],explorer:{url:"https://explorer.zksync.io/"},start:3908235,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy"},336:{key:"336",name:"Shiden Network",shortName:"Shiden",chainId:336,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shiden.astar.network:8545","https://shiden.api.onfinality.io/public"],explorer:{url:"https://blockscout.com/shiden"},start:1170016,logo:"ipfs://QmcqGQE4Sk73zXc3e91TUFFefKBVeaNgbxV141XkSNE4xj"},369:{key:"369",name:"Pulsechain",shortName:"Pulsechain",chainId:369,network:"mainnet",multicall:"0xdbdd0FD8B16F0092f306392b699D7fbddaA9011B",rpc:["https://rpc.pulsechain.com"],explorer:{url:"https://scan.pulsechain.com/"},start:17657774,logo:"ipfs://QmWUsiEWdejtHZ9B9981TYXn7Ds8C7fkB1S4h5rP3kCCZR"},416:{key:"416",name:"SX Network",shortName:"SX",chainId:416,network:"mainnet",multicall:"0x834a005DDCF990Ba1a79f259e840e58F2D14F49a",rpc:["https://rpc.sx.technology"],ws:["wss://rpc.sx.technology/ws"],explorer:{url:"https://explorer.sx.technology"},start:2680605,logo:"ipfs://QmSXLXqyr2H6Ja5XrmznXbWTEvF2gFaL8RXNXgyLmDHjAF"},592:{key:"592",name:"Astar Network",shortName:"Astar",chainId:592,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://astar.api.onfinality.io/public","https://rpc.astar.network:8545"],explorer:{url:"https://blockscout.com/astar"},start:366482,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},813:{key:"813",name:"Qitmeer",shortName:"MEER",chainId:813,network:"mainnet",multicall:"0x55034b2cF530ae3A8fC1e2e4523F58496796610F",rpc:["https://evm-dataseed1.meerscan.io","https://evm-dataseed.meerscan.com","https://evm-dataseed2.meerscan.io","https://evm-dataseed3.meerscan.io"],explorer:{url:"https://evm.meerscan.io"},start:43317,logo:"ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"},841:{key:"841",name:"Taraxa",shortName:"841",chainId:841,network:"mainnet",multicall:"0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",rpc:["https://rpc.mainnet.taraxa.io"],ws:["wss://ws.mainnet.taraxa.io"],explorer:{url:"https://mainnet.explorer.taraxa.io"},start:1515906,logo:"ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"},888:{key:"888",name:"Wanchain",chainId:888,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:{url:"https://www.wanscan.org"},start:11302663,logo:"ipfs://QmewFFN44rkxESFsHG8edaLt1znr62hjvZhGynfXqruzX3"},1001:{key:"1001",name:"Klaytn Baobab Testnet",shortName:"Boabab",chainId:1001,network:"testnet",testnet:!0,multicall:"0x40643B8Aeaaca0b87Ea1A1E596e64a0e14B1d244",rpc:["https://archive-en.baobab.klaytn.net"],ws:["wss://archive-en.baobab.klaytn.net/ws"],explorer:{url:"https://baobab.scope.klaytn.com"},start:87232478,logo:"ipfs://QmYACyZcidcFtMo4Uf9H6ZKUxTP2TQPjGzNjcUjqYa64dt"},1072:{key:"1072",name:"Shimmer EVM Testnet",shortName:"ShimmerEVM",chainId:1072,network:"testnet",testnet:!0,multicall:"0x751d21047C116413895c259f3f305e38C10B7cF6",rpc:["https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"],explorer:{url:"https://explorer.evm.testnet.shimmer.network/"},start:10614,logo:"ipfs://bafkreihtwfwrue7klzedwx4rqlk6agklz4lbbk7owsyw6xzn6c2m4t5tgy"},1088:{key:"1088",name:"Metis",shortName:"metis",chainId:1088,network:"mainnet",multicall:"0xc39aBB6c4451089dE48Cffb013c39d3110530e5C",rpc:["https://andromeda.metis.io/?owner=1088"],explorer:{url:"https://andromeda-explorer.metis.io"},start:451,logo:"ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"},1101:{key:"1101",name:"Polygon zkEVM",shortName:"mainnet",chainId:1101,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://zkevm.polygonscan.com"},start:57746,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm"},1116:{key:"1116",name:"Core Chain",shortName:"Core",chainId:1116,network:"mainnet",multicall:"0x024f0041b76B598c2A0a75004F8447FaF67BD004",rpc:["https://rpcar.coredao.org/"],explorer:{url:"https://scan.coredao.org"},start:853908,logo:"ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"},1284:{key:"1284",name:"Moonbeam",shortName:"GLMR",chainId:1284,network:"mainnet",multicall:"0x83e3b61886770de2F64AAcaD2724ED4f08F7f36B",rpc:["https://rpc.api.moonbeam.network"],explorer:{url:"https://moonscan.io/"},start:171135,logo:"ipfs://QmWKTEK2pj5sBBbHnMHQbWgw6euVdBrk2Ligpi2chrWASk"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.api.moonriver.moonbeam.network"],explorer:{url:"https://blockscout.moonriver.moonbeam.network"},start:413539,logo:"ipfs://QmXtgPesL87Ejhq2Y7yxsaPYpf4RcnoTYPJWPcv6iiYhoi"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",testnet:!0,multicall:"0xf09FD6B6FF3f41614b9d6be2166A0D07045A3A97",rpc:["https://rpc.testnet.moonbeam.network"],explorer:{url:"https://moonbase-blockscout.testnet.moonbeam.network"},start:859041,logo:"ipfs://QmeGbNTU2Jqwg8qLTMGW8n8HSi2VdgCncAaeGzLx6gYnD7"},1328:{key:"1328",name:"Sei atlantic testnet",shortName:"testnet",chainId:1328,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://seitrace.com"},start:96978658,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},1329:{key:"1329",name:"Sei",shortName:"mainnet",chainId:1329,network:"mainnet",multicall:"0xe033Bed7cae4114Af84Be1e9F1CA7DEa07Dfe1Cf",rpc:[],explorer:{url:"https://seitrace.com/"},start:79164574,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq"},1559:{key:"1559",name:"Tenet",shortName:"tenet",chainId:1559,network:"mainnet",multicall:"0xcCB3F00bE353950E4C08501ac8Af48765EAAa738",rpc:[],explorer:{url:"https://tenetscan.io"},start:944415,logo:"ipfs://Qmc1gqjWTzNo4pyFSGtQuCu7kRSZZBUVybtTjHn2nNEEPA"},1663:{key:"1663",name:"Horizen Gobi Testnet",shortName:"Gobi",chainId:1663,network:"testnet",testnet:!0,multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:["https://gobi-testnet.horizenlabs.io/ethv1"],explorer:{url:"https://gobi-explorer.horizen.io"},start:1,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},2e3:{key:"2000",name:"Doge Chain",shortName:"dogechain",chainId:2e3,network:"mainnet",multicall:"0x6f9D3f3932B417bd4957585D236Cbc32b32C0BDc",rpc:["https://rpc.dogechain.dog"],explorer:{url:"https://explorer.dogechain.dog"},start:877115,logo:"ipfs://bafkreigovfh3pinsdih777issfgaflwu2yjzroljs2642gbvwikcd3nm4i"},2109:{key:"2109",name:"Exosama Network",shortName:"EXN",chainId:2109,network:"mainnet",multicall:"0x2feFC828e2fEfdE0C9f7740919c6A9139F886067",rpc:["https://rpc.exosama.com"],explorer:{url:"https://explorer.exosama.com"},start:94085,logo:"ipfs://QmaQxfwpXYTomUd24PMx5tKjosupXcm99z1jL1XLq9LWBS"},2152:{key:"2152",name:"Findora",shortName:"Findora",chainId:2152,network:"mainnet",multicall:"0xCF7D1e21CBe9bdEF235aef06C5d8051B3d4DF0f5",rpc:["https://archive.prod.findora.org:8545/"],explorer:{url:"https://evm.findorascan.io"},start:4219343,logo:"ipfs://QmXkneyRB6HbHTHRLCZpZqSsawiyJY7b2kZ2V8ydvKYAgv"},2221:{key:"2221",name:"Kava Testnet",shortName:"testnet",chainId:2221,network:"testnet",multicall:"0xc7193EFE367DF0C9349a1149F4E95A2A35604262",rpc:[],explorer:{url:"https://testnet.kavascan.com"},start:6193104,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4",testnet:!0},2222:{key:"2222",name:"Kava",shortName:"mainnet",chainId:2222,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://kavascan.com/"},start:3661165,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4"},2400:{key:"2400",name:"TCG Verse",shortName:"TCGV",chainId:2400,network:"mainnet",multicall:"0xceC65DEE0b5012F1b7321b2647681F997c7204FC",rpc:["https://rpc.tcgverse.xyz"],explorer:{url:"https://explorer.tcgverse.xyz"},start:57500,logo:"ipfs://bafkreidg4wpewve5mdxrofneqblydkrjl3oevtgpdf3fk3z3vjqam6ocoe"},4200:{key:"4200",name:"Merlin",shortName:"merlin",chainId:4200,network:"mainnet",multicall:"0x830E7E548F4D80947a40A7Cf3a2a53166a0C3980",rpc:[],explorer:{url:"https://scan.merlinchain.io"},start:589494,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe"},4337:{key:"4337",name:"Beam",shortName:"Beam",chainId:4337,network:"mainnet",multicall:"0x4956F15eFdc3dC16645e90Cc356eAFA65fFC65Ec",rpc:[],explorer:{url:"https://subnets.avax.network/beam/"},start:1,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF"},4689:{key:"4689",name:"IoTeX",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:{url:"https://iotexscan.io"},start:11533283,logo:"ipfs://QmNkr1UPcBYbvLp7d7Pk4eF3YCsHpaNkfusKZNtykL2EQC"},5e3:{key:"5000",name:"Mantle",chainId:5e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.mantle.xyz"],explorer:{url:"https://explorer.mantle.xyz"},start:304717,logo:"ipfs://bafkreidkucwfn4mzo2gtydrt2wogk3je5xpugom67vhi4h4comaxxjzoz4"},5555:{key:"5555",name:"Chain Verse",shortName:"ChainVerse",chainId:5555,network:"ChainVerse",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.chainverse.info"],explorer:{url:"https://explorer.chainverse.info"},start:6334180,logo:"ipfs://QmQyJt28h4wN3QHPXUQJQYQqGiFUD77han3zibZPzHbitk"},6102:{key:"6102",name:"Cascadia Testnet",shortName:"Cascadia",chainId:6102,network:"testnet",multicall:"0x728989819bAD588F193563008E0a03E8cD6a3e4a",rpc:["https://testnet.cascadia.foundation"],explorer:{url:"https://explorer.cascadia.foundation"},testnet:!0,start:370457,logo:"ipfs://QmWkhZYhReYyaa5pQXj32hEGxoRcBqarFMcfQScELmjYQj"},7332:{key:"7332",name:"Horizen EON",shortName:"EON",chainId:7332,network:"mainnet",multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:[],explorer:{url:"https://eon-explorer.horizenlabs.io"},start:85108,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},7341:{key:"7341",name:"Shyft",shortName:"Shyft",chainId:7341,network:"mainnet",multicall:"0xceb10e9133D771cA93c8002Be527A465E85381a2",rpc:["https://rpc.shyft.network"],explorer:{url:"https://bx.shyft.network"},start:3673983,logo:"ipfs://bafkreifwxnnfk6koabzmxgcxcwlrwt6b5gijdain2gyqee77q4ajfb7fu4"},7560:{key:"7560",name:"Cyber",shortName:"mainnet",chainId:7560,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://cyberscan.co"},start:1731707,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm"},8217:{key:"8217",name:"Klaytn Cypress",shortName:"Cypress",chainId:8217,network:"mainnet",multicall:"0x5f5f0d1b9ff8b3dcace308e39b13b203354906e9",rpc:["https://archive-en.cypress.klaytn.net"],ws:["wss://archive-en.cypress.klaytn.net/ws"],explorer:{url:"https://scope.klaytn.com"},start:91582357,logo:"ipfs://QmYACyZcidcFtMo4Uf9H6ZKUxTP2TQPjGzNjcUjqYa64dt"},8453:{key:"8453",name:"Base",shortName:"mainnet",chainId:8453,network:"mainnet",multicall:"0xca11bde05977b3631167028862be2a173976ca11",rpc:[],explorer:{url:"https://basescan.org/"},start:5022,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"},9001:{key:"9001",name:"Evmos Network",shortName:"Evmos",chainId:9001,network:"mainnet",multicall:"0x37763d16f8dBf6F185368E0f256350cAb7E24b26",rpc:["https://eth.bd.evmos.org:8545"],ws:["wss://eth.bd.evmos.org:8546"],explorer:{url:"https://escan.live"},start:13959539,logo:"ipfs://bafkreif4obrdoiretpozdd56seziywc6clha7wwkbldng3ovry2bpzly34"},1e4:{key:"10000",name:"smartBCH",shortName:"BCH",chainId:1e4,network:"mainnet",multicall:"0x1b38EBAd553f218e2962Cb1C0539Abb5d6A37774",rpc:["https://smartbch.greyh.at/"],explorer:{url:"https://smartbch-explorer.web.app"},start:268248,logo:"ipfs://QmWG1p7om4hZ4Yi4uQvDpxg4si7qVYhtppGbcDGrhVFvMd"},10243:{key:"10243",name:"Arthera Testnet",shortName:"Arthera_",chainId:10243,network:"testnet",testnet:!0,multicall:"0x27c7FC597aD2E81C4c1cA1769972f79DaF042Da7",rpc:["https://rpc-test.arthera.net"],explorer:{url:"https://explorer-test.arthera.net"},start:10523,logo:"ipfs://QmYQp3e52KjkT4bYdAvB6ACEEpXs2D8DozsDitaADRY2Ak"},13337:{key:"13337",name:"Beam Testnet",shortName:"testnet",chainId:13337,network:"testnet",multicall:"0x9BF49b704EE2A095b95c1f2D4EB9010510c41C9E",rpc:[],explorer:{url:"https://subnets-test.avax.network/beam/"},start:3,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF",testnet:!0},13371:{key:"13371",name:"Immutable zkEVM",shortName:"mainnet",chainId:13371,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.immutable.com"},start:3680945,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi"},13473:{key:"13473",name:"Immutable zkEVM Testnet",shortName:"testnet",chainId:13473,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.testnet.immutable.com"},start:5307209,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi",testnet:!0},16718:{key:"16718",name:"AirDAO",chainId:16718,network:"mainnet",multicall:"0x25e81aC81A8B03389D78CB45faB78353aB528574",rpc:["https://network-archive.ambrosus.io"],ws:["wss://network-archive.ambrosus.io/ws"],explorer:{url:"https://airdao.io/explorer"},start:22922566,logo:"ipfs://QmSxXjvWng3Diz4YwXDV2VqSPgMyzLYBNfkjJcr7rzkxom"},29548:{key:"29548",name:"MCH Verse",shortName:"mainnet",chainId:29548,network:"mainnet",multicall:"0x1d39652386488CE1fE4254E105F5A42a04d43dB2",rpc:[],explorer:{url:"https://explorer.oasys.mycryptoheroes.net"},start:27458402,logo:"ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU"},42161:{key:"42161",name:"Arbitrum One",chainId:42161,network:"Arbitrum mainnet",multicall:"0x7A7443F8c577d537f1d8cD4a629d40a3148Dd7ee",rpc:["https://rpc.ankr.com/arbitrum","https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/arbitrum/mainnet","https://arb-mainnet.g.alchemy.com/v2/JDvtNGwnHhTltIwfnxQocKwKkCTKA1DL"],explorer:{url:"https://arbiscan.io"},start:256508,logo:"ipfs://QmWZ5SMRfvcK8tycsDqojQaSiKedgtVkS7CkZdxPgeCVsZ"},42170:{key:"42170",name:"Arbitrum Nova",chainId:42170,network:"Arbitrum Nova",multicall:"0x4E74EBd9CABff51cE9a43EFe059bA8c5A28E4A14",rpc:["https://nova.arbitrum.io/rpc","https://arbitrum-nova.public.blastapi.io"],explorer:{url:"https://nova.arbiscan.io/"},start:6006607,logo:"ipfs://bafkreie5xsqt3mrrwu7v32qpmmctibhzhgxf4emfzzddsdhdlfsa7fmplu"},42220:{key:"42220",name:"Celo",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo.snapshot.org","https://forno.celo.org","https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:{url:"https://explorer.celo.org"},start:6599803,logo:"ipfs://QmS2tVJ7rdJRe1NHXAi2L86yCbUwVVrmB2mHQeNdJxvQti"},43113:{key:"43113",name:"Avalanche FUJI Testnet",chainId:43113,network:"testnet",testnet:!0,multicall:"0x984476ea55e32e785A9D8FF14329f99D74E3d2A2",rpc:["https://api.avax-test.network/ext/bc/C/rpc"],explorer:{url:"https://testnet.snowtrace.io"},start:10528153,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},43114:{key:"43114",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://nd-784-543-849.p2pify.com/aa7b29fc5fed65b34f0ee6b8de33f8c0/ext/bc/C/rpc","https://rpc.ankr.com/avalanche","https://api.avax.network/ext/bc/C/rpc"],explorer:{url:"https://snowtrace.io"},start:536483,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},47805:{key:"47805",name:"REI Mainnet",chainId:47805,network:"mainnet",multicall:"0x9eE9904815B80C39C1a27294E69a8626EAa7952d",rpc:["https://rpc.rei.network"],explorer:{url:"https://scan.rei.network/"},start:1715902,logo:"ipfs://QmTogMDLmDgJjDjUKDHDuc2KVTVDbXf8bXJLFiVe8PRxgo"},53935:{key:"53935",name:"DFK Chain",chainId:53935,network:"mainnet",multicall:"0x5b24224dC16508DAD755756639E420817DD4c99E",rpc:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"],explorer:{url:"https://subnets.avax.network/defi-kingdoms/"},start:62,logo:"ipfs://QmZNkpVgPbuVbDcsi6arwH1om3456FGnwfDqYQJWUfHDEx"},59141:{key:"59141",name:"Linea Sepolia",shortName:"testnet",chainId:59141,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.lineascan.build/"},start:227427,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce",testnet:!0},59144:{key:"59144",name:"Linea",shortName:"linea",chainId:59144,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://lineascan.build/"},start:42,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce"},80001:{key:"80001",name:"Polygon Mumbai",chainId:80001,network:"testnet",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:{url:"https://mumbai.polygonscan.com",apiUrl:"https://api-mumbai.polygonscan.com"},start:12011090,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},81457:{key:"81457",name:"Blast",shortName:"mainnet",chainId:81457,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://blastscan.io"},start:88189,logo:"ipfs://bafkreicqhrimt2zyp2kvhmbpvffxlmxovkg5vw6zkissyzibcfy45kbvrm"},84532:{key:"84532",name:"Base Sepolia",shortName:"testnet",chainId:84532,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://base-sepolia.blockscout.com/"},start:1059647,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv",testnet:!0},686868:{key:"686868",name:"Merlin Testnet",shortName:"merlin",chainId:686868,network:"testnet",multicall:"0x758BC6321b7c68F4986d62a4D46E83A2DCb58c80",rpc:[],explorer:{url:"https://testnet-scan.merlinchain.io"},start:3562021,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe",testnet:!0},713715:{key:"713715",name:"Sei EVM Devnet",shortName:"devnet",chainId:713715,network:"testnet",multicall:"0xEe8d287B844959ADe40d718Dc23077ba920e2f07",rpc:[],explorer:{url:"https://seitrace.com"},start:1463669,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},810180:{key:"810180",name:"zkLink Nova",shortName:"zlink",chainId:810180,network:"mainnet",multicall:"0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",rpc:[],explorer:{url:"https://explorer.zklink.io"},start:146055,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"},810181:{key:"810181",name:"zkLink Nova Sepolia",shortName:"testnet",chainId:810181,network:"testnet",multicall:"0x97148F8fDdd9A1620f72EC1Bb2932916623d9da5",rpc:[],explorer:{url:"https://sepolia.explorer.zklink.io/"},start:43723,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",testnet:!0},11155111:{key:"11155111",name:"Sepolia testnet",shortName:"Sepolia",chainId:11155111,network:"sepolia",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://sepolia.infura.io/v3/d26b4fd748814fe994b05899fd89e667"],ensResolvers:["0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"],ensNameWrapper:"0x0635513f179D50A207757E05759CbD106d7dFcE8",ensSubgraph:"https://api.studio.thegraph.com/proxy/49574/enssepolia/version/latest",explorer:{url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io"},start:751532,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},11155420:{key:"11155420",name:"OP Sepolia",shortName:"testnet",chainId:11155420,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia-optimism.etherscan.io"},start:1620204,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb",testnet:!0},111557560:{key:"111557560",name:"Cyber Testnet",shortName:"testnet",chainId:111557560,network:"testnet",multicall:"0xffc391F0018269d4758AEA1a144772E8FB99545E",rpc:[],explorer:{url:"https://testnet.cyberscan.co/"},start:304545,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm",testnet:!0},168587773:{key:"168587773",name:"Blast Sepolia",shortName:"testnet",chainId:168587773,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.blastexplorer.io"},start:756690,logo:"ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce",testnet:!0},245022926:{key:"245022926",name:"Neon Devnet",shortName:"devnet",chainId:245022926,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://devnet.neonscan.org/"},start:205206112,logo:"ipfs://QmecRPQGa4bU7tybg1sUQY48Md9rWnmhrT6WW5ueqvhg6P",testnet:!0},1313161554:{key:"1313161554",name:"Aurora",shortName:"Aurora",chainId:1313161554,network:"mainnet",multicall:"0x32b50c286DEFd2932a0247b8bb940b78c063F16c",rpc:["https://mainnet.aurora.dev"],explorer:{url:"https://explorer.mainnet.aurora.dev"},start:57190533,logo:"ipfs://QmeRhsR1UPRTQCizdhmgr2XxphXebVKU5di97uCV2UMFpa"},16666e5:{key:"1666600000",name:"Harmony",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:{url:"https://explorer.harmony.one"},start:10911984,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",testnet:!0,multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:{url:"https://explorer.pops.one"},start:7521509,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"}};class sN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return"number"==typeof t&&void 0!==(null==e?void 0:e[t-1])}getValidVotes(){return this.votes.filter((t=>sN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>{const r=this.getValidVotes().filter((t=>t.choice===e+1));return r.reduce(((t,e)=>t+e.balance),0)}))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>{const r=this.strategies.map(((t,r)=>{const n=this.getValidVotes().filter((t=>t.choice===e+1));return n.reduce(((t,e)=>t+e.scores[r]),0)}));return r}))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices[this.selected-1]}}class aN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size}getValidVotes(){return this.votes.filter((t=>aN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.balance),0)))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.scores[r]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected?this.proposal.choices.filter(((t,e)=>this.selected.includes(e+1))).join(", "):""}}function hN(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function uN(t,e){return Math.sqrt(t*e)}function lN(t){return t*t}function cN(t,e){return t.map((t=>e*t))}class fN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>fN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>{const n=t.map((t=>uN(hN(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return lN(n)}));return cN(r.map(((t,e)=>hN(r[e],r))),e)}getScoresByStrategy(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>this.strategies.map(((e,n)=>t.map((t=>uN(hN(t.choice[r+1],Object.values(t.choice)),t.scores[n]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[lN(t)]))));return r.map(((t,n)=>cN(this.strategies.map(((t,e)=>hN(r[n][e][0],r.flat(2)))),e)))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1]){const r=hN(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function dN(t,e){const r=[...new Set(t.map((t=>t[0])).flat())],n=Object.entries(t.reduce(((t,[e],r,n)=>{const i=n[r][1];t[e[0]][0]+=i;const o=n[r][2];return o.length>1?t[e[0]][1]=o.map(((r,n)=>r+t[e[0]][1][n]||r)):t[e[0]][1]=[t[e[0]][1].concat(o).reduce(((t,e)=>t+e),0)],t}),Object.assign({},...r.map((t=>({[t]:[0,[]]})))))),i=n.map((t=>[t[0],t[1][0]])),[o,s]=i.reduce((([t,e],[r,n])=>n>e?[r,n]:[t,e]),["?",-1/0]),[a,h]=i.reduce((([t,e],[r,n])=>n<e?[r,n]:[t,e]),["?",1/0]),u=n.sort(((t,e)=>e[1][0]-t[1][0])),l=t.map((t=>t[1])).reduce(((t,e)=>t+e),0);return e.push({round:e.length+1,sortedByHighest:u}),s>l/2||u.length<3?e:dN(t.map((t=>[t[0].filter((t=>t!=a)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function pN(t){const e=dN(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class mN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size&&t.length>0&&t.length===e.length}getValidVotes(){return this.votes.filter((t=>mN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=pN(t);return e.choices.map(((t,e)=>r.filter((t=>Number(t[0])===e+1)).reduce(((t,e)=>t+e[1][0]),0)))}(this.getValidVotes(),this.proposal)}getScoresByStrategy(){const t=pN(this.getValidVotes());return this.proposal.choices.map(((e,r)=>this.strategies.map(((e,n)=>t.filter((t=>Number(t[0])===r+1)).reduce(((t,e)=>t+e[1][1][n]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>{if(this.proposal.choices[t-1])return this.proposal.choices[t-1]})).map(((t,e)=>`(${zN(e+1)}) ${t}`)).join(", ")}}function gN(t,e,r){const n=r.reduce(((t,e)=>t+e),0),i=e[t]/n*100;return isNaN(i)?0:i}function yN(t,e,r){return gN(t+1,e,Object.values(e))/100*r}class vN{constructor(t,e,r,n){this.proposal=t,this.votes=e,this.strategies=r,this.selected=n}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>vN.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>yN(e,t.choice,t.balance))).reduce(((t,e)=>t+e),0))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((e,r)=>gN(r,t,t))).map((t=>e/100*t))}getScoresByStrategy(){const t=this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().map((t=>yN(e,t.choice,t.scores[r]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[t])))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((r,n)=>this.strategies.map(((e,r)=>gN(0,t[n][r],t.flat(2)))).map((t=>[e/100*t])).flat()))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1])return`${Math.round(10*gN(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var wN={"single-choice":sN,approval:aN,quadratic:fN,"ranked-choice":mN,weighted:vN,basic:sN};const bN={1:"https://subgrapher.snapshot.org/delegation/1",10:"https://subgrapher.snapshot.org/delegation/10",56:"https://subgrapher.snapshot.org/delegation/56",100:"https://subgrapher.snapshot.org/delegation/100",137:"https://subgrapher.snapshot.org/delegation/137",250:"https://subgrapher.snapshot.org/delegation/250",42161:"https://subgrapher.snapshot.org/delegation/42161",11155111:"https://subgrapher.snapshot.org/delegation/11155111"},_N=1e3;function EN(t){return t.length===_N&&t[0].timestamp===t[t.length-1].timestamp}function AN(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function kN(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function MN(t){return e(this,arguments,void 0,(function*({url:t,spaces:e,pivot:r,snapshot:n}){const i={delegations:{__args:{where:{space_in:e,timestamp_gte:r},first:_N,skip:0,orderBy:"timestamp",orderDirection:"asc"},delegator:!0,space:!0,delegate:!0,timestamp:!0}};return"latest"!==n&&(i.delegations.__args.block={number:n}),(yield DN(t,i)).delegations||[]}))}const xN="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",SN=["function text(bytes32 node, string calldata key) external view returns (string memory)","function resolver(bytes32 node) view returns (address)"],NN={Accept:"application/json","Content-Type":"application/json"},IN="https://score.snapshot.org";function CN(t=IN,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const n=r.searchParams.get("apiKey");let i=Object.assign({},NN);return n&&(r.searchParams.delete("apiKey"),i=Object.assign(Object.assign({},NN),{"X-API-KEY":n})),{url:r.toString(),headers:i}}function TN(t){return e(this,void 0,void 0,(function*(){let e=yield t.text();try{e=JSON.parse(e)}catch(r){return Promise.reject({code:t.status||500,message:"Failed to parse response from score API",data:e})}return e.error?Promise.reject(e.error):e}))}const PN=new Ef({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});xf(PN),Nf(PN),PN.addFormat("address",{validate:t=>{try{return t===Pe(t)}catch(t){return!1}}}),PN.addFormat("starknetAddress",{validate:t=>{try{return NS(t)===t}catch(t){return!1}}}),PN.addFormat("long",{validate:()=>!0}),PN.addFormat("ethValue",{validate:t=>{if(!t.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/))return!1;try{return function(t,e){if("string"!=typeof t&&Ya.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Wa.indexOf(e);-1!==t&&(e=3*t)}Ga(t,null!=e?e:18)}(t,18),!0}catch(t){return!1}}});const RN=Object.keys(oN),ON=Object.keys(oN).filter((t=>!oN[t].testnet));function $N(t,r,n,i){return e(this,void 0,void 0,(function*(){const e=new sa(n[0],r,t);try{const t=n[2]||[];return yield e[n[1]](...t,i||{})}catch(t){return Promise.reject(t)}}))}function BN(t,r,n,i,o){return e(this,void 0,void 0,(function*(){const e=(null==o?void 0:o.multicallAddress)||oN[t].multicall,s=new sa(e,["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"],r),a=new Yn(n);try{const t=(null==o?void 0:o.limit)||500;(null==o?void 0:o.limit)&&delete o.limit;const e=Math.ceil(i.length/t),r=[];Array.from(Array(e)).forEach(((e,n)=>{const h=i.slice(t*n,t*(n+1));r.push(s.aggregate(h.map((t=>[t[0].toLowerCase(),a.encodeFunctionData(t[1],t[2])])),o||{}))}));let n=yield Promise.all(r);return n=n.reduce(((t,[,e])=>t.concat(e)),[]),n.map(((t,e)=>a.decodeFunctionResult(i[e][1],t)))}catch(t){return Promise.reject(t)}}))}function DN(t,r){return e(this,arguments,void 0,(function*(t,e,r={}){const n=yield a(t,{method:"POST",headers:Object.assign({Accept:"application/json","Content-Type":"application/json"},null==r?void 0:r.headers),body:JSON.stringify({query:Ku.jsonToGraphQLQuery({query:e})})});let i=yield n.text();try{i=JSON.parse(i)}catch(e){throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${i.substring(0,400)}`)}if(i.errors)throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${JSON.stringify(i.errors).substring(0,400)}`);const{data:o}=i;return o||{}}))}function FN(t,e=iN[0]){const r=`https://${e}`;if(!t)return null;if(!(t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("https://")||t.startsWith("http://")))return`${r}/ipfs/${t}`;const n=t.split("://")[0];return"ipfs"===n?t.replace("ipfs://",`${r}/ipfs/`):"ipns"===n?t.replace("ipns://",`${r}/ipns/`):t}function UN(r,n){return e(this,arguments,void 0,(function*(e,r,n="1",i={}){var o,s;const{ensResolvers:a=(null===(o=oN[n])||void 0===o?void 0:o.ensResolvers)||oN[1].ensResolvers,broviderUrl:h}=i,u=t(i,["ensResolvers","broviderUrl"]),l=du(fu(e)),c=cm(n,{broviderUrl:h}),f=[[xN,"resolver",[l]],...a.map((t=>[t,"text",[l,r]]))],[[d],...p]=yield BN(n,c,SN,f,u),m=a.indexOf(d);return-1!==m?null===(s=p[m])||void 0===s?void 0:s[0]:null}))}function jN(t){return e(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield UN(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function LN(t){return e(this,arguments,void 0,(function*(t,e="1",r={}){const n=cm(e,r),i=new sa(xN,["function owner(bytes32) view returns (address)"],n),o=r.ensNameWrapper||oN[e].ensNameWrapper,s=du(fu(t));let a=yield i.owner(s);if(a===o){const t=new sa(o,["function ownerOf(uint256) view returns (address)"],n);a=yield t.ownerOf(s)}return a}))}function zN(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function qN(t){return!!oN[t]}function VN(t){return Re(t)&&"0x0000000000000000000000000000000000000000"!==t}function HN(t,e){return"latest"===t||"number"==typeof t&&t>=oN[e].start}function GN(t){if(!t)return!1;try{return NS(t),!0}catch(t){return!1}}function KN(t){return Re(t)}function ZN(t){return Promise.reject(new Error(t))}PN.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?ON.includes(e):RN.includes(e)},error:{message:"network not allowed"}}),PN.addKeyword({keyword:"maxLengthWithSpaceType",validate:function t(e,r){const n=this.spaceType||"default",i=r.length<=e[n];return i||(t.errors=[{keyword:"maxLengthWithSpaceType",message:`must NOT have more than ${e[n]} characters`,params:{limit:e[n]}}]),i},errors:!0}),PN.addKeyword({keyword:"maxItemsWithSpaceType",validate:function t(e,r){const n=this.spaceType||"default",i=r.length<=e[n];return i||(t.errors=[{keyword:"maxItemsWithSpaceType",message:`must NOT have more than ${e[n]} items`,params:{limit:e[n]}}]),i},errors:!0}),PN.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))});var JN={call:$N,multicall:BN,subgraphRequest:DN,ipfsGet:function(t,r){return e(this,arguments,void 0,(function*(t,e,r="ipfs"){return a(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:FN,getJSON:function(t){return e(this,arguments,void 0,(function*(t,e={}){const r=FN(t,e.gateways);return a(r).then((t=>t.json()))}))},sendTransaction:function(t,r,n,i,o){return e(this,arguments,void 0,(function*(t,e,r,n,i,o={}){const s=t.getSigner(),a=new sa(e,r,t).connect(s);return yield a[n](...i,o)}))},getScores:function(t,r,n,i){return e(this,arguments,void 0,(function*(t,e,r,n,i="latest",o=IN,s={}){if(!Array.isArray(n))return ZN("addresses should be an array of addresses");if(0===n.length)return ZN("addresses can not be empty");const h=n.find((t=>!VN(t)));if(h)return ZN(`Invalid address: ${h}`);if(!qN(r))return ZN(`Invalid network: ${r}`);const u=e.find((t=>t.network&&!qN(t.network)));if(u)return ZN(`Invalid network (${u.network}) in strategy ${u.name}`);if(!HN(i,r))return ZN(`Snapshot (${i}) must be 'latest' or greater than network start block (${oN[r].start})`);new URL(o).pathname="/api/scores";const{url:l,headers:c}=CN(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:i,strategies:e,addresses:n},h=yield a(l,{method:"POST",headers:c,body:JSON.stringify({params:o})}),u=yield TN(h);return"all"===s.returnValue?u.result:u.result[s.returnValue||"scores"]}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},getVp:function(t,r,n,i,o,s,h){return e(this,void 0,void 0,(function*(){const{url:e,headers:u}=CN(null==h?void 0:h.url);if(!VN(t))return ZN(`Invalid voter address: ${t}`);if(!qN(r))return ZN(`Invalid network: ${r}`);const l=n.find((t=>t.network&&!qN(t.network)));if(l)return ZN(`Invalid network (${l.network}) in strategy ${l.name}`);if(!HN(i,r))return ZN(`Snapshot (${i}) must be 'latest' or greater than network start block (${oN[r].start})`);const c={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"get_vp",params:{address:t,network:r,strategies:n,snapshot:i,space:o,delegation:s}})};try{const t=yield a(e,c);return(yield TN(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},validateSchema:function(t,e,r={snapshotEnv:"default",spaceType:"default"}){const n=PN.compile(t),i=n.call(r,e);return i||n.errors},getEnsTextRecord:UN,getSpaceUri:jN,getEnsOwner:LN,getSpaceController:function(t){return e(this,arguments,void 0,(function*(t,e="1",r={}){const n=yield jN(t,e,r);if(n){let t=Re(n);if(t)return n;const e=n.split("/"),r=e.includes("testnet")?5:4,i=e[r];if(t=Re(i),t)return i}return yield LN(t,e,r)}))},getDelegatesBySpace:function(t,r){return e(this,arguments,void 0,(function*(t,e,r="latest",n={}){const i=n.subgraphUrl||bN[t];if(!i)return Promise.reject(`Delegation subgraph not available for network ${t}`);let o=0;const s=new Map,a=kN(e);for(;;){const t=yield MN({url:i,spaces:a,pivot:o,snapshot:r});if(EN(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{AN(s,t),o=t.timestamp})),t.length<_N)break}return[...s.values()]}))},clone:function(t){return JSON.parse(JSON.stringify(t))},sleep:function(t){return e(this,void 0,void 0,(function*(){return new Promise((e=>{setTimeout(e,t)}))}))},getNumberWithOrdinal:zN,voting:wN,getProvider:cm,signMessage:function(t,r,n){return e(this,void 0,void 0,(function*(){return r=I(new Buffer(r,"utf8")),yield t.send("personal_sign",[r,n])}))},getBlockNumber:function(t){return e(this,void 0,void 0,(function*(){try{const e=yield t.getBlockNumber();return parseInt(e)}catch(t){return Promise.reject()}}))},Multicaller:class{constructor(t,e,r,n){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=n||{}}call(t,e,r,n){return this.calls.push([e,r,n]),this.paths.push(t),this}execute(t){return e(this,void 0,void 0,(function*(){const e=t||{};return(yield BN(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>_d(e,this.paths[r],t.length>1?t:t[0]))),this.calls=[],this.paths=[],e}))}},getSnapshots:function(t,r,n,i){return e(this,arguments,void 0,(function*(t,e,r,n,i={}){const o={};if(n.forEach((t=>o[t]="latest")),"latest"===e)return o;const s=`${t}-${e}-${n.join("-")}`,a=Ed[s],h=Date.now();if(a&&Ad>h)return a;Ad<h&&(Ed={},Ad=h+36e5-h%36e5),o[t]=e;const u=Object.keys(o).filter((e=>t!==e));if(0===u.length)return o;const l={blocks:{__args:{where:{ts:(yield r.getBlock(e)).timestamp,network_in:u}},network:!0,number:!0}},c=i.blockFinderUrl||"https://blockfinder.snapshot.org";return(yield DN(c,l)).blocks.forEach((t=>o[t.network]=t.number)),Ed[s]=o,o}))},getHash:function(t,e){return(PS(t)?OS:nN).getHash(t,e)},verify:function(t,r,n){return e(this,arguments,void 0,(function*(t,e,r,n="1",i={}){if(!GN(t)&&!KN(t))throw new Error("Invalid address");const o=PS(r)?OS:nN;return yield o.default(t,e,r,n,i)}))},validate:function(t,r,n,i,o,s,h){return e(this,void 0,void 0,(function*(){if(!VN(r))return ZN(`Invalid author: ${r}`);if(!qN(i))return ZN(`Invalid network: ${i}`);if(!HN(o,i))return ZN(`Snapshot (${o}) must be 'latest' or greater than network start block (${oN[i].start})`);h||(h={});const{url:e,headers:u}=CN(h.url),l={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"validate",params:{validation:t,author:r,space:n,network:i,snapshot:o,params:s}})};try{const t=yield a(e,l);return(yield TN(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:GN,isEvmAddress:KN,getFormattedAddress:function(t,e){if("evm"===e&&KN(t))return Pe(t);if("starknet"===e&&GN(t))return NS(t);throw new Error(`Invalid address: ${t}`)},SNAPSHOT_SUBGRAPH_URL:bN};return{Client:or,Client712:or,schemas:dr,utils:JN}}));
|